diff options
Diffstat (limited to 'i3/Scripts')
-rwxr-xr-x | i3/Scripts/lc | 91 | ||||
-rw-r--r-- | i3/Scripts/mic.sh | 19 | ||||
-rw-r--r-- | i3/Scripts/net.sh | 19 | ||||
-rw-r--r-- | i3/Scripts/ram.sh | 19 | ||||
-rw-r--r-- | i3/Scripts/runStat.sh | 6 | ||||
-rw-r--r-- | i3/Scripts/status.sh | 20 |
6 files changed, 174 insertions, 0 deletions
diff --git a/i3/Scripts/lc b/i3/Scripts/lc new file mode 100755 index 0000000..a54f234 --- /dev/null +++ b/i3/Scripts/lc @@ -0,0 +1,91 @@ +#!/bin/bash + +Commands="update poweroff suspend set-keyboard caps-lock battery cups-website vim emacs htop scrot overleaf-render overleaf win pass wall stat mic" +statScripts="ram.sh status.sh net.sh mic.sh" + +handle_stuff() { + if [ "$1" = "--dmenu" ]; then + $0 $(echo $Commands | tr " " "\n" | dmenu -i -p ":") + fi + + if [ "$1" = "edit" ] || [ "$1" = "e" ]; then + notify-send "$*" + st -e nvim $(echo $* | cut -d" " -f2-) + fi + +# System info + if [ "$1" = "b" ] || [ "$1" = "battery" ]; then + notify-send "Battery information" "$(acpi | grep 1:)" + fi + +# System maintenance + if [ "$1" = "sk" ] || [ "$1" = "set-keyboard" ]; then + setxkbmap -layout us -variant altgr-intl + xcape -e "Control_R=Escape" + xmodmap .Xmodmap + fi + +# POWER COMMANDS + if [ "$1" = "s" ] || [ "$1" = "suspend" ]; then + systemctl suspend + fi + if [ "$1" = "poweroff" ]; then + poweroff + fi + +# Mics + if [ "$1" = "p" ] || [ "$1" = "scrot" ]; then + scrot /tmp/%Y-%m-%d-%T-screenshot.png + fi + + if [ "$1" = "overleaf-render" ]; then + st sh ~/Documents/overleafRenderer/compile.sh + fi + + if [ "$1" = "caps-lock" ] || [ "$1" = "cl" ]; then + xdotool key Caps_Lock + fi + + if [ "$1" = "win" ]; then + vboxmanage startvm "Windows xp" + fi + if [ "$1" = "wall" ]; then + feh --bg-tile Pictures/defaultWall.* + fi + if [ "$1" = "mic" ]; then + amixer set Capture toggle + fi + +# Launch + if [ "$1" = "vi" ] || [ "$1" = "vim" ]; then + st -e nvim + fi + if [ "$1" = "emacs" ]; then + st -e emacs + fi + if [ "$1" = "ht" ] || [ "$1" = "htop" ]; then + st -e htop + fi + if [ "$1" = "cups" ] || [ "$1" = "cups-website" ]; then + firefox "http://localhost:631/" + fi + if [ "$1" = "overleaf" ]; then + firefox -p Sharelatex --no-remote + fi + if [ "$1" = "pass" ]; then + bash $HOME/Scripts/passmenu --type + fi + + if [ "$1" = "stat" ]; then + sh /home/julian/Scripts/$(echo $statScripts | tr " " "\n" | dmenu -i -p "stat") + fi + +# Calc + if [ "$(echo $1 | head -c 1)" = "=" ]; then + calc="$(echo $1 | cut -c 2-)" + notify-send "Result" "$calc = $(echo $calc | bc)" + fi +} + + +handle_stuff $* & diff --git a/i3/Scripts/mic.sh b/i3/Scripts/mic.sh new file mode 100644 index 0000000..78afaa8 --- /dev/null +++ b/i3/Scripts/mic.sh @@ -0,0 +1,19 @@ +PIDFILE=/tmp/statMic.pid +STATUSFILE=/tmp/dsbAMic + +kill `cat $PIDFILE` +if [ $? -eq 0 ]; then + echo "Shutting down" + rm $STATUSFILE + exit +fi + +echo $$ > $PIDFILE + +while true; do + + MIC=$(amixer get Capture | grep "Front Left:" | sed 's/.*\[\(.*\)\].*/\1/') + + echo "$MIC " > $STATUSFILE + sleep 1 +done diff --git a/i3/Scripts/net.sh b/i3/Scripts/net.sh new file mode 100644 index 0000000..d443091 --- /dev/null +++ b/i3/Scripts/net.sh @@ -0,0 +1,19 @@ +PIDFILE=/tmp/statNet.pid +STATUSFILE=/tmp/dsbANet + +kill `cat $PIDFILE` +if [ $? -eq 0 ]; then + echo "Shutting down" + rm $STATUSFILE + exit +fi + +echo $$ > $PIDFILE + +while true; do + + IP=$( ip -4 a | grep "inet " | sed "s:inet \(.*\)/.*:\1:" | tr -d " " | grep -v "0.1" | tr "\n" " ") + + echo "$IP " > $STATUSFILE + sleep 10 +done diff --git a/i3/Scripts/ram.sh b/i3/Scripts/ram.sh new file mode 100644 index 0000000..b0c2442 --- /dev/null +++ b/i3/Scripts/ram.sh @@ -0,0 +1,19 @@ +PIDFILE=/tmp/statRam.pid +STATUSFILE=/tmp/dsbRfree + +kill `cat $PIDFILE` +if [ $? -eq 0 ]; then + echo "Shutting down" + rm $STATUSFILE + exit +fi + +echo "Starting up" + +echo $$ > $PIDFILE + +while true; do + echo " $(free -h | grep Mem: | awk '{print $3}') " > $STATUSFILE + sleep 2 +done + diff --git a/i3/Scripts/runStat.sh b/i3/Scripts/runStat.sh new file mode 100644 index 0000000..52b0536 --- /dev/null +++ b/i3/Scripts/runStat.sh @@ -0,0 +1,6 @@ +elements="ram.sh status.sh mic.sh" + +if [ $1 = "dmenu" ]; then + sh $(echo $elements | tr " " "\n" | dmenu -i -p ":") +fi + diff --git a/i3/Scripts/status.sh b/i3/Scripts/status.sh new file mode 100644 index 0000000..3d1eba4 --- /dev/null +++ b/i3/Scripts/status.sh @@ -0,0 +1,20 @@ +PIDFILE=/tmp/stat.pid +STATUSFILE=/tmp/dsbMain + +kill `cat $PIDFILE` +if [ $? -eq 0 ]; then + echo "Shutting down" + rm $STATUSFILE + exit +fi + +echo $$ > $PIDFILE + +while true; do + + BATT=$( acpi -b | sed 's/.*[charging|unknown], \([0-9]*\)%.*/\1/gi' ) + TIME=$(/bin/date +"%H:%M") + + echo "$IP $TIME $BATT%" > $STATUSFILE + sleep 10 +done |