Merge pull request #65 from npenza/feat-add-power-menu-to-waybar

Add Power Menu to Waybar
This commit is contained in:
David Heinemeier Hansson
2025-07-06 14:57:58 -07:00
committed by GitHub
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",
"cpu",
"power-profiles-daemon",
"battery"
"battery",
"custom/power-menu"
],
"hyprland/workspaces": {
"on-click": "activate",
@ -121,5 +122,9 @@
"interval": 5,
"tooltip": true,
"tooltip-format": "{}"
},
"custom/power-menu": {
"format": "󰐥",
"on-click": "~/.local/share/omarchy/bin/omarchy-power-menu"
}
}

View File

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