37 lines
670 B
Bash
Executable File
37 lines
670 B
Bash
Executable File
#!/bin/bash
|
|
COMMANDS="Lock\nToggle Screensaver\nExit\nSuspend\nHibernate\nShutdown\nReboot"
|
|
|
|
[ "$(cat /proc/1/comm)" = "systemd" ] && logind=systemctl || logind=loginctl
|
|
|
|
COMMAND=`echo -e $COMMANDS | dmenu -fn 'Noto Sans Mono:size=15' -i -p "Power:" "$@"`
|
|
echo $COMMAND
|
|
case $COMMAND in
|
|
Lock)
|
|
exec xautolock -locknow
|
|
;;
|
|
"Toggle Screensaver")
|
|
exec xautolock -toggle
|
|
;;
|
|
Suspend)
|
|
xautolock -locknow
|
|
exec $logind suspend
|
|
;;
|
|
Hibernate)
|
|
xautolock -locknow
|
|
exec $logind hibernate
|
|
;;
|
|
Exit)
|
|
#exec i3-msg exit
|
|
#killall dwm
|
|
kill $PPID
|
|
;;
|
|
Shutdown)
|
|
#exec systemctl poweroff
|
|
exec poweroff
|
|
;;
|
|
Reboot)
|
|
#exec systemctl reboot
|
|
exec reboot
|
|
;;
|
|
esac
|