mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 12:19:24 +00:00
Add power menu to waybar
This commit is contained in:
41
bin/omarchy-power-menu
Executable file
41
bin/omarchy-power-menu
Executable 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
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,8 @@
|
||||
#network,
|
||||
#bluetooth,
|
||||
#pulseaudio,
|
||||
#clock {
|
||||
#clock,
|
||||
#custom-power-menu {
|
||||
min-width: 12px;
|
||||
margin-right: 13px;
|
||||
}
|
||||
|
Reference in New Issue
Block a user