From 760f7999437514bc76e22dbd52d0da673e49a9d5 Mon Sep 17 00:00:00 2001 From: Noah Penza Date: Sat, 5 Jul 2025 17:12:03 +1000 Subject: [PATCH] Add power menu to waybar --- bin/omarchy-power-menu | 41 +++++++++++++++++++++++++++++++++++++++++ config/waybar/config | 7 ++++++- config/waybar/style.css | 3 ++- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100755 bin/omarchy-power-menu diff --git a/bin/omarchy-power-menu b/bin/omarchy-power-menu new file mode 100755 index 0000000..d98f16a --- /dev/null +++ b/bin/omarchy-power-menu @@ -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 \ No newline at end of file diff --git a/config/waybar/config b/config/waybar/config index f0911c1..cd2718d 100644 --- a/config/waybar/config +++ b/config/waybar/config @@ -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" } } diff --git a/config/waybar/style.css b/config/waybar/style.css index 1cdbf6d..f50c0c5 100644 --- a/config/waybar/style.css +++ b/config/waybar/style.css @@ -23,7 +23,8 @@ #network, #bluetooth, #pulseaudio, -#clock { +#clock, +#custom-power-menu { min-width: 12px; margin-right: 13px; }