Add power menu to waybar

This commit is contained in:
Noah Penza
2025-07-05 17:12:03 +10:00
parent 2d0f094449
commit 760f799943
3 changed files with 49 additions and 2 deletions

41
bin/omarchy-power-menu Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
# Power menu for Omarchy
# Provides power off, restart, and sleep options
# Function to show power menu
show_power_menu() {
local menu_options="󰐥 Power Off
󰜉 Restart
󰤄 Sleep
󰍃 Logout
󰒲 Lock"
# Show menu and get selection
local selection=$(echo -e "$menu_options" | wofi --show dmenu --prompt "Power Options" --width 200 --height 250)
if [ -n "$selection" ]; then
case "$selection" in
"󰐥 Power Off")
systemctl poweroff
;;
"󰜉 Restart")
systemctl reboot
;;
"󰤄 Sleep")
systemctl suspend
;;
"󰍃 Logout")
hyprctl dispatch exit
;;
"󰒲 Lock")
hyprlock
;;
*)
;;
esac
fi
}
# Main execution
show_power_menu

View File

@ -16,7 +16,8 @@
"pulseaudio", "pulseaudio",
"cpu", "cpu",
"power-profiles-daemon", "power-profiles-daemon",
"battery" "battery",
"custom/power-menu"
], ],
"hyprland/workspaces": { "hyprland/workspaces": {
"on-click": "activate", "on-click": "activate",
@ -121,5 +122,9 @@
"interval": 5, "interval": 5,
"tooltip": true, "tooltip": true,
"tooltip-format": "{}" "tooltip-format": "{}"
},
"custom/power-menu": {
"format": "󰐥",
"on-click": "~/.local/share/omarchy/bin/omarchy-power-menu"
} }
} }

View File

@ -23,7 +23,8 @@
#network, #network,
#bluetooth, #bluetooth,
#pulseaudio, #pulseaudio,
#clock { #clock,
#custom-power-menu {
min-width: 12px; min-width: 12px;
margin-right: 13px; margin-right: 13px;
} }