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
"modules-left": ["sway/workspaces"],
"modules-center": ["pulseaudio", "clock"],
"modules-right": ["tray", "memory", "battery"],
"modules-right": ["tray", "memory", "battery", "custom/power"],
"sway/workspaces": {
"disable-scroll": true,
"sort-by-name": true,
@@ -38,14 +38,17 @@
"format": "{icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""]
},
"memory": {
"format": "{used:0.1f}/{total:0.1f}G"
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}%",
"format-charging": "",
"format-plugged": "",
"format": "🔋{capacity}%",
"format-charging": "⚡{capacity}%",
"format-plugged": "🔌{capacity}%",
"format-alt": "{icon}",
"format-icons": ["", "", "", "", "", "", "", "", "", "", "", ""]
},
@@ -56,6 +59,16 @@
"format-icons": {
"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>