summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbar/batterynotification2
-rwxr-xr-xbar/calendarnotification2
-rwxr-xr-xbar/netnotification5
-rwxr-xr-xbar/netstat45
-rwxr-xr-xbar/sb-internet24
-rwxr-xr-xbar/volume27
-rwxr-xr-xkeyboard/addnetwork12
-rwxr-xr-xkeyboard/dmenuunicode18
-rwxr-xr-xkeyboard/mnt10
-rwxr-xr-xkeyboard/remnetwork10
-rwxr-xr-xkeyboard/screenshot39
-rwxr-xr-xkeyboard/shutdownprompt8
-rwxr-xr-xkeyboard/umnt8
-rwxr-xr-xkeyboard/volcon3
-rwxr-xr-xkeyboard/xbd3
-rwxr-xr-xkeyboard/xbi3
-rwxr-xr-xkeyboard/xbs3
-rwxr-xr-xmisc/emu51
-rwxr-xr-xmisc/launch43
-rwxr-xr-xmisc/lipsum90
-rwxr-xr-xmisc/mime47
-rwxr-xr-xmisc/mksh11
-rwxr-xr-xmisc/passwdgen16
l---------misc/screenshot1
-rwxr-xr-xmisc/seasonalwallpaper13
-rwxr-xr-xmisc/vimv44
-rwxr-xr-xmisc/wifitoggle34
-rwxr-xr-xold/lipsum87
-rwxr-xr-xold/lipsumsh72
-rwxr-xr-xold/setwindowtitle10
-rwxr-xr-xold/shblr14
-rwxr-xr-xpkgmgt/xbps/xs22
l---------programs/chrome1
-rwxr-xr-xst/settitle3
-rwxr-xr-xsync/pull57
-rwxr-xr-xsync/sink49
-rwxr-xr-xvideo/screenrec6
-rwxr-xr-xx11/bsdtpscroll4
-rwxr-xr-xx11/capsmap9
39 files changed, 906 insertions, 0 deletions
diff --git a/bar/batterynotification b/bar/batterynotification
new file mode 100755
index 0000000..5cdb2fb
--- /dev/null
+++ b/bar/batterynotification
@@ -0,0 +1,2 @@
+#!/bin/sh
+notify-send "Battery info:" "`blr -eElL`"
diff --git a/bar/calendarnotification b/bar/calendarnotification
new file mode 100755
index 0000000..39df717
--- /dev/null
+++ b/bar/calendarnotification
@@ -0,0 +1,2 @@
+#!/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
new file mode 100755
index 0000000..ee68238
--- /dev/null
+++ b/bar/netnotification
@@ -0,0 +1,5 @@
+#!/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"
diff --git a/bar/netstat b/bar/netstat
new file mode 100755
index 0000000..e7b23c3
--- /dev/null
+++ b/bar/netstat
@@ -0,0 +1,45 @@
+#!/usr/bin/awk -f
+
+BEGIN {
+wifidev=ENVIRON["WIFIDEV"]
+ethedev=ENVIRON["ETHEDEV"]
+getline state < ("/sys/class/net/"ethedev"/operstate")
+switch (state) {
+ case "up":
+ print "񂁭"
+ break
+ case "down":
+ getline state < ("/sys/class/net/"wifidev"/operstate")
+ switch (state) {
+ case "up":
+ # make this nicer, obviously
+ getline < "/proc/net/wireless"
+ getline < "/proc/net/wireless"
+ getline < "/proc/net/wireless"
+ sigstrength=int($3 * 100 / 70)
+ if (sigstrength > 70) {
+ print "񂁬 " sigstrength "%"
+ }
+ else if (sigstrength > 40) {
+ print "񂁫 " sigstrength "%"
+ }
+ else if (sigstrength > 10) {
+ print "񂁪 " sigstrength "%"
+ }
+ else {
+ print "񂁩 " sigstrength "%"
+ }
+ break
+ case "down":
+ print "񂁮"
+ break
+ default:
+ print "Device "wifidev" not found..."
+ break
+ }
+ break
+ default:
+ print "Device "ethedev" not found..."
+ break
+}
+}
diff --git a/bar/sb-internet b/bar/sb-internet
new file mode 100755
index 0000000..ee1a160
--- /dev/null
+++ b/bar/sb-internet
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Show wifi 📶 and percent strength or 📡 if none.
+# Show 🌐 if connected to ethernet or ❎ if none.
+# Show 🔒 if a vpn connection is active
+
+case $BLOCK_BUTTON in
+ 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
+ 3) notify-send "🌐 Internet module" "\- Click to connect
+📡: no wifi connection
+📶: wifi connection with quality
+❎: no ethernet
+🌐: ethernet working
+🔒: vpn is active
+" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
+ down) wifiicon="📡 " ;;
+ up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
+esac
+
+printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"
diff --git a/bar/volume b/bar/volume
new file mode 100755
index 0000000..2eb9250
--- /dev/null
+++ b/bar/volume
@@ -0,0 +1,27 @@
+#!/usr/bin/awk -f
+
+BEGIN {
+cmd="amixer -M sget Master"
+FS="[][]"
+while (cmd | getline) {
+ if (NF > 1) {
+ vol=int($2)
+ if ($6 == "off")
+ icon="񂁳"
+ else if (vol > 70)
+ icon="񂁲"
+ else if (vol > 40)
+ icon="񂁱"
+ else if (vol > 10)
+ icon="񂁰"
+ else
+ icon="񂁯"
+ #printf "%s %s | %05.2fdB", icon, $2, $4
+ print icon" "$2" | "$4
+ }
+}
+}
+
+##!/bin/sh
+##amixer sget Master | awk -F'[][]' '/%/{print $2" | "$4 " [" $6 "]"}'
+#amixer -M sget Master | sed -n 's/.*Playback [0-9]* \[//; s/. ./ | /; s/\] .off\]/ \[mute\]/p; s/\] .on.//p'
diff --git a/keyboard/addnetwork b/keyboard/addnetwork
new file mode 100755
index 0000000..7918985
--- /dev/null
+++ b/keyboard/addnetwork
@@ -0,0 +1,12 @@
+#!/bin/sh
+#if ssid=`doas iw dev $wifidev scan | sed '/SSID: .\+/!d;/x00/d;s/.*SSID: //' | dmenu -p "Choose Network to Connect to: "` \
+if ssid=`doas iw dev $WIFIDEV scan | sed '/SSID: .\+/!d;/x00/d;s/.*SSID: //' | dmenu -p "Choose Network to Connect to: "` \
+&& [ -n "$ssid" ] \
+&& pass=`dmenu -p "Enter Password for $ssid: " <&-` \
+&& [ -n "$pass" ]
+then
+ wpa_passphrase "$ssid" "$pass" | doas tee -a "/etc/wpa_supplicant/wpa_supplicant.conf" \
+ && doas sv restart dhcpcd \
+ && dunstify "Network Added" "Network \"$ssid\" Added to wpa_supplicant.conf and restarted the dhcpcd service!" \
+ || dunstify "Error" "An error has occured"
+fi
diff --git a/keyboard/dmenuunicode b/keyboard/dmenuunicode
new file mode 100755
index 0000000..066099a
--- /dev/null
+++ b/keyboard/dmenuunicode
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# The famous "get a menu of emojis to copy" script.
+
+# Get user selection via dmenu from emoji file.
+chosen=$(cut -d ';' -f1 ~/.local/share/emojis | dmenu -l 30 | sed "s/ .*//")
+
+# Exit if none chosen.
+[ -z "$chosen" ] && exit
+
+# If you run this command with an argument, it will automatically insert the
+# character. Otherwise, show a message that the emoji has been copied.
+if [ -n "$1" ]; then
+ xdotool type "$chosen"
+else
+ echo "$chosen" | tr -d '\n' | xclip -selection clipboard
+ notify-send -u low "'$chosen' copied to clipboard." &
+fi
diff --git a/keyboard/mnt b/keyboard/mnt
new file mode 100755
index 0000000..5f82aa4
--- /dev/null
+++ b/keyboard/mnt
@@ -0,0 +1,10 @@
+#!/bin/sh
+if partition=`lsblk --noheadings --paths --raw | awk '/part $/ { print $1, "(" $4 ")" }' | dmenu -p "Choose drive to mount: " | sed 's/ .*//'` \
+&& [ -n "$partition" ] \
+&& mountpoint=`ls --directory /media/mnt/*/ | dmenu -p "Choose mountpoint: "` \
+&& [ -n "$mountpoint" ]
+then
+ doas mount "$partition" "$mountpoint" \
+ && notify-send --urgency low "Device Successfully Mounted" "Successfully Mounted partition \"$partition\" to mountpoint \"$mountpoint\"" \
+ || notify-send --urgency low "Error Mounting Device" "Could not mount partition \"$partition\" to mountpoint \"$mountpoint\""
+fi
diff --git a/keyboard/remnetwork b/keyboard/remnetwork
new file mode 100755
index 0000000..90a1406
--- /dev/null
+++ b/keyboard/remnetwork
@@ -0,0 +1,10 @@
+#!/bin/sh
+wpa_supplicant_conf=/etc/wpa_supplicant/wpa_supplicant.conf
+notification() { notify-send --urgency low "Forgot Network \"$ssid\"" "Network \"$ssid\" has been removed from $wpa_supplicant_conf"; }
+ssid=`doas cat $wpa_supplicant_conf | sed '/ssid/!d; s/\s*ssid=\"//; s/\"$//' | dmenu -p "Choose Network to Forget: "` && \
+[ `echo "No\nYes" | dmenu -p "Are you sure you want to forget \"$ssid\"?"` ] && \
+doas ed $wpa_supplicant_conf << EOF > /dev/null && notification
+g/$ssid/-2+,/}/d
+w
+EOF
+
diff --git a/keyboard/screenshot b/keyboard/screenshot
new file mode 100755
index 0000000..909dbe6
--- /dev/null
+++ b/keyboard/screenshot
@@ -0,0 +1,39 @@
+#!/bin/sh
+printusage() { echo -n "Usage: $0 [-cx]\nOptions:\n-c\tInteractively crop screenshot\n-x\tCopy screenshot to clipboard with xclip rather than saving it\n" && exit; }
+
+# scrot and xclip opts
+fmt=$(date '+%m-%d-%4Y_%I:%M:%S_%p.png')
+tmppath=/tmp/$fmt
+savpath=~/pics/screenshots/$fmt
+normopt=''
+cropopt='--select --freeze'
+normexp='echo $f'
+xclipexp='xclip -selection clipboard -target image/png -i $f && echo $f'
+
+# notify-send opts
+notifyopts="--expire-time 4000 --urgency low"
+normsumm="Screenshot Saved!"
+xclipsumm="Screenshot Copied!"
+normbody="Screenshot saved as \"$fmt\""
+xclipbody="Screenshot copied to clipboard"
+
+# Default opts
+opt=$normopt
+path=$savpath
+exp=$normexp
+
+summ=$normsumm
+body=$normbody
+
+while getopts "cxh" arg; do
+ case "$arg" in
+ c) opt=$cropopt ;;
+ x) path=$tmppath; exp=$xclipexp; summ=$xclipsumm; body=$xclipbody ;;
+ h) printusage ;;
+ *) printusage ;;
+ esac
+done
+
+scrot $opt $path --exec "$exp" \
+&& notify-send $notifyopts -i $path "$summ" "$body" \
+|| notify-send $notifyopts "Screenshot Failed!"
diff --git a/keyboard/shutdownprompt b/keyboard/shutdownprompt
new file mode 100755
index 0000000..2b97be1
--- /dev/null
+++ b/keyboard/shutdownprompt
@@ -0,0 +1,8 @@
+#!/bin/sh
+#option=`echo "Cancel\nSuspend\nShutdown\nRestart" | dmenu -p "Power Menu " -nb "#AA0000" -nf "#FFF" -sb "#FF0000" -sf "#FFF" || exit` # Run this separately from the case statement so dmenu prompt closes before running the command
+[ -n "$1" ] && option="$1" || option=`echo "Cancel\nSuspend\nShutdown\nRestart" | dmenu -p "Power Menu " -nb "#AA0000" -nf "#FFF" -sb "#FF0000" -sf "#FFF" -nhb "#AA0000" -shb "#FF0000" -shf "#FAA" || exit` # Run this separately from the case statement so dmenu prompt closes before running the command
+case $option in
+ Suspend) launch zzz ;;
+ Shutdown) launch off ;;
+ Restart) launch res ;;
+esac
diff --git a/keyboard/umnt b/keyboard/umnt
new file mode 100755
index 0000000..d43297d
--- /dev/null
+++ b/keyboard/umnt
@@ -0,0 +1,8 @@
+#!/bin/sh
+exclude='\/boot\/|\/home$|tbhdd$|\/$'
+if mountedpartition=`lsblk --noheadings --paths --raw | awk "/part .+/ && !/$exclude/ "'{ print $1, "(on", $7 ")" }' | dmenu -p "Unmount Device... "`
+then
+ doas umount "`echo $mountedpartition | sed 's/ .*//'`" \
+ && notify-send --urgency low "Device Successfully Unmounted" "Partition \"$mountedpartition\" successfully unmounted" \
+ || notify-send --urgency low "Error Unmounting Device" "Could not unmount partition \"$mountedpartition\""
+fi
diff --git a/keyboard/volcon b/keyboard/volcon
new file mode 100755
index 0000000..1891929
--- /dev/null
+++ b/keyboard/volcon
@@ -0,0 +1,3 @@
+#!/bin/sh
+amixer -M sset Master $1 > /dev/null
+dwmsbup 10
diff --git a/keyboard/xbd b/keyboard/xbd
new file mode 100755
index 0000000..c60b0bc
--- /dev/null
+++ b/keyboard/xbd
@@ -0,0 +1,3 @@
+#!/bin/sh
+xbacklight -dec $1 -time 50 -steps 5
+dwmsbup 20
diff --git a/keyboard/xbi b/keyboard/xbi
new file mode 100755
index 0000000..b34c75a
--- /dev/null
+++ b/keyboard/xbi
@@ -0,0 +1,3 @@
+#!/bin/sh
+xbacklight -inc $1 -time 50 -steps 5
+dwmsbup 20
diff --git a/keyboard/xbs b/keyboard/xbs
new file mode 100755
index 0000000..1ab4567
--- /dev/null
+++ b/keyboard/xbs
@@ -0,0 +1,3 @@
+#!/bin/sh
+xbacklight -set $1 -time 50 -steps 5
+dwmsbup 20
diff --git a/misc/emu b/misc/emu
new file mode 100755
index 0000000..df24b10
--- /dev/null
+++ b/misc/emu
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# This only works for collections with a common extension. You can rename all your roms to use the same extension and (in any decent emulator at least) they should work regardless of the actual header type
+gamedir=${XDG_DATA_HOME:-$HOME/.local/share}/games
+dmenuprompt="dmenu -l 25"
+resolution=`cat /sys/class/drm/*/modes | head -1`
+case "$1" in
+ 2600)
+ dmenucolors="-nb #111 -nf #e4963c -sb #6c3b17 -sf #fff -nhb #121212 -nhf #fc5231 -shb #804f2d -shf #fc5231"
+ emulator="stella"
+ ext=bin
+ ;;
+ 3ds)
+ dmenucolors="-nb #111 -nf #888 -sb #999 -sf #F00 -nhb #111 -nhf #fff -shb #999"
+ emulator="citra"
+ ext=3ds
+ ;;
+ nes)
+ dmenucolors="-nb #6d6a6d -nf #fff -sb #dfdcdd -sf #c1121c -nhb #222 -nhf #dc444d -shb #a29fa3 -shf #dc444d"
+ emulator="fceux"
+ ext=nes
+ ;;
+ snes)
+ dmenucolors="-nb #b2b4b2 -nf #000 -sb #514689 -sf #fff -nhb #707372 -nhf #fff -shb #a7a4e0 -shf #000"
+ emulator="launch snes"
+ ext=sfc
+ ;;
+ n64)
+ dmenucolors="-nb #223 -nf #fff -sb #069330 -sf #fff -nhb #c20d02 -nhf #ffc001 -shb #011da9 -shf #ffc001"
+ emulator="mupen64plus --fullscreen --gfx mupen64plus-video-glide64mk2 --resolution $resolution"
+ ext=z64
+ ;;
+ gcn)
+ dmenucolors="-nb #4d3b7c -nf #ddd -sb #000 -sf #fff -nhb #4d3b7c -nhf #eba982 -shb #000 -shf #eba982"
+ emulator="dolphin-emu -b"
+ ext=iso
+ ;;
+ nds)
+ dmenucolors="-nb #ccc -nf #000 -sb #52398d -sf #fff -nhb #888 -nhf #fff -shb #52398d"
+ emulator="desmume --3d-engine 2"
+ ext=nds
+ ;;
+ *)
+ console=`ls $gamedir | dmenu -l 25` && ($0 $console || emu) # Allows going back to select a different console
+ exit
+ ;;
+esac
+
+gamedir="$gamedir/$1" && [ -e "$gamedir" ] \
+ && selgame="`ls "$gamedir" | sed -n "s/\.$ext$//p" | $dmenuprompt $dmenucolors`.$ext" \
+ && $emulator "$gamedir/$selgame"
diff --git a/misc/launch b/misc/launch
new file mode 100755
index 0000000..9a6d5ce
--- /dev/null
+++ b/misc/launch
@@ -0,0 +1,43 @@
+#!/bin/sh
+[ -n "$2" ] && args=`echo "$@" | cut -d' ' -f2-`
+
+launchother() { $@ || echo "Launch: $@: Does not exist or exited with an error"; }
+
+case "`hostname`" in
+ G3N2)
+ case "$1" in
+ brave) brave-bin $args & xdotool search --all --sync --class "brave-browser" set_window --class "Brave" --urgency 1 ;;
+ chromium|chrome) chromium-browser $args & xdotool search --all --sync --class "Chromium-browser-chromium" set_window --class "Chrome" --urgency 1 ;;
+ halt|off|poweroff|shutdown) doas poweroff ;;
+ sleep|suspend|zzz) doas s2ram ;;
+ reboot|res|restart) doas reboot ;;
+ snes|snes9x) snes9x -fullscreen -xvideo $args ;;
+ *) launchother $@ ;;
+ esac
+ ;;
+ voidx250)
+ case "$1" in
+ brave) brave-browser-stable $args & xdotool search --all --sync --class "brave-browser" set_window --class "Brave" --urgency 1 ;;
+ chromium|chrome) chrome $args & xdotool search --all --sync --class "Chromium-browser" set_window --class "Chrome" --urgency 1 ;;
+ halt|off|poweroff|shutdown) doas poweroff ;;
+ sleep|suspend|zzz) doas zzz ;;
+ reboot|res|restart) doas reboot ;;
+ snes|snes9x) snes9x-gtk $args ;;
+ *) launchother $@ ;;
+ esac
+ ;;
+ openbsdx230)
+ case "$1" in
+ brave)
+ ;;
+ chromium|chrome)
+ ;;
+ halt|off|poweroff|shutdown) doas halt ;;
+ sleep|suspend|zzz) doas zzz ;;
+ reboot|res|restart) doas reboot ;;
+ snes|snes9x) snes9x-gtk $args ;;
+ *) launchother $@ ;;
+ esac
+ ;;
+ *) echo "Launch: The hostname \"`hostname`\" is not recognized. Please add an entry for it!" ;;
+esac
diff --git a/misc/lipsum b/misc/lipsum
new file mode 100755
index 0000000..efa71b5
--- /dev/null
+++ b/misc/lipsum
@@ -0,0 +1,90 @@
+#!/usr/bin/awk -f
+
+function printusage() {
+ print "Usage: lipsum [# of] [w/words|s/sentences|p/paragraphs] [1/t/true|0/f/false output 'lorem ipsum' in first entry] [min words] [max words]\n"
+ exit 1
+}
+
+function capitalize(word) {
+ sub(/./, toupper(substr(word, 0, 1)), word)
+ print word
+}
+
+function isint(arg) {
+ return arg ~ /^[0-9]+$/
+}
+
+function randrange(min, max) {
+ return int((rand() * (max - min)) + min)
+}
+
+function genword() {
+ wc++ # There's gotta be a more efficient way of doing this
+ return (wc > 5 || !litextout) ? word[randrange(0, dictlen)] : litext[wc - 1]
+}
+
+function genwords(words) {
+ if (words > 0) {
+ capitalize(genword())
+ for (i = 1; i < words; i++)
+ print " " genword()
+ print "\n"
+ }
+}
+
+function gensentences(sentences, delim, min, max) {
+ for (; sentences > 0; sentences--) {
+ capitalize(genword())
+ words = randrange(min, max) # Isn't possible to initialize or increment multiple variables in awk for loops
+ for (i = 1; i < words; i++)
+ print (rand() < 0.10 ? ", " : " ") genword()
+ print delim
+ }
+}
+
+function genparagraphs(paragraphs, min, max) {
+ for (; paragraphs > 0; paragraphs--) {
+ print "\t"
+ gensentences(randrange(6, 10), ". ", min, max)
+ print "\n"
+ }
+}
+
+BEGIN {
+ dictionary = "/home/timmy/.local/share/lorem-ipsum-dictionary" # List of lorem ipsum words separated by newlines
+ litext[0] = "lorem"; litext[1] = "ipsum"; litext[2] = "dolor"; litext[3] = "sit"; litext[4] = "amet"
+
+ ORS = ""
+ srand()
+
+ for (dictlen = 0; getline < dictionary; dictlen++)
+ word[dictlen] = $0
+
+ # Parse Arguments
+ !isint(ARGV[1]) && ARGV[1] && printusage()
+ numof = ARGC > 1 ? ARGV[1] : 5
+ mode = ARGC > 2 ? ARGV[2] : "p"
+ litextout = 1
+ if (ARGV[3])
+ switch (ARGV[3]) {
+ case /^1$|^t$|^true$/: litextout = 1; break
+ case /^0$|^f$|^false$/: litextout = 0; break
+ default: printusage()
+ }
+ min = isint(ARGV[4]) ? ARGV[4] : 5
+ max = isint(ARGV[5]) ? ARGV[5] : 12
+
+ switch (mode) {
+ case /^w$|^words$/:
+ genwords(numof)
+ break
+ case /^s$|^sentences$/:
+ gensentences(numof, ".\n", min, max)
+ break
+ case /^p$|^paragraphs$/:
+ genparagraphs(numof, min, max)
+ break
+ default:
+ printusage()
+ }
+}
diff --git a/misc/mime b/misc/mime
new file mode 100755
index 0000000..2070376
--- /dev/null
+++ b/misc/mime
@@ -0,0 +1,47 @@
+#!/bin/sh
+cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mimewiz"
+types="`grep -v '#'`"<< TYPES
+application
+audio
+font
+#example
+image
+#message
+#model
+#multipart
+text
+video
+TYPES
+typesrc="https://www.iana.org/assignments/media-types"
+
+#dlcsv() { curl -sS -C - -e "$typesrc" "$typesrc" > "$typefile" || exit; }
+dlcsv() { curl -sS -C - -o "$2" "$1" || exit; }
+
+# Download all media type csv's if they're not avaliable
+mkdir -p "$cachedir"
+for type in $types; do
+ typefile="$cachedir/$type.csv"
+ [ -e "$typefile" ] || dlcsv "$typesrc/$type.csv" "$typefile"
+ #[ "$2" = "$type" ] && mimetype="`cut -d',' -f2 $typefile`" && break
+done
+
+#[ -n "$mimetype" ] && xdg-mime default $application.desktop $mimetype
+
+# Choose mimetype:
+types="$types\npdf\nspreadsheet ms-excel\nwordprocessing ms-word\npresentation ms-powerpoint\ndrawing\nzip gzip"
+echo "$types" | nl -s': '
+
+echo "$types" | head -7 | tail -1
+
+# Choose subtype
+#cut -d',' -f1 "$cachedir/application.csv" | grep drawing | nl -s': ' | column
+
+# Choose program
+ls /usr/share/applications | sed 's/\.desktop//' | nl -s': ' | column
+
+
+#cut -d',' -f1 "$cachedir/image.csv" | nl -s': ' | column
+cut -d',' -f2 "$cachedir/image.csv"
+
+#jcho "$types" | while read type; do
+#done
diff --git a/misc/mksh b/misc/mksh
new file mode 100755
index 0000000..6b43300
--- /dev/null
+++ b/misc/mksh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Sorry in advance to 'mksh' users (users of the shell, not this script)
+newname() { defname="script"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`; } # Remove blank space for certain non-GNU wc implementations
+[ -z "$1" ] && newname || name="$1"
+[ -z "$2" ] && shebang="#!/bin/sh" || shebang="$2"
+touch "$name"
+echo "$shebang" > "$name"
+chmod +x "$name"
+$EDITOR "$name" || vim "$name"
+# Delete file if it is just exited w/o being changed
+[ "`cat "$name"`" = "$shebang" ] && rm "$name" && echo "Removed empty script \"$name\"" || echo "Saved script \"$name\""
diff --git a/misc/passwdgen b/misc/passwdgen
new file mode 100755
index 0000000..21dff29
--- /dev/null
+++ b/misc/passwdgen
@@ -0,0 +1,16 @@
+#!/bin/sh
+[ -n "`echo $1$2 | tr -d '[:digit:]'`" ] && echo "Usage: $0 [Length] [Itterations] [Set]" && exit
+[ -z "$1" ] && len=20 || len=$1
+[ -z "$2" ] && itt=5 || itt=$2
+[ -z "$3" ] && set='[:graph:]' || set=$3
+genpasswd() { tr -cd "$3" < /dev/urandom | fold -w$1 | head -n$2; }
+genpasswd $len $itt $set
+
+# Old solution using recursion which was much slower (and apparently less posix compliant) but also much cooler
+## This should all work in dash (its all posix compliant shell), but there are frequent segmentation faults and formatting errors in the output. Bash fixes that all for some reason. Probably an issue of recursion depth and some other bugs or something in dash I have no idea.
+#genpasswd() { pass=$pass`head -1 /dev/urandom | tr -cd '[:graph:]'` && [ `echo -n $pass | wc -m` -ge $len ] && echo $pass | cut -c -$len && pass="" || genpasswd; }
+#for i in `seq $itt`; do genpasswd; done
+
+# Other old solution that is much faster for extremely long passwords, but slower for many shorter ones since it utilizes a for loop
+#genpasswd() { tr -cd '[:graph:]' < /dev/urandom | head -c$1 && echo; }
+#for i in `seq $itt`; do genpasswd $len; done
diff --git a/misc/screenshot b/misc/screenshot
new file mode 120000
index 0000000..3eb7217
--- /dev/null
+++ b/misc/screenshot
@@ -0,0 +1 @@
+/home/timmy/.local/bin/keyboard/screenshot \ No newline at end of file
diff --git a/misc/seasonalwallpaper b/misc/seasonalwallpaper
new file mode 100755
index 0000000..1b5bf4a
--- /dev/null
+++ b/misc/seasonalwallpaper
@@ -0,0 +1,13 @@
+#!/bin/sh
+case $1 in
+ spring|summer|fall|winter) dir=~/.local/share/wallpaper/$1/ ; xwallpaper --zoom "$dir`ls $dir | sort --random-sort | head -1`" ;;
+ *)
+ case "`date +%b`" in
+ Dec|Jan|Feb) season=winter ;;
+ Mar|Apr|May) season=spring ;;
+ Jun|Jul|Aug) season=summer ;;
+ Sep|Oct|Nov) season=fall ;;
+ esac
+ $0 $season
+ ;;
+esac
diff --git a/misc/vimv b/misc/vimv
new file mode 100755
index 0000000..b0579f1
--- /dev/null
+++ b/misc/vimv
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+set -eu
+
+# Lists the current directory's files in Vim, so you can edit it and save to rename them
+# USAGE: vimv [file1 file2]
+# https://github.com/thameera/vimv
+
+declare -r FILENAMES_FILE=$(mktemp "${TMPDIR:-/tmp}/vimv.XXXXXX")
+
+trap '{ rm -f "${FILENAMES_FILE}" ; }' EXIT
+
+if [ $# -ne 0 ]; then
+ src=( "$@" )
+else
+ IFS=$'\r\n' GLOBIGNORE='*' command eval 'src=($(ls))'
+fi
+
+for ((i=0;i<${#src[@]};++i)); do
+ echo "${src[i]}" >> "${FILENAMES_FILE}"
+done
+
+${EDITOR:-vi} "${FILENAMES_FILE}"
+
+IFS=$'\r\n' GLOBIGNORE='*' command eval 'dest=($(cat "${FILENAMES_FILE}"))'
+
+if (( ${#src[@]} != ${#dest[@]} )); then
+ echo "WARN: Number of files changed. Did you delete a line by accident? Aborting.." >&2
+ exit 1
+fi
+
+declare -i count=0
+for ((i=0;i<${#src[@]};++i)); do
+ if [ "${src[i]}" != "${dest[i]}" ]; then
+ mkdir -p "$(dirname "${dest[i]}")"
+ if git ls-files --error-unmatch "${src[i]}" > /dev/null 2>&1; then
+ git mv "${src[i]}" "${dest[i]}"
+ else
+ mv "${src[i]}" "${dest[i]}"
+ fi
+ ((++count))
+ fi
+done
+
+echo "$count" files renamed.
diff --git a/misc/wifitoggle b/misc/wifitoggle
new file mode 100755
index 0000000..4c74da4
--- /dev/null
+++ b/misc/wifitoggle
@@ -0,0 +1,34 @@
+#!/bin/sh
+printusage() { echo "Usage: $0 [up|on|down|off|toggle]" && exit; }
+if [ "$COMPUTER" = "laptop" ]; then
+ down() {
+ doas sv stop dhcpcd sshd rsyncd
+ }
+ up() {
+ doas sv start dhcpcd sshd rsyncd
+ }
+ toggle() {
+ case `doas sv status dhcpcd | cut -d':' -f1` in
+ run) down ;;
+ down) up ;;
+ *) echo "Error: sv returned an invalid string. Is dhcpcd being used on this system? Is runit the init system?" ;;
+ esac
+ }
+elif [ "$COMPUTER" = "desktop" ]; then
+ down() {
+ echo hi;
+ }
+ up() {
+ echo hi;
+ }
+fi
+
+[ -z "$1" ] && toggle && exit
+
+case "$1" in
+ up|on) up ;;
+ down|off) down ;;
+ toggle) toggle ;;
+ *) printusage ;;
+esac
+
diff --git a/old/lipsum b/old/lipsum
new file mode 100755
index 0000000..7ae9b7e
--- /dev/null
+++ b/old/lipsum
@@ -0,0 +1,87 @@
+#!/bin/awk -f
+
+function printusage() {
+ print "Usage: lipsum [# of] [w/words|s/sentences|p/paragraphs] [1/t/true|0/f/false output 'lorem ipsum' in first entry] [min words] [max words]\n"
+ exit 1
+}
+
+function capitalize() {
+ sub(/./, toupper(substr($0, 0, 1)))
+}
+
+function randrange(min, max) {
+ return int((rand() * (max - min)) + min)
+}
+
+function isint(arg) {
+ return arg ~ /^[0-9]+$/
+}
+
+function genwords(words, cmd) {
+ if (words > 0 && cmd | getline) {
+ capitalize(); print
+ for (i = 1; cmd | getline && i < words; i++)
+ print " "$0
+ print "\n"
+ }
+}
+
+function gensentences(sentences, delim, cmd, min, max) {
+ for (; sentences > 0 && cmd | getline; sentences--) {
+ capitalize(); print
+ words = randrange(min, max) # Isn't possible to initialize or increment multiple variables in awk for loops
+ for (i = 1; cmd | getline && i < words; i++)
+ print (rand() < 0.10 ? ", " : " ")$0
+ print delim
+ }
+}
+
+function genparagraphs(paragraphs, cmd, min, max) {
+ for (; paragraphs > 0; paragraphs--) {
+ print "\t"
+ gensentences(randrange(6, 10), ". ", cmd, min, max)
+ print "\n"
+ }
+}
+
+BEGIN {
+ dictionary = "/home/timmy/.local/share/lorem-ipsum-dictionary" # List of lorem ipsum words separated by newlines
+ cmd = "< "dictionary" shuf -r -n" # Command to generate random permutations of words from dictionary separated by newlines
+ echolorem = "echo -n 'lorem\nipsum\ndolor\nsit\namet\n'"
+
+ ORS = ""
+ srand()
+
+ # Parse Arguments
+ !isint(ARGV[1]) && ARGV[1] && printusage()
+ numof = ARGC > 1 ? ARGV[1] : 5
+ mode = ARGC > 2 ? ARGV[2] : "p"
+ litext = 1
+ if (ARGV[3])
+ switch (ARGV[3]) {
+ case /^1$|^t$|^true$/: litext = 1; break
+ case /^0$|^f$|^false$/: litext = 0; break
+ default: printusage()
+ }
+ litext && cmd = echolorem "&&" cmd
+ min = isint(ARGV[4]) ? ARGV[4] : 5
+ max = isint(ARGV[5]) ? ARGV[5] : 12
+
+ switch (mode) {
+ case /^w$|^words$/:
+ cmd = cmd numof
+ genwords(numof, cmd)
+ break
+ case /^s$|^sentences$/:
+ cmd = cmd (max * numof)
+ gensentences(numof, ".\n", cmd, min, max)
+ break
+ case /^p$|^paragraphs$/:
+ cmd = cmd (max * 10 * numof)
+ genparagraphs(numof, cmd, min, max)
+ break
+ default:
+ printusage()
+ }
+ close(cmd)
+}
diff --git a/old/lipsumsh b/old/lipsumsh
new file mode 100755
index 0000000..d229877
--- /dev/null
+++ b/old/lipsumsh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+dictionary=/home/timmy/.local/share/lorem-ipsum-dictionary
+
+shuf -r -n$1 $dictionary | awk -f- hi hello yolo <<'AWKSCRIPT'
+BEGIN { for(i = 1; i < ARGC; i++) print ARGV[i] }
+AWKSCRIPT
+echo
+#shuf -r -n$1 $dictionary | tr '\n' ' '
+
+
+
+
+
+exit
+
+#genipsums() { shuf -r -n$1 $dictionary | tr '\n' ' ' | sed 's/.$//'; }
+genipsums() { shuf -r -n$1 $dictionary; }
+gensentence() { genipsums $1 | sed ':a;N;$!ba; s/\n/ /g; s/.$//; s/\(^\| \)\([a-z]\)/\1\u\2/'; }
+
+genparagraph() {
+ sentences=`shuf -n1 -i 4-12`
+ echo -n '\t'
+
+ for i in `seq $sentences`; do
+ words=`shuf -n1 -i 1-10`
+ [ "$loremipsumtext" = '1' ] && echo -n "Lorem ipsum " && genipsums $words && loremipsumtext=0 || gensentence $words
+ [ "$words" -le 4 ] || [ `shuf -n1 -i 0-2` = 1 ] && echo -n ', ' && genipsums `shuf -n1 -i 3-10` # make more complex
+ echo -n '. '
+ done
+ echo
+}
+
+loremipsumtext=1
+
+genparagraph
+
+
+
+#exit
+#
+#dictionary=/home/timmy/.local/share/lorem-ipsum-dictionary
+#
+#ipsums=$1
+#
+##set -- `tr '\n' ' ' < $dictionary`
+#set -- `cat $dictionary`
+#
+##rand=`od -An -N$ipsums /dev/urandom`
+#
+#shuf -r -n$ipsums -i 1-$# | while read line; do
+# eval echo -n \${$line}
+# echo -n ' '
+#done
+#
+#echo
+#
+#exit
+#
+#
+#
+#words=`wc -w $dictionary | cut -d' ' -f1`
+#
+#echo -n '\tLorem ipsum '
+#
+#shuf -r -n$1 -i 1-$words | while read line; do
+# #cut -z -d' ' -f$line $dictionary && echo -n ' '
+# head -n$line $dictionary | tail -n1 | tr -d '\n'
+# num=`shuf -n1 -i 1-100`
+# ([ "$num" -lt 10 ] && echo -n '. ') || ([ "$num" -gt 90 ] && echo -n ', ') || ([ "$num" = '50' ] && echo -n '.\n\t') || echo -n ' '
+#done
+#echo
diff --git a/old/setwindowtitle b/old/setwindowtitle
new file mode 100755
index 0000000..a2b9218
--- /dev/null
+++ b/old/setwindowtitle
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+#windowname="$(dmenu -p 'Enter New Window Name. Then, Select the Window to Change' <&-)"
+#xdotool selectwindow set_window --class "$windowname"
+##if [ -z "$1" ];
+##then
+##else
+## xdotool getactivewindow set_window --class "$1"
+##fi
+#if [ -z "$2" ]; then echo -en "\e]0;$2\a"; fi
+#xsetroot -name ""
diff --git a/old/shblr b/old/shblr
new file mode 100755
index 0000000..4570afc
--- /dev/null
+++ b/old/shblr
@@ -0,0 +1,14 @@
+#!/bin/sh
+energy_now_total=0
+energy_full_total=0
+for bat in /sys/class/power_supply/BAT?*; do
+ echo "`basename $bat`: \n" \
+ "├─Capacity:\t\t`cat $bat/capacity`% \n" \
+ "├─Energy Now:\t\t`cat $bat/energy_now` \n" \
+ "├─Energy Full:\t\t`cat $bat/energy_full` \n" \
+ "├─Energy Full Design:\t`cat $bat/energy_full_design` \n" \
+ "└─Health:\t\t$(( (`cat $bat/energy_full` * 100) / `cat $bat/energy_full_design` ))% "
+ energy_now_total=$(( energy_now_total + `cat $bat/energy_now` ))
+ energy_full_total=$(( energy_full_total + `cat $bat/energy_full` ))
+done
+echo "\nTotal Capacity:\t$(( (energy_now_total * 100) / energy_full_total ))%"
diff --git a/pkgmgt/xbps/xs b/pkgmgt/xbps/xs
new file mode 100755
index 0000000..31782ef
--- /dev/null
+++ b/pkgmgt/xbps/xs
@@ -0,0 +1,22 @@
+#!/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/programs/chrome b/programs/chrome
new file mode 120000
index 0000000..1fcdd6b
--- /dev/null
+++ b/programs/chrome
@@ -0,0 +1 @@
+../../lib/ungoogled-chromium/chrome \ No newline at end of file
diff --git a/st/settitle b/st/settitle
new file mode 100755
index 0000000..df613ca
--- /dev/null
+++ b/st/settitle
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+xdotool getactivewindow set_window --class "$1"
+[ -z "$2" ] && echo -en "\e]0;$2\a"
diff --git a/sync/pull b/sync/pull
new file mode 100755
index 0000000..06cf145
--- /dev/null
+++ b/sync/pull
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+printusage() { echo "Usage: $0 [-b,--build] [<repo> ...] (repos: all,`echo $repos | tr ' ' ','`)" && exit; }
+
+repos=$repos"blr dmenu dotconfig scripts st timmywm" #repos=$repos"dotconfig|dwmpatches|scripts|st|timmywm"
+
+[ -z $1 ] || [ `echo "$@" | tr ' ' '\n' | grep -v -c '\-'` = 0 ] && printusage
+
+# Colors
+BOLD="\033[1m"
+NORM="\033[0m"
+CYN="\033[0;36m"
+RED="\033[0;31m"
+GRN="\033[0;32m"
+MAG="\033[0;35m"
+
+printsyncmsg() { echo "$CYN[Pulling repo '$arg'...]$NORM"; }
+printsuccess() { echo "$BOLD$GRN[Successfully pulled repo '$arg']$NORM"; }
+printerror() { echo "$BOLD$RED[Failed to pull repo '$arg']$NORM"; }
+
+#change colors
+printmakemsg() { echo "$MAG[Building repo '$arg'...]$NORM"; }
+printmakesuccess() { echo "$BOLD$GRN[Successfully built repo '$arg']$NORM"; }
+printmakeerror() { echo "$BOLD$RED[Failed to build repo '$arg']$NORM"; }
+
+pullrepo() {
+ printsyncmsg
+ cd $1 && git pull --verbose \
+ && printsuccess || printerror
+}
+makerepo() {
+ if echo "$opts" | grep '\-b'; then
+ printmakemsg
+ doas make clean install \
+ && printmakesuccess || printmakeerror
+ fi
+}
+makeautoconf() { make autoconfig && echo "$BOLD$GRN[Automatically configured '$repo']$NORM"; }
+
+pullblr() { pullrepo ~/.local/src/programs/blr; }
+pulldmenu() { pullrepo ~/.local/src/programs/dmenu && makeautoconf && makerepo; }
+pulldotconfig() { pullrepo ~/.config; }
+pullscripts() { pullrepo ~/.local/bin; }
+pullst() { pullrepo ~/.local/src/programs/st && makeautoconf && makerepo; }
+pulltimmywm() { pullrepo ~/.local/src/programs/timmywm && makeautoconf && makerepo; }
+
+for arg in "$@"; do
+ case $arg in
+ -b|--build) opts="$opts-b" ;;
+ all) $0 $opts $repos ;;
+ *) # Would like to use something like $repos) here but cant
+ for repo in $repos; do
+ [ "$arg" = "$repo" ] && pull$arg && break
+ done || printusage
+ ;;
+ esac
+done
diff --git a/sync/sink b/sync/sink
new file mode 100755
index 0000000..41bf61e
--- /dev/null
+++ b/sync/sink
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+printusage() { echo "Usage: $0 [<repos> ...] (repos: all,`echo $repos | tr ' ' ','`) [up|down]" && exit; }
+
+repos="docs sites patches"
+
+oper=`echo $@ | sed 's/.* //'` # Get last argument
+([ -z $2 ] || ([ "$oper" != "up" ] && [ "$oper" != "down" ])) && printusage
+
+# rync options
+#fix this too
+ropts="--archive --delete --partial --progress --recursive --update --verbose" # Equivalent to: -aPrvu --delete
+rdest="tjkrsync@tjkeller.xyz:"
+
+# Colors
+BOLD="\033[1m"
+NORM="\033[0m"
+CYN="\033[0;36m"
+RED="\033[0;31m"
+GRN="\033[0;32m"
+
+printsyncmsg() { echo -n "$CYN[Syncing $SYNCNAME...]$NORM\n"; }
+printsuccess() { echo -n "$BOLD$GRN[Successfully synced $SYNCNAME]\n"; }
+printerror() { echo -n "$BOLD$RED[An error occured while syncing $SYNCNAME]\n"; }
+
+sync() {
+ [ $oper = "up" ] && SYNCNAME="$1$2 to $rdest$2" || SYNCNAME="$rdest$2 to $1$2"
+ printsyncmsg
+ (if [ $oper = "up" ]; then rsync $ropts $1$2 $rdest; else rsync $ropts $rdest$2 $1; fi) \
+ && printsuccess || printerror
+}
+
+# arg1 = options + containing directory path, arg2 = file/directory name
+syncdocs() { destdir="" && sync "/home/timmy/" "docs"; }
+#syncsites() { destdir="" && sync "--exclude=pass /home/timmy/.local/src/" "sites"; } # Excludes password file
+syncpatches() { destdir="" && sync "--exclude=.git /home/timmy/.local/src/programs/" "patches"; } # Excludes git files
+syncsite() { destdir="/var/www/tjkeller/" && sync "/home/timmy/.local/src/sites/" "tjkeller"; }
+
+for arg in "$@"; do
+ case $arg in
+ all) $0 $repos $oper ;;
+ up|down) oper=$arg ;;
+ *) # Would like to use something like $repos) here but cant
+ for repo in $repos; do
+ [ "$arg" = "$repo" ] && sync$arg && break
+ done || printusage
+ ;;
+ esac
+done
diff --git a/video/screenrec b/video/screenrec
new file mode 100755
index 0000000..91edcd0
--- /dev/null
+++ b/video/screenrec
@@ -0,0 +1,6 @@
+#!/bin/sh
+newname() { defname="video"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`.mkv; }
+vs=`cat /sys/class/drm/*/modes | head -1`
+vs=1366x768
+[ -z "$1" ] && newname || name="$1"
+ffmpeg -hide_banner -video_size $vs -framerate 60 -f x11grab -i :0.0+0,0 -c:v libx264 -preset ultrafast -qp 1 -pix_fmt yuv444p "$name"
diff --git a/x11/bsdtpscroll b/x11/bsdtpscroll
new file mode 100755
index 0000000..0f2cd20
--- /dev/null
+++ b/x11/bsdtpscroll
@@ -0,0 +1,4 @@
+#!/bin/sh
+xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation" 1
+xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Button" 2
+xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Axes" 6 7 4 5
diff --git a/x11/capsmap b/x11/capsmap
new file mode 100755
index 0000000..ad107da
--- /dev/null
+++ b/x11/capsmap
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# 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'
+
+# Turn off caps lock, just in case it was on prior
+xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock