Waybar power button

This commit is contained in:
2025-07-22 07:02:58 -04:00
parent c83de49eb2
commit 4eac1ed016
2 changed files with 33 additions and 5 deletions

View File

@@ -5,7 +5,7 @@
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["sway/workspaces"], "modules-left": ["sway/workspaces"],
"modules-center": ["pulseaudio", "clock"], "modules-center": ["pulseaudio", "clock"],
"modules-right": ["tray", "memory", "battery"], "modules-right": ["tray", "memory", "battery", "custom/power"],
"sway/workspaces": { "sway/workspaces": {
"disable-scroll": true, "disable-scroll": true,
"sort-by-name": true, "sort-by-name": true,
@@ -38,14 +38,17 @@
"format": "{icon}", "format": "{icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""] "format-icons": ["", "", "", "", "", "", "", "", ""]
}, },
"memory": {
"format": "{used:0.1f}/{total:0.1f}G"
},
"battery": { "battery": {
"states": { "states": {
"warning": 30, "warning": 30,
"critical": 15 "critical": 15
}, },
"format": "{capacity}%", "format": "🔋{capacity}%",
"format-charging": "", "format-charging": "⚡{capacity}%",
"format-plugged": "", "format-plugged": "🔌{capacity}%",
"format-alt": "{icon}", "format-alt": "{icon}",
"format-icons": ["", "", "", "", "", "", "", "", "", "", "", ""] "format-icons": ["", "", "", "", "", "", "", "", "", "", "", ""]
}, },
@@ -56,6 +59,16 @@
"format-icons": { "format-icons": {
"default": ["", "", " "] "default": ["", "", " "]
}, },
"on-click": "pavucontrol" "on-click": "pwvucontrol"
},
"custom/power": {
"format" : "⏻",
"tooltip": false,
"menu": "on-click",
"menu-file": "~/.config/waybar/power_menu.xml",
"menu-actions": {
"shutdown": "systemctl poweroff",
"reboot": "systemctl reboot"
}
}, },
} }

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkMenu" id="menu">
<child>
<object class="GtkMenuItem" id="shutdown">
<property name="label">Shutdown</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label">Reboot</property>
</object>
</child>
</object>
</interface>