get back wofi for now

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2025-10-13 12:05:49 +02:00
parent 45aa87f9f8
commit e79e8d0d3b
4 changed files with 148 additions and 3 deletions

View File

@@ -5,6 +5,47 @@
#- - `lock` - Lock the screen. (hyprlock)
#- - `powermode-toggle` - Toggle between performance and balanced power mode. (powerprofilesctl)
{pkgs, ...}: let
menu =
pkgs.writeShellScriptBin "menu"
# bash
''
if pgrep wofi; then
pkill wofi
else
wofi -p "Apps" --show drun
fi
'';
powermenu =
pkgs.writeShellScriptBin "powermenu"
# bash
''
if pgrep wofi >/dev/null; then
pkill wofi
exit 0
fi
declare -A actions=(
["󰌾 Lock"]="hyprlock"
["󰍃 Logout"]="hyprctl dispatch exit"
[" Suspend"]="systemctl suspend"
["󰑐 Reboot"]="systemctl reboot"
["󰿅 Shutdown"]="systemctl poweroff"
)
selected_option=$(
printf '%s\n' "''${!actions[@]}" | wofi -p "Powermenu" --dmenu
)
if [[ -n "$selected_option" ]]; then
action_command=''${actions["''$selected_option"]}
if [[ -n "$action_command" ]]; then
eval "$action_command"
fi
fi
'';
lock =
pkgs.writeShellScriptBin "lock"
# bash
@@ -25,4 +66,4 @@
${pkgs.swayosd}/bin/swayosd-client --custom-message="Powermode set to performance" --custom-icon="emblem-default"
fi
'';
in {home.packages = [lock powermode-toggle];}
in {home.packages = [lock powermode-toggle menu powermenu];}