diff --git a/config/home.nix b/config/home.nix index f4e519d..6e641db 100644 --- a/config/home.nix +++ b/config/home.nix @@ -37,6 +37,7 @@ in { file = { "/home/${username}/.scripts/audio/get-sink-name.sh".source = ./home/scripts/audio/get-sink-name.sh; "/home/${username}/.cache/scripts/get-sink-name.txt".source = ./home/cache/audio/get-sink-name.txt; + "/home/${username}/.cache/scripts/power.sh".source = ./home/scripts/system/power.sh; }; packages = with pkgs; [ diff --git a/config/home/scripts/system/power.sh b/config/home/scripts/system/power.sh new file mode 100644 index 0000000..53e4d57 --- /dev/null +++ b/config/home/scripts/system/power.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +option=$(printf "Sleep\nLogout\nShutdown\nRestart" | rofi -dmenu -theme Arc-Dark -font 'hack 18') + +if [ "$option" = "Sleep" ]; +then + i3lock-fancy -g -t "System Locked" -f Hack-Regular + systemctl suspend +elif [ "$option" = "Logout" ]; +then + i3-msg exit +elif [ "$option" = "Shutdown" ]; +then + poweroff +elif [ "$option" = "Restart" ]; +then + reboot +fi diff --git a/config/packages/i3/config b/config/packages/i3/config index bbac9de..95470a9 100644 --- a/config/packages/i3/config +++ b/config/packages/i3/config @@ -191,6 +191,7 @@ bindsym $mod+Mod1+r reload bindsym $mod+Shift+r restart # exit i3 (logs you out of your X session) bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" +bindsym Control+Mod1+Delete exec "bash /home/vylpes/.cache/scripts/power.sh" # resize window (you can also use the mouse for that) mode "resize" {