From f23f7983d914f9d2acb74804eb36cc6111febad8 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 21:32:32 +0000 Subject: [PATCH 1/8] Setup power rofi menu --- config/home.nix | 1 + config/home/scripts/system/power.sh | 18 ++++++++++++++++++ config/packages/i3/config | 1 + 3 files changed, 20 insertions(+) create mode 100644 config/home/scripts/system/power.sh 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..d32c02b --- /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 sleep +elif [ "$option" = "Logout" ]; + i3-msg exit +then +elif [ "$option" = "Shutdown" ]; + poweroff +then +elif [ "$option" = "Restart" ]; + reboot +then +fi diff --git a/config/packages/i3/config b/config/packages/i3/config index bbac9de..3c51aa1 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 $mod+Mod1+delete exec "bash /home/vylpes/.cache/scripts/power.sh" # resize window (you can also use the mouse for that) mode "resize" { From bdda60a48ea86d4180067034a856afdeb3807247 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 21:33:23 +0000 Subject: [PATCH 2/8] delete to del --- config/packages/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/packages/i3/config b/config/packages/i3/config index 3c51aa1..18b6e4e 100644 --- a/config/packages/i3/config +++ b/config/packages/i3/config @@ -191,7 +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 $mod+Mod1+delete exec "bash /home/vylpes/.cache/scripts/power.sh" +bindsym $mod+Mod1+del exec "bash /home/vylpes/.cache/scripts/power.sh" # resize window (you can also use the mouse for that) mode "resize" { From ddfe7e636251b98570d348e2c495c3aefb5b586d Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 21:34:10 +0000 Subject: [PATCH 3/8] Use control+alt+delete --- config/packages/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/packages/i3/config b/config/packages/i3/config index 18b6e4e..0c4f3ac 100644 --- a/config/packages/i3/config +++ b/config/packages/i3/config @@ -191,7 +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 $mod+Mod1+del exec "bash /home/vylpes/.cache/scripts/power.sh" +bindsym Control+Alt+delete exec "bash /home/vylpes/.cache/scripts/power.sh" # resize window (you can also use the mouse for that) mode "resize" { From b890478dcde43b38dedc830af348ab03b11b07ab Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 21:34:46 +0000 Subject: [PATCH 4/8] Use del --- config/packages/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/packages/i3/config b/config/packages/i3/config index 0c4f3ac..f4b7f83 100644 --- a/config/packages/i3/config +++ b/config/packages/i3/config @@ -191,7 +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+Alt+delete exec "bash /home/vylpes/.cache/scripts/power.sh" +bindsym Control+Alt+del exec "bash /home/vylpes/.cache/scripts/power.sh" # resize window (you can also use the mouse for that) mode "resize" { From 4ffb2792f9bd943214eb347ca55d75f585bbab3d Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 21:35:53 +0000 Subject: [PATCH 5/8] Use Delete --- config/packages/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/packages/i3/config b/config/packages/i3/config index f4b7f83..729df24 100644 --- a/config/packages/i3/config +++ b/config/packages/i3/config @@ -191,7 +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+Alt+del exec "bash /home/vylpes/.cache/scripts/power.sh" +bindsym Control+Alt+Delete exec "bash /home/vylpes/.cache/scripts/power.sh" # resize window (you can also use the mouse for that) mode "resize" { From ecb37e9a3603f75a41c5b45b1ebbf5247c1a007e Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 21:37:32 +0000 Subject: [PATCH 6/8] Use home --- config/packages/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/packages/i3/config b/config/packages/i3/config index 729df24..95470a9 100644 --- a/config/packages/i3/config +++ b/config/packages/i3/config @@ -191,7 +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+Alt+Delete exec "bash /home/vylpes/.cache/scripts/power.sh" +bindsym Control+Mod1+Delete exec "bash /home/vylpes/.cache/scripts/power.sh" # resize window (you can also use the mouse for that) mode "resize" { From 75079368181ae0b246fb53738aa47b8f3926793c Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 21:39:47 +0000 Subject: [PATCH 7/8] Fix syntax errors --- config/home/scripts/system/power.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/home/scripts/system/power.sh b/config/home/scripts/system/power.sh index d32c02b..54278b0 100644 --- a/config/home/scripts/system/power.sh +++ b/config/home/scripts/system/power.sh @@ -7,12 +7,12 @@ then i3lock-fancy -g -t "System Locked" -f Hack-Regular systemctl sleep elif [ "$option" = "Logout" ]; +then i3-msg exit -then elif [ "$option" = "Shutdown" ]; +then poweroff -then elif [ "$option" = "Restart" ]; - reboot then + reboot fi From f8c722050398054ea8c95d278da4923fe54ce2fd Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 21:40:48 +0000 Subject: [PATCH 8/8] Suspend --- config/home/scripts/system/power.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/home/scripts/system/power.sh b/config/home/scripts/system/power.sh index 54278b0..53e4d57 100644 --- a/config/home/scripts/system/power.sh +++ b/config/home/scripts/system/power.sh @@ -5,7 +5,7 @@ option=$(printf "Sleep\nLogout\nShutdown\nRestart" | rofi -dmenu -theme Arc-Dark if [ "$option" = "Sleep" ]; then i3lock-fancy -g -t "System Locked" -f Hack-Regular - systemctl sleep + systemctl suspend elif [ "$option" = "Logout" ]; then i3-msg exit