mirror of
https://github.com/lightly-toasted/nix-config.git
synced 2025-10-04 15:45:39 +00:00
refactor: migrate powermenu.sh to writeShellScriptBin
This commit is contained in:
parent
1f045e291d
commit
19ee0fc14e
6 changed files with 28 additions and 22 deletions
|
@ -71,7 +71,7 @@
|
|||
"$mod SHIFT, 0, movetoworkspace, 10"
|
||||
|
||||
"$mod SHIFT, S, exec, env HYPRSHOT_DIR=/data/Backup/Screenshots hyprshot -m region"
|
||||
"$mod SHIFT, E, exec, ~/bin/powermenu.sh"
|
||||
"$mod SHIFT, E, exec, powermenu"
|
||||
|
||||
"$mod, mouse:277, exec, cycle-mouse-action"
|
||||
", mouse:277, exec, run-mouse-action"
|
||||
|
|
24
home/toast/modules/powermenu.nix
Executable file
24
home/toast/modules/powermenu.nix
Executable file
|
@ -0,0 +1,24 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = [
|
||||
(pkgs.writeShellScriptBin "powermenu" ''
|
||||
choice=$(printf """
|
||||
Logout
|
||||
⏻ Shutdown
|
||||
Reboot
|
||||
Suspend
|
||||
Hibernate
|
||||
""" | ${pkgs.tofi}/bin/tofi)
|
||||
|
||||
case "$choice" in
|
||||
" Logout") ${pkgs.uwsm}/bin/uwsm stop ;;
|
||||
"⏻ Shutdown") ${pkgs.systemd}/bin/systemctl poweroff ;;
|
||||
" Reboot") ${pkgs.systemd}/bin/systemctl reboot ;;
|
||||
" Suspend") ${pkgs.systemd}/bin/systemctl suspend ;;
|
||||
" Hibernate") ${pkgs.systemd}/bin/systemctl hibernate ;;
|
||||
esac
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue