Add power menu to hyprland

This commit is contained in:
KoenDR06 2026-01-19 17:22:12 +01:00
parent 4e7fcaf3a5
commit c5c233509c
2 changed files with 23 additions and 0 deletions

12
misc/power-menu.sh Executable file
View file

@ -0,0 +1,12 @@
cmds=('shutdown now' 'reboot' 'hyprlock' 'hyprctl dispatch exit')
count=${#cmds[@]}
default=15
lines=$((count > default ? default : count))
a=$(printf ' Shut down\n Reboot\n Lock\n Log out' | fuzzel --dmenu --index --lines $lines --placeholder "Power action: " -I)
if [ -n "$a" ]; then
${cmds[a]}
fi

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
config, config,
pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
@ -43,6 +44,16 @@ in {
params = "pkill waybar || waybar"; params = "pkill waybar || waybar";
} }
{
flags = [];
mods = ["SUPER"];
key = "P";
dispatcher = "exec";
params = let
a = pkgs.writeShellScriptBin "power-menu" (builtins.readFile ../../../misc/power-menu.sh);
in "pkill fuzzel || ${a}/bin/power-menu";
}
{ {
flags = []; flags = [];
mods = ["SUPER"]; mods = ["SUPER"];