diff --git a/home/default/.local/bin/idle b/home/default/.local/bin/idle index 59a63f8..9e3a039 100755 --- a/home/default/.local/bin/idle +++ b/home/default/.local/bin/idle @@ -1,8 +1,15 @@ #!/bin/zsh -if [[ -z "$1" ]]; then +if [[ -z "$1" ]] && [[ "$WINDOW_MANAGER" == "river" ]] ; then swayidle -w \ timeout 310 'swaylock' \ - timeout 360 "wlopm --off '*'" resume "wlopm --on '*'" \ + timeout 300 'wlopm --off "*"' resume 'wlopm --on "*"' \ + before-sleep "swaylock" +fi + +if [[ -z "$1" ]] && [[ "$WINDOW_MANAGER" == "sway" ]] ; then +swayidle -w \ + timeout 310 'swaylock' \ + timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ before-sleep "swaylock" fi diff --git a/home/default/.local/bin/sysact b/home/default/.local/bin/sysact index 1837085..5a41b7b 100755 --- a/home/default/.local/bin/sysact +++ b/home/default/.local/bin/sysact @@ -13,7 +13,8 @@ esac case "$(printf "🔒 lock\n🚪 leave $WM\n♻️ renew $WM\n🐻 hibernate\n🔃 reboot\n🖥️ shutdown\n💤 sleep\n📺 display off\n set background\n start idle\n kill swayidle\n fcitx5\n kill fcitx5\n start emacs daemon\n kill emacs daemon\n restart emacs daemon\ntoggle sworkstyle" | wofi -L 17 --cache-file=/dev/null --show=dmenu -i -p 'action')" in '🔒 lock') setsid -f swaylock - setsid -f sleep 2 && swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#' + if [ "$WINDOW_MANAGER" == "river" ]; then setsid -f sleep 2 && swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#' ; fi + if [ "$WINDOW_MANAGER" == "sway" ]; then setsid -f sleep 2 && swayidle -w timeout 1 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on" && kill $#' ; fi ;; "🚪 leave $WM") if [ "$WINDOW_MANAGER" == "sway" ]; then swaymsg exit ; fi @@ -28,7 +29,10 @@ case "$(printf "🔒 lock\n🚪 leave $WM\n♻️ renew $WM\n🐻 hibernate\n '🔃 reboot') $ctl reboot -i ;; '🖥️ shutdown') $ctl poweroff -i ;; #'📺 display off') swayidle -w timeout 1 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on" && kill $#' ;; - '📺 display off') swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#' ;; + '📺 display off') + if [ "$WINDOW_MANAGER" == "river" ]; then setsid -f sleep 2 && swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#' ; fi + if [ "$WINDOW_MANAGER" == "sway" ]; then setsid -f sleep 2 && swayidle -w timeout 1 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on" && kill $#' ; fi + ;; ' set background') change-background ;; ' start idle') killall swayidle && sleep 1; setsid -f idle && notify-send 'idle started.';; ' kill swayidle') killall swayidle && notify-send 'idle killed.';;