add emacs daemon shortcut, use swaymsg instead of wlopm

This commit is contained in:
cho 2023-05-04 22:14:03 +07:00
parent c974edaa14
commit eecb112ad3

View File

@ -7,10 +7,10 @@ case "$(readlink -f /sbin/init)" in
*) ctl='loginctl' ;;
esac
case "$(printf "🔒 lock\n🚪 leave $WM\n♻ renew\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" | dmenu -i -l 12 -p 'Action: ')" in
case "$(printf "🔒 lock\n🚪 leave $WM\n♻ renew\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" | dmenu -i -l 15 -p 'Action: ')" in
'🔒 lock')
setsid -f swaylock
setsid -f sleep 2 && swayidle -w timeout 1 'wlopm --off "*"' resume 'wlopm --on "*" && kill $#'
setsid -f sleep 2 && swayidle -w timeout 1 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on" && kill $#'
;;
"🚪 leave $WM") swaymsg exit ;;
"♻️ renew") swaymsg reload ;;
@ -24,5 +24,7 @@ case "$(printf "🔒 lock\n🚪 leave $WM\n♻ renew\n🐻 hibernate\n🔃 re
' kill swayidle') killall swayidle ;;
' fcitx5') fcitx5 ;;
' kill fcitx5') killall fcitx5 ;;
' start emacs daemon') emacs --daemon && notify-send 'emacs daemon started' ;;
' kill emacs daemon') killall emacs && notify-send 'emacs daemon killed' ;;
*) exit 1 ;;
esac