wms/wms_session.sh
2024-01-21 00:05:04 -03:00

60 lines
855 B
Bash
Executable file

#!/bin/sh
## manage session and some more things ##
. /tmp/wms_var
# keybindings reload.
KBRELOAD="pkill -usr1 -x sxhkd"
# lock screen monitor.
LOCK="slock"
# poweroff monitor.
MOFF="xset dpms force off"
# suspend to ram.
SP="doas zzz -z"
# hibernate.
HB="doas zzz -Z"
# reboot.
RB="doas shutdown -r now"
# poweroff.
POFF="doas shutdown -h now"
# exit session.
EXIT="pkill wew"
# litle menu.
PROMPT="reload-key\nlock\nmonitor-off\nhalt\nreboot\nsuspend\nhibernate\nexit"
option=`echo $PROMPT | $XMENU`
if [ ${#option} -gt 0 ]; then
case $option in
reload-key)
$KBRELOAD
;;
lock)
$LOCK
;;
monitor-off)
$MOFF
;;
suspend)
$SP
;;
hibernate)
$HB
;;
halt)
$POFF
;;
reboot)
$RB
;;
exit)
$EXIT
;;
*)
;;
esac
else
exit 0
fi