From 98ebb096a7f3eb2a2e502825b71d6b0353199c5f Mon Sep 17 00:00:00 2001 From: serxoz Date: Fri, 12 Aug 2022 12:13:54 +0200 Subject: [PATCH] directorio ~/bin --- bin/clean.sh | 3 +++ bin/install.sh | 5 +++++ bin/power | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 bin/clean.sh create mode 100644 bin/install.sh create mode 100755 bin/power 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