feat: nb make swayidle to a toggle
This commit is contained in:
parent
2d2b15d1bc
commit
431ab4e49c
2 changed files with 38 additions and 8 deletions
|
|
@ -212,7 +212,7 @@ bindsym $mod+Shift+c reload
|
|||
bindsym $mod+Shift+r restart
|
||||
|
||||
# manage i3 session
|
||||
bindsym $mod+Shift+e exec swaynag --background f1fa8c --border ffb86c --border-bottom-size 0 --button-background ffb86c --button-text 282a36 -t warning -f "pango:Hack 9" -m "Do you really want to exit?" -B " Auto Suspend Off " "pkill swayidle" -B " Exit " "swaymsg exit" -B " Lock " "pkill swaynag && swaylock -c 252525 -s center -i ~/.wallpaper.png" -B " Reboot " "pkill swaynag && reboot" -B " Shutdown " "pkill swaynag && shutdown -h now" -B " Suspend " "pkill swaynag && systemctl suspend"
|
||||
bindsym $mod+Shift+e exec session-menu
|
||||
|
||||
# resize window
|
||||
bindsym $mod+r mode " "
|
||||
|
|
@ -299,13 +299,7 @@ exec thunderbird
|
|||
exec firefox
|
||||
exec nextcloud
|
||||
exec cryptomator
|
||||
exec swayidle \
|
||||
before-sleep 'loginctl lock-session $XDG_SESSION_ID' \
|
||||
lock 'swaylock -c 252525 -s center -i ~/.wallpaper.png' \
|
||||
timeout 120 'light -O && light -S 10' \
|
||||
resume 'light -I' \
|
||||
timeout 180 'swaylock -c 252525 -s center -i ~/.wallpaper.png' \
|
||||
timeout 600 'systemctl suspend'
|
||||
exec toggle-swayidle
|
||||
exec dunst
|
||||
#exec --no-startup-id swaybg -c "#000000" -m fill -i ~/.config/wallpaper/wot.jpg
|
||||
# exec --no-startup-id gnome-keyring-daemon --start --components=pkcs11,secrets,ssh
|
||||
|
|
|
|||
|
|
@ -72,6 +72,40 @@ let
|
|||
fi
|
||||
'';
|
||||
|
||||
toggle-swayidle = pkgs.writeShellScriptBin "toggle-swayidle" ''
|
||||
if pgrep -x swayidle >/dev/null; then
|
||||
pkill -x swayidle
|
||||
else
|
||||
swayidle \
|
||||
before-sleep 'loginctl lock-session $XDG_SESSION_ID' \
|
||||
lock 'swaylock -c 252525 -s center -i ~/.wallpaper.png' \
|
||||
timeout 120 'light -O && light -S 10' \
|
||||
resume 'light -I' \
|
||||
timeout 180 'swaylock -c 252525 -s center -i ~/.wallpaper.png' \
|
||||
timeout 600 'systemctl suspend' &
|
||||
disown
|
||||
fi
|
||||
'';
|
||||
|
||||
session-menu = pkgs.writeShellScriptBin "session-menu" ''
|
||||
if pgrep -x swayidle >/dev/null; then
|
||||
suspend_label="Auto Suspend Off"
|
||||
else
|
||||
suspend_label="Auto Suspend On"
|
||||
fi
|
||||
|
||||
swaynag \
|
||||
--background f1fa8c --border ffb86c --border-bottom-size 0 \
|
||||
--button-background ffb86c --button-text 282a36 \
|
||||
-t warning -f "pango:Hack 9" \
|
||||
-m "Do you really want to exit?" \
|
||||
-B " $suspend_label " "pkill swaynag; toggle-swayidle" \
|
||||
-B " Exit " "swaymsg exit" \
|
||||
-B " Lock " "pkill swaynag && swaylock -c 252525 -s center -i ~/.wallpaper.png" \
|
||||
-B " Reboot " "pkill swaynag && reboot" \
|
||||
-B " Shutdown " "pkill swaynag && shutdown -h now" \
|
||||
-B " Suspend " "pkill swaynag && systemctl suspend"
|
||||
'';
|
||||
|
||||
sway-conf = builtins.readFile ./sway.conf + ''
|
||||
exec swaybg -m center -c 252525 -i ~/.wallpaper.png
|
||||
|
|
@ -88,6 +122,8 @@ in {
|
|||
wayland
|
||||
wofi
|
||||
battery-alert-swaynag
|
||||
toggle-swayidle
|
||||
session-menu
|
||||
];
|
||||
|
||||
programs.sway = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue