summaryrefslogtreecommitdiff
path: root/nixos/cat.nix
diff options
context:
space:
mode:
authorcaley <u65487754@gmail.com>2026-05-20 09:19:37 +0000
committerGitHub <noreply@github.com>2026-05-20 09:19:37 +0000
commit5ef5639466093cd68150a153482b8c947ff2efa4 (patch)
tree2c0fb6d5e5d72fe7e6179dd975e6ebd0be363b48 /nixos/cat.nix
parent9f93ae7f479155ca56577d87bc7507e6d8e68973 (diff)
Add power management script with options
Diffstat (limited to 'nixos/cat.nix')
-rw-r--r--nixos/cat.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/cat.nix b/nixos/cat.nix
index 29c061a..ac28a92 100644
--- a/nixos/cat.nix
+++ b/nixos/cat.nix
@@ -380,5 +380,27 @@
'';
};
+home.packages = with pkgs; [
+ (writeShellScriptBin "power" ''
+ options="lock\nlogout\nshutdown\nreboot"
+ choice=$(echo -e "$options" | ${pkgs.rofi}/bin/rofi -dmenu -i -p ">")
+
+ case "$choice" in
+ lock)
+ ${pkgs.hyprlock}/bin/hyprlock
+ ;;
+ logout)
+ command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || ${pkgs.hyprland}/bin/hyprctl dispatch exit
+ ;;
+ shutdown)
+ shutdown now
+ ;;
+ reboot)
+ reboot
+ ;;
+ esac
+ '')
+ ];
+
programs.home-manager.enable = true;
}