From b490fe4bea23a89d85509403c9e5a86f2c16173e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Wed, 30 Oct 2024 17:38:56 +0300 Subject: trying out niri --- dotfiles/.local/bin/lock-color | 12 +++++++----- dotfiles/.local/bin/swaysession | 14 +++++++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'dotfiles/.local/bin') diff --git a/dotfiles/.local/bin/lock-color b/dotfiles/.local/bin/lock-color index 2187d44..0611c29 100755 --- a/dotfiles/.local/bin/lock-color +++ b/dotfiles/.local/bin/lock-color @@ -1,13 +1,15 @@ #!/bin/sh -swaymsg input type:keyboard xkb_switch_layout 0 +if [ -n "$SWAYSOCK"]; then + swaymsg input type:keyboard xkb_switch_layout 0 -gpg-connect-agent --no-autostart reloadagent /bye - -if [ "$1" != "screenon" ]; then - swayidle timeout 30 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' & + if [ "$1" != "screenon" ]; then + swayidle timeout 30 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' & + fi fi +gpg-connect-agent --no-autostart reloadagent /bye + canberra-gtk-play -i Oxygen-Window-All-Desktops-Not & swaylock diff --git a/dotfiles/.local/bin/swaysession b/dotfiles/.local/bin/swaysession index 0beaa1c..218ff43 100755 --- a/dotfiles/.local/bin/swaysession +++ b/dotfiles/.local/bin/swaysession @@ -2,13 +2,21 @@ [ "$(cat /proc/1/comm)" = "systemd" ] && logind=systemctl || logind=loginctl +exit_session() { + if [ -n "$SWAYSOCK" ]; then + swaymsg exit + else + niri msg quit + fi +} + case "$1" in lock) lock-color ;; logout) canberra-gtk-play -i Oxygen-Sys-Log-Out & sleep 1.2 - swaymsg exit + exit_session clear if [ ! -e ~/.cache/dont-kill ]; then killall -u $(whoami) @@ -26,13 +34,13 @@ case "$1" in reboot) canberra-gtk-play -i Oxygen-Sys-Log-Out & sleep 1.2 clear - swaymsg exit + exit_session sudo reboot now ;; poweroff) canberra-gtk-play -i Oxygen-Sys-Log-Out & sleep 1.2 clear - swaymsg exit + exit_session # Having problems with logind poweroff and reboot after sway exit sudo poweroff now ;; -- cgit v1.2.3