diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2022-03-16 23:37:09 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2022-03-16 23:37:09 -0500 |
commit | 3d3d79a57fb6d0a5728e0070475f05d1699f0818 (patch) | |
tree | b141cba678d6bb9821bb33b0dd7c7f1ca31b2c6a | |
parent | d51fa1bdda79b8589ddf0002fc4b54aac6ce8354 (diff) | |
download | scripts-3d3d79a57fb6d0a5728e0070475f05d1699f0818.tar.xz scripts-3d3d79a57fb6d0a5728e0070475f05d1699f0818.zip |
move a lot of scripts around and make a bunch of minor changes. once again i am too lazy to document the changes properly since im never going to read these commit messages anyways
-rwxr-xr-x | bar/batterynotification | 2 | ||||
-rwxr-xr-x | bar/calendarnotification | 2 | ||||
-rwxr-xr-x | bar/netnotification | 5 | ||||
-rwxr-xr-x | bar/wmip | 2 | ||||
-rwxr-xr-x | init/g610bl | 2 | ||||
-rwxr-xr-x | keyboard/bl | 30 | ||||
-rwxr-xr-x | keyboard/mounter | 2 | ||||
-rwxr-xr-x | launch/launch | 110 | ||||
-rwxr-xr-x | misc/lsdu | 2 | ||||
-rwxr-xr-x | misc/mksh | 6 | ||||
-rwxr-xr-x | misc/seasonalwallpaper | 13 | ||||
-rwxr-xr-x | misc/verify | 16 | ||||
-rwxr-xr-x | old/bsdtpscroll (renamed from x11/bsdtpscroll) | 0 | ||||
-rwxr-xr-x | old/ffconcat (renamed from video/ffconcat) | 0 | ||||
-rwxr-xr-x | old/hwtexedit (renamed from misc/hwtexedit) | 0 | ||||
-rwxr-xr-x | old/lipsum.~1~ (renamed from misc/lipsum) | 0 | ||||
-rwxr-xr-x | old/rectape (renamed from video/rectape) | 0 | ||||
-rwxr-xr-x | old/rectapevaapi (renamed from video/rectapevaapi) | 0 | ||||
-rwxr-xr-x | old/settitle (renamed from x11/settitle) | 0 | ||||
-rwxr-xr-x | old/setup (renamed from misc/setup) | 0 | ||||
-rwxr-xr-x | old/speedtest | 8 | ||||
-rwxr-xr-x | old/speedtest-cli | 8 | ||||
-rwxr-xr-x | old/testtimmywm (renamed from x11/testtimmywm) | 0 | ||||
-rwxr-xr-x | old/transtape (renamed from video/transtape) | 0 | ||||
-rwxr-xr-x | old/viewintensitypro (renamed from video/viewintensitypro) | 0 | ||||
-rwxr-xr-x | old/webcamdesktopffplay (renamed from video/webcamdesktopffplay) | 0 | ||||
-rwxr-xr-x | old/win10 (renamed from video/win10) | 2 | ||||
-rwxr-xr-x | old/ytdl-dlplst (renamed from video/ytdl-dlplst) | 0 | ||||
-rwxr-xr-x | pkgmgt/xbps/xs | 22 | ||||
-rwxr-xr-x | x11/xkeyconf (renamed from x11/capsmap) | 4 |
30 files changed, 100 insertions, 136 deletions
diff --git a/bar/batterynotification b/bar/batterynotification deleted file mode 100755 index 5cdb2fb..0000000 --- a/bar/batterynotification +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -notify-send "Battery info:" "`blr -eElL`" diff --git a/bar/calendarnotification b/bar/calendarnotification deleted file mode 100755 index 39df717..0000000 --- a/bar/calendarnotification +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -notify-send -u low -t 10000 "`date +'%m/%d/%Y %T'`" "`cal | tr '[:upper:]' '[:lower:]'`\n`date +'day %0j, week %0U, q%q'`" diff --git a/bar/netnotification b/bar/netnotification deleted file mode 100755 index ee68238..0000000 --- a/bar/netnotification +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -ip="`ip addr | sed -n '/\slo/d; s/\/.*//; s/\s*inet /IP Address:\t/p;'`" -ssid="`iw wlp3s0 link | sed -n 's/\s*SSID:\s*/SSID:\t\t/p'`" - -notify-send -u low "Network info:" "$ip\n$ssid" @@ -1,2 +1,2 @@ #!/bin/sh -ip addr | awk '!/ lo/ && /inet / { sub(/\/.*/, "", $2); print $2 }' +ip a | awk '!/ lo/ && /inet / { sub(/\/.*/, "", $2); print $2 }' diff --git a/init/g610bl b/init/g610bl deleted file mode 100755 index 9cf38b4..0000000 --- a/init/g610bl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -g610-led -fx color keys 20 && g610-led -k logo 00 diff --git a/keyboard/bl b/keyboard/bl deleted file mode 100755 index 2bbd951..0000000 --- a/keyboard/bl +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -xbacklight -$1 $2 -time 50 -steps 5 2>/dev/null && exit - -red=16 -green=18 -blue=1A -getbl() { bl=$(doas ddcutil getvcp $red | sed 's/.*current value =\s*\([0-9]*\).*/\1/'); } # Get brightness of red channel so we only have to grab one -case "$1" in - dec) - getbl - [ $bl = 0 ] && exit - bl=$(( bl - $2 )) - [ $bl -lt 0 ] && bl=0 - ;; - inc) - getbl - [ $bl = 100 ] && exit - bl=$(( bl + $2 )) - [ $bl -gt 100 ] && bl=100 - ;; - set) - bl=$2 - [ $bl -lt 0 ] || [ $bl -gt 100 ] && echo "Invalid value" && exit - ;; - *) - echo "Invalid option" && exit - ;; -esac -for color in $red $green $blue; do doas ddcutil setvcp $color $bl; done -#dwmsbup 20 diff --git a/keyboard/mounter b/keyboard/mounter index 49d0b76..90c6caf 100755 --- a/keyboard/mounter +++ b/keyboard/mounter @@ -57,7 +57,7 @@ umnt() { || $notify "Error Unmounting Device \"$part\" from \"$mp\"" "$umountout" # Remove mp directory if it is in mps - [ "$(dirname "$mp")" = $mps ] && rm -rf "$mp" + [ "$(dirname "$mp")" = $mps ] && [ ! "$(ls -A "$mp")" ] && rm -rf "$mp" } case $1 in diff --git a/launch/launch b/launch/launch index 8e4cbd2..b4c1c7a 100755 --- a/launch/launch +++ b/launch/launch @@ -1,68 +1,74 @@ #!/bin/sh me() { basename "$0"; } + printhelp() { - echo "Usage:\n" \ - " $(me): [-gh] [COMMAND] [COMMAND ARGS]...\n\n" \ - "Args:\n" \ - " -g: Force generate cache\n" \ - " -h: show this help message\n\n" \ - "Config Syntax:\n" \ - " +host [HOSTNAME]\n" \ - " Add a new host. Hosts can be referenced using their number starting with 1.\n" \ - " [COMMAND]\n" \ - " launch [COMMAND] will start the process specified for the specific hostname. Aliases are separated by |.\n" \ - " [TAB][SHELL]\n" \ - " Run this shell command when the above [COMMAND] is specified. In order of hostnames. Can be a number to reference to a hostname, a '-' to disregard this command for the specific host, or a '^' to reference the previous command." +cat << HELPDOC +Usage: + $(me): [-gh] [COMMAND] [COMMAND ARGS]... + +Args: + -g: Force generate cache + -h: show this help message + +Config Syntax: + +host [HOSTNAME] + Add a new host. Hosts can be referenced using their number starting with 1. + [COMMAND] + launch [COMMAND] will start the process specified for the specific hostname. Aliases are separated by |. + [TAB][SHELL] + Run this shell command when the above [COMMAND] is specified. In order of hostnames. Can be a number to reference to a hostname, a '-' to disregard this command for the specific host, or a '^' to reference the previous command. +HELPDOC } + gencache() { - awk ' - BEGIN { - print "run=\"$1\"; shift" - print "case \"$run\" in" - } - { - sub(/#.*/, "") # Remove comments - if (!/^\s*$/) { - if (/^\+host/) { - sub(/\s*\+host\s*/, "") - h++ - hosts[h] = $0 +awk ' + BEGIN { + print "run=\"$1\"; shift" + print "case \"$run\" in" + } + { + sub(/#.*/, "") # Remove comments + if (!/^\s*$/) { + if (/^\+host/) { + sub(/\s*\+host\s*/, "") + h++ + hosts[h] = $0 + } + else { + if (!/^\t/) { + hostnum = 1 + o++ + opts[o] = $0 } else { - if (!/^\t/) { - hostnum = 1 - o++ - opts[o] = $0 - } - else { - sub(/^\t/, "") - if ($0 == "^") - $0 = cache - else if ($0 ~ /^[0-9]*$/) - $0 = cmds[hosts[$0]":"opts[o]] - cmds[hosts[hostnum]":"opts[o]] = cache = $0 - hostnum++ - } + sub(/^\t/, "") + if ($0 == "^") + $0 = cache + else if ($0 ~ /^[0-9]*$/) + $0 = cmds[hosts[$0]":"opts[o]] + cmds[hosts[hostnum]":"opts[o]] = cache = $0 + hostnum++ } } } - END { - for (host in hosts) { - if (hosts[host] != "'`hostname`'") - continue - for (cmd in cmds) { - if (cmd ~ hosts[host] && cmds[cmd] && cmds[cmd] != "-") { - i = cmd - sub(/.*:/, "", cmd) - print "\t"cmd") "cmds[i]" \"$@\" & ;;" - } + } + END { + for (host in hosts) { + if (hosts[host] != "'`hostname`'") + continue + for (cmd in cmds) { + if (cmd ~ hosts[host] && cmds[cmd] && cmds[cmd] != "-") { + i = cmd + sub(/.*:/, "", cmd) + print "\t"cmd") "cmds[i]" \"$@\" & ;;" } - print "\t*) command -v \"$run\" >/dev/null && exec \"$run\" \"$@\" || echo \"\\`$run${@:+ $@}\\` Does not exist or exited with an error\" ;;" - print "esac" } + print "\t*) command -v \"$run\" >/dev/null && exec \"$run\" \"$@\" || echo \"\\`$run${@:+ $@}\\` Does not exist or exited with an error\" ;;" + print "esac" } - ' $conf > $cache - chmod +x $cache + } +' $conf > $cache +chmod +x $cache } # Config file setup @@ -1,5 +1,5 @@ #!/bin/sh -du -ah -d1 "$@" 2>/dev/null | sed 's/\.\///' | sort -h +du -ahd1 "$@" 2>/dev/null | sed 's/\.\///' | sort -h #for file in $(ls -a $1); do # ([ "$file" = "." ] || [ "$file" = ".." ]) && continue # files="${files:+$files\n}$(du -h $1/"$file" 2>/dev/null | tail -1)" @@ -3,7 +3,7 @@ newname() { defname="script"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`; } # Remove blank space in certain non-GNU implementations of wc [ -z "$1" ] && newname || name="$1" [ -e "$name" ] && echo "File $name exists!" && exit 1 -[ -z "$2" ] && shebang="#!/bin/sh" || shebang="$2" -echo "$shebang" > "$name" && chmod +x "$name" && $EDITOR "$name" -# Delete file if it is just exited w/o being changed +[ -z "$2" ] && shebang="#!/bin/sh" || shebang="#!$2" +echo "$shebang" > "$name" && chmod +x "$name" && ${EDITOR:-vi} "$name" +# Delete file if it is empty [ "`cat "$name"`" = "$shebang" ] && rm "$name" && echo "Removed empty script \"$name\"" || echo "Saved script \"$name\"" diff --git a/misc/seasonalwallpaper b/misc/seasonalwallpaper index 1b5bf4a..525bfb0 100755 --- a/misc/seasonalwallpaper +++ b/misc/seasonalwallpaper @@ -1,13 +1,12 @@ #!/bin/sh case $1 in - spring|summer|fall|winter) dir=~/.local/share/wallpaper/$1/ ; xwallpaper --zoom "$dir`ls $dir | sort --random-sort | head -1`" ;; + spring|summer|fall|winter) dir=~/.local/share/wallpaper/$1/ ; xwallpaper --zoom "$dir`ls $dir | shuf -n1`" ;; *) - case "`date +%b`" in - Dec|Jan|Feb) season=winter ;; - Mar|Apr|May) season=spring ;; - Jun|Jul|Aug) season=summer ;; - Sep|Oct|Nov) season=fall ;; + case `date +%b` in + Dec|Jan|Feb) $0 winter ;; + Mar|Apr|May) $0 spring ;; + Jun|Jul|Aug) $0 summer ;; + Sep|Oct|Nov) $0 fall ;; esac - $0 $season ;; esac diff --git a/misc/verify b/misc/verify index 0d17085..5f0430c 100755 --- a/misc/verify +++ b/misc/verify @@ -3,19 +3,21 @@ NORM="\033[0m" CYN="\033[0;36m" GRN="\033[0;32m" RED="\033[0;31m" + printhelp() { -echo "\ +cat << HELPDOC Usage: $(basename "$0") [options] [file/directory]... OPTIONS: -m, --md5 Create/verify md5 checksum - -s[alg], --sha[alg] Create/verify sha checksum - -x[alg], --xxh[alg] Create/verify xxh checksum - -c [alg], --crypt [alg] Create/verify [alg] checksum (uses [alg]sum) + -s[mode], --sha[mode] Create/verify sha[mode] checksum + -x[mode], --xxh[mode] Create/verify xxh[mode] checksum (default) + -c [alg], --crypt [alg] Create/verify [alg] checksum (uses [alg]sum program; e.g. '-c sha256' uses sha256sum) -v, --verify Verify files with existing checksums - -h, --help Print help \ -"; + -h, --help Print help +HELPDOC } + crypt=xxh while true; do case "$1" in @@ -30,7 +32,7 @@ while true; do esac shift done -hashalg=${crypt}sum # Works for current algs +hashalg=${crypt}sum command -v $hashalg >/dev/null || (echo "Hashing algorithm '$hashalg' does not exist!" && exit 2) while [ -n "$1" ]; do diff --git a/x11/bsdtpscroll b/old/bsdtpscroll index 0f2cd20..0f2cd20 100755 --- a/x11/bsdtpscroll +++ b/old/bsdtpscroll diff --git a/video/ffconcat b/old/ffconcat index 06eb066..06eb066 100755 --- a/video/ffconcat +++ b/old/ffconcat diff --git a/misc/hwtexedit b/old/hwtexedit index 262d10b..262d10b 100755 --- a/misc/hwtexedit +++ b/old/hwtexedit diff --git a/misc/lipsum b/old/lipsum.~1~ index efa71b5..efa71b5 100755 --- a/misc/lipsum +++ b/old/lipsum.~1~ diff --git a/video/rectape b/old/rectape index 1e54370..1e54370 100755 --- a/video/rectape +++ b/old/rectape diff --git a/video/rectapevaapi b/old/rectapevaapi index 16bd190..16bd190 100755 --- a/video/rectapevaapi +++ b/old/rectapevaapi diff --git a/x11/settitle b/old/settitle index 7cdd7d1..7cdd7d1 100755 --- a/x11/settitle +++ b/old/settitle diff --git a/old/speedtest b/old/speedtest new file mode 100755 index 0000000..913f9ef --- /dev/null +++ b/old/speedtest @@ -0,0 +1,8 @@ +#!/usr/bin/python3.9 +# -*- coding: utf-8 -*- +import re +import sys +from speedtest import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/old/speedtest-cli b/old/speedtest-cli new file mode 100755 index 0000000..913f9ef --- /dev/null +++ b/old/speedtest-cli @@ -0,0 +1,8 @@ +#!/usr/bin/python3.9 +# -*- coding: utf-8 -*- +import re +import sys +from speedtest import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/x11/testtimmywm b/old/testtimmywm index 33cda37..33cda37 100755 --- a/x11/testtimmywm +++ b/old/testtimmywm diff --git a/video/transtape b/old/transtape index a0eaaee..a0eaaee 100755 --- a/video/transtape +++ b/old/transtape diff --git a/video/viewintensitypro b/old/viewintensitypro index 1b1f77c..1b1f77c 100755 --- a/video/viewintensitypro +++ b/old/viewintensitypro diff --git a/video/webcamdesktopffplay b/old/webcamdesktopffplay index c56d879..c56d879 100755 --- a/video/webcamdesktopffplay +++ b/old/webcamdesktopffplay @@ -1,4 +1,4 @@ #!/bin/sh -sudo chown -R timmy:timmy /dev/shm +doas chown -R timmy:timmy /dev/shm virsh start win10-clone looking-glass-client -F diff --git a/video/ytdl-dlplst b/old/ytdl-dlplst index f7b4a47..f7b4a47 100755 --- a/video/ytdl-dlplst +++ b/old/ytdl-dlplst diff --git a/pkgmgt/xbps/xs b/pkgmgt/xbps/xs deleted file mode 100755 index 31782ef..0000000 --- a/pkgmgt/xbps/xs +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -voidpkgsdir=~/.local/share/src/tjk-void-packages -srcpkgsdir=$voidpkgsdir/srcpkgs -pkgs="brave-bin" -expkgs="brave-bin" # Extra packages installed in the srcpkgs directory that need to be separately updated through git -gp() { git pull --verbose; } - -cd $voidpkgsdir -gp - -if [ -n $expkgs ]; then - cd $srcpkgsdir - for repo in "$expkgs"; do - cd $repo && gp - cd $srcpkgsdir - done -fi - -cd $voidpkgsdir -./xbps-src binary-bootstrap -./xbps-src pkg $pkgs -doas xbps-install --repository=hostdir/binpkgs $pkgs diff --git a/x11/capsmap b/x11/xkeyconf index 36c5eb1..cea356f 100755 --- a/x11/capsmap +++ b/x11/xkeyconf @@ -1,6 +1,10 @@ #!/bin/sh +# Faster repeated keys and less delay before repeating +xset r rate 250 50 & + # Remap caps to super when held setxkbmap -option caps:super + # Remap caps to escape when pressed killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' |