diff --git a/bin/clean.sh b/bin/clean.sh new file mode 100644 index 0000000..72b8d63 --- /dev/null +++ b/bin/clean.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +rm -rf ~/bin/power diff --git a/bin/install.sh b/bin/install.sh new file mode 100644 index 0000000..8e95ee1 --- /dev/null +++ b/bin/install.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +rm -rf ~/bin/power + +ln -s $HOME/dotfiles/bin/power $HOME/bin/power diff --git a/bin/power b/bin/power new file mode 100755 index 0000000..83294cd --- /dev/null +++ b/bin/power @@ -0,0 +1,36 @@ +#!/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