summaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2021-05-01 11:04:19 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2021-05-01 11:04:19 -0400
commit9ed9de5006d437e126c5871dc0cf38a02825aabb (patch)
treed92d4b6ad254626312ed84c78063dffb73dfa639 /.local/bin
parentaf79f164cc50ae0299b3820e9cab290cb6fbcd82 (diff)
workstation Files
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/compiler1
-rwxr-xr-x.local/bin/opout2
-rwxr-xr-x.local/bin/powermenu11
-rwxr-xr-x.local/bin/sysact22
4 files changed, 24 insertions, 12 deletions
diff --git a/.local/bin/compiler b/.local/bin/compiler
index 5b4f8c4..9020284 100755
--- a/.local/bin/compiler
+++ b/.local/bin/compiler
@@ -36,5 +36,6 @@ case "$file" in
*\.py) python "$file" ;;
*\.go) go run "$file" ;;
*\.sent) setsid sent "$file" 2>/dev/null & ;;
+ *.Xresources) xrdb -load "$file" ;;
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac
diff --git a/.local/bin/opout b/.local/bin/opout
index 25a8aa0..076bd16 100755
--- a/.local/bin/opout
+++ b/.local/bin/opout
@@ -8,4 +8,4 @@ case "$1" in
*.tex|*.rnw|*.gd|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;;
*.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;;
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
-esac && sleep 1 && dwmc rotatestack -1 && dwmc focusmaster &
+esac && sleep 0.1 && dwmc rotatestack -1 && dwmc focusmaster &
diff --git a/.local/bin/powermenu b/.local/bin/powermenu
deleted file mode 100755
index 994953e..0000000
--- a/.local/bin/powermenu
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-choice=$(printf "Logout\\nShutdown\\nReboot\\nHibernate" | dmenu -i -p "Power Utility")
-
-case $choice in
- *L*) $SCRIPTS/control/lockscreen ;;
- *H*) systemctl suspend ;;
- *R*) reboot ;;
- *S*) shutdown -h now ;;
- "") notify-send -i "$HOME/.fonts/svg/power-off.svg" -a Power "Operation suspended"
-esac
diff --git a/.local/bin/sysact b/.local/bin/sysact
new file mode 100755
index 0000000..5249070
--- /dev/null
+++ b/.local/bin/sysact
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# A dmenu wrapper script for system functions.
+
+# For non-systemd init systems.
+case "$(readlink -f /sbin/init)" in
+ *runit*) hib="sudo -A zzz" ;;
+ *openrc*) reb="sudo -A openrc-shutdown -r"; shut="sudo -A openrc-shutdown -p 0" ;;
+esac
+
+cmds="\
+ lock sudo loginctl lock-sessions
+ leave dwm killall xinit
+ renew dwm killall dwm
+ hibernate sudo loginctl hibernate
+ reboot ${reb:-sudo -A reboot}
+ shutdown ${shut:-sudo -A shutdown -h now}
+ display off xset dpms force off"
+
+choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
+
+`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`