feat(waybar): add battery module and styles

This commit is contained in:
2026-03-23 14:25:53 -04:00
parent 1f7ed68ce7
commit 7c7b0dbb47
3 changed files with 144 additions and 22 deletions

View File

@@ -23,6 +23,7 @@
"pulseaudio", "pulseaudio",
"cpu", "cpu",
"memory", "memory",
"battery",
"tray", "tray",
"custom/power" "custom/power"
], ],
@@ -34,6 +35,27 @@
"interval": 5, "interval": 5,
"format": "󰻠 {usage}%" "format": "󰻠 {usage}%"
}, },
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-charging": "󰂄 {capacity}%",
"format-plugged": " {capacity}%",
"format-full": "󰁹 100%",
"format-icons": [
"󰂎",
"󰁺",
"󰁼",
"󰁾",
"󰂀",
"󰂂",
"󰁹"
],
"interval": 10,
"tooltip": true
},
"tray": { "tray": {
"icon-size": 18, "icon-size": 18,
"spacing": 6, "spacing": 6,
@@ -83,7 +105,7 @@
} }
}, },
"clock": { "clock": {
"format": "{:%a %d %b}", "format": "{:%a %d %b - %H:%m}",
"rotate": 0, "rotate": 0,
"tooltip-format": "<tt>{calendar}</tt>", "tooltip-format": "<tt>{calendar}</tt>",
"calendar": { "calendar": {

View File

@@ -1,51 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<object class="GtkMenu" id="menu"> <object class="GtkMenu" id="menu">
<child>
<object class="GtkMenuItem" id="section-session">
<property name="label">Session</property>
<property name="sensitive">False</property>
<property name="can-focus">False</property>
<style>
<class name="section-header"/>
</style>
</object>
</child>
<!-- Session controls -->
<child> <child>
<object class="GtkMenuItem" id="lock"> <object class="GtkMenuItem" id="lock">
<property name="label"> Lock</property> <property name="label">󰌾 Lock</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkMenuItem" id="logout"> <object class="GtkMenuItem" id="logout">
<property name="label">󰍃 Logout</property> <property name="label">󰍃 Log Out</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkSeparatorMenuItem" id="sep1" /> <object class="GtkSeparatorMenuItem" id="sep1"/>
</child>
<child>
<object class="GtkMenuItem" id="section-sleep">
<property name="label">Sleep</property>
<property name="sensitive">False</property>
<property name="can-focus">False</property>
<style>
<class name="section-header"/>
</style>
</object>
</child> </child>
<!-- Power controls -->
<child> <child>
<object class="GtkMenuItem" id="suspend"> <object class="GtkMenuItem" id="suspend">
<property name="label"> Suspend</property> <property name="label">󰤄 Suspend</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="hibernate">
<property name="label">⏾ Hibernate</property>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkSeparatorMenuItem" id="sep2" /> <object class="GtkMenuItem" id="hibernate">
<property name="label">󰒲 Hibernate</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="sep2"/>
</child>
<child>
<object class="GtkMenuItem" id="section-power">
<property name="label">Power</property>
<property name="sensitive">False</property>
<property name="can-focus">False</property>
<style>
<class name="section-header"/>
</style>
</object>
</child>
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label">󰜉 Reboot</property>
</object>
</child> </child>
<child> <child>
<object class="GtkMenuItem" id="shutdown"> <object class="GtkMenuItem" id="shutdown">
<property name="label"> Shutdown</property> <property name="label">󰐥 Shut Down</property>
</object> </object>
</child> </child>
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label"> Reboot</property>
</object>
</child>
</object> </object>
</interface> </interface>

View File

@@ -44,6 +44,7 @@ tooltip {
#pulseaudio, #pulseaudio,
#cpu, #cpu,
#memory, #memory,
#battery,
#tray, #tray,
#custom-power { #custom-power {
background: @background; background: @background;
@@ -100,7 +101,7 @@ tooltip {
#clock { #clock {
border-color: alpha(@accent, 0.35); border-color: alpha(@accent, 0.35);
color: @foreground; color: @foreground;
font-weight: 700; font-weight: 400;
padding: 0 18px; padding: 0 18px;
} }
@@ -121,6 +122,23 @@ tooltip {
color: @warning; color: @warning;
} }
#battery {
color: @accent-soft;
}
#battery.charging,
#battery.plugged {
color: @accent;
}
#battery.warning:not(.charging) {
color: @warning;
}
#battery.critical:not(.charging) {
color: @danger;
}
#tray { #tray {
padding: 0 14px; padding: 0 14px;
} }
@@ -137,6 +155,7 @@ tooltip {
#pulseaudio:hover, #pulseaudio:hover,
#cpu:hover, #cpu:hover,
#memory:hover, #memory:hover,
#battery:hover,
#tray:hover, #tray:hover,
#custom-power:hover, #custom-power:hover,
#clock:hover { #clock:hover {
@@ -152,3 +171,54 @@ tooltip {
.hidden { .hidden {
opacity: 0; opacity: 0;
} }
menu#menu {
background: @background;
border: 1px solid alpha(@accent-alt, 0.24);
border-radius: 14px;
padding: 8px;
}
menu#menu menuitem {
border-radius: 10px;
margin: 2px 4px;
padding: 6px 12px;
}
menu#menu menuitem:hover {
background: @background-alt;
}
menu#menu menuitem.section-header {
color: @foreground-muted;
font-size: 12px;
margin-top: 4px;
padding: 4px 12px;
}
menu#menu menuitem#lock {
color: @accent;
}
menu#menu menuitem#logout {
color: @accent-soft;
}
menu#menu menuitem#suspend,
menu#menu menuitem#hibernate {
color: @type;
}
menu#menu menuitem#reboot {
color: @warning;
}
menu#menu menuitem#shutdown {
color: @danger;
font-weight: 700;
}
menu#menu separator {
background: alpha(@accent-alt, 0.24);
margin: 6px 10px;
}