A => booksplit +46 -0
@@ 1,46 @@
+#!/bin/sh
+
+# Requires ffmpeg (audio splitting) and my `tag` wrapper script.
+
+[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
+
+echo "Enter the album/book title:"; read -r booktitle
+
+echo "Enter the artist/author:"; read -r author
+
+echo "Enter the publication year:"; read -r year
+
+inputaudio="$1"
+
+# Get a safe file name from the book.
+escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
+
+! mkdir -p "$escbook" && echo "Do you have write access in this directory?" && exit 1
+
+# As long as the extension is in the tag script, it'll work.
+ext="opus"
+#ext="${1#*.}"
+
+# Get the total number of tracks from the number of lines.
+total="$(wc -l < "$2")"
+
+while read -r x;
+do
+ end="$(echo "$x" | cut -d' ' -f1)"
+
+ [ -n "$start" ] &&
+ echo "From $start to $end; $track $title"
+ file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
+ [ -n "$start" ] && echo "Splitting \"$title\"..." &&
+ ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -to "$end" -vn -c copy "$file" &&
+ echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
+ title="$(echo "$x" | cut -d' ' -f 2-)"
+ esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
+ track="$((track+1))"
+ start="$end"
+done < "$2"
+# The last track must be done outside the loop.
+echo "From $start to the end: $title"
+file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
+echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" &&
+ echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"<
\ No newline at end of file
A => compiler +57 -0
@@ 1,57 @@
+#!/bin/sh
+
+# This script will compile or run another finishing operation on a document. I
+# have this script run via vim.
+#
+# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
+# presentations. Runs scripts based on extention or shebang.
+#
+# Note that .tex files which you wish to compile with XeLaTeX should have the
+# string "xelatex" somewhere in a comment/command in the first 5 lines.
+
+file=$(readlink -f "$1")
+dir=${file%/*}
+base="${file%.*}"
+ext="${file##*.}"
+
+cd "$dir" || exit 1
+
+textype() { \
+ command="pdflatex"
+ ( head -n5 "$file" | grep -qi 'xelatex' ) && command="xelatex"
+ $command --output-directory="$dir" "$base" &&
+ grep -qi addbibresource "$file" &&
+ biber --input-directory "$dir" "$base" &&
+ $command --output-directory="$dir" "$base" &&
+ $command --output-directory="$dir" "$base"
+}
+
+case "$ext" in
+ # Try to keep these cases in alphabetical order.
+ [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;;
+ c) cc "$file" -o "$base" && "$base" ;;
+ cpp) g++ "$file" -o "$base" && "$base" ;;
+ cs) mcs "$file" && mono "$base".exe ;;
+ go) go run "$file" ;;
+ h) sudo make install ;;
+ java) javac -d classes "$file" && java -cp classes "${1%.*}" ;;
+ m) octave "$file" ;;
+ md) if [ -x "$(command -v lowdown)" ]; then
+ lowdown -d nointem -e super "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf
+ elif [ -x "$(command -v groffdown)" ]; then
+ groffdown -i "$file" | groff > "$base.pdf"
+ else
+ pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
+ fi ; ;;
+ mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;;
+ ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;;
+ org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
+ py) python "$file" ;;
+ [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
+ rs) cargo build ;;
+ sass) sassc -a "$file" "$base.css" ;;
+ scad) openscad -o "$base".stl "$file" ;;
+ sent) setsid -f sent "$file" 2>/dev/null ;;
+ tex) textype "$file" ;;
+ *) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;;
+esac
A => cron/README.md +11 -0
@@ 1,11 @@
+# Important Note
+
+These cronjobs have components that require information about your current display to display notifications correctly.
+
+When you add them as cronjobs, I recommend you precede the command with commands as those below:
+
+```
+export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here
+```
+
+This ensures that notifications will display, xdotool commands will function and environmental variables will work as well.
A => cron/checkup +19 -0
@@ 1,19 @@
+#!/bin/sh
+
+# Syncs repositories and downloads updates, meant to be run as a cronjob.
+
+ping -q -c 1 example.org > /dev/null || exit
+
+notify-send "π¦ Repository Sync" "Checking for package updates..."
+
+sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
+
+Check your internet connection, if pacman is already running, or run update manually to see errors."
+pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
+
+if pacman -Qu | grep -v "\[ignored\]"
+then
+ notify-send "π Repository Sync" "Updates available. Click statusbar icon (π¦) for update."
+else
+ notify-send "π¦ Repository Sync" "Sync complete. No new packages for update."
+fi
A => cron/crontog +6 -0
@@ 1,6 @@
+#!/bin/sh
+
+# Toggles all cronjobs off/on.
+# Stores disabled crontabs in ~/.consaved until restored.
+
+([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "π Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "π Cronjobs saved and disabled.")
A => cron/newsup +17 -0
@@ 1,17 @@
+#!/bin/sh
+
+# Set as a cron job to check for new RSS entries for newsboat.
+# If newsboat is open, sends it an "R" key to refresh.
+
+ping -q -c 1 example.org > /dev/null || exit
+
+/usr/bin/notify-send "π° Updating RSS feeds..."
+
+pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
+
+echo π > /tmp/newsupdate
+pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
+/usr/bin/newsboat -x reload
+rm -f /tmp/newsupdate
+pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
+/usr/bin/notify-send "π° RSS feed update complete."
A => displayselect +83 -0
@@ 1,83 @@
+#!/bin/sh
+
+# A UI for detecting and selecting all displays. Probes xrandr for connected
+# displays and lets user select one to use. User may also select "manual
+# selection" which opens arandr.
+
+twoscreen() { # If multi-monitor is selected and there are two screens.
+
+ mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
+ # Mirror displays using native resolution of external display and a scaled
+ # version for the internal display
+ if [ "$mirror" = "yes" ]; then
+ external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
+ internal=$(echo "$screens" | grep -v "$external")
+
+ res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
+ tail -n 1 | awk '{print $1}')
+ res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
+ tail -n 1 | awk '{print $1}')
+
+ res_ext_x=$(echo "$res_external" | sed 's/x.*//')
+ res_ext_y=$(echo "$res_external" | sed 's/.*x//')
+ res_int_x=$(echo "$res_internal" | sed 's/x.*//')
+ res_int_y=$(echo "$res_internal" | sed 's/.*x//')
+
+ scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
+ scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
+
+ xrandr --output "$external" --auto --scale 1.0x1.0 \
+ --output "$internal" --auto --same-as "$external" \
+ --scale "$scale_x"x"$scale_y"
+ else
+
+ primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
+ secondary=$(echo "$screens" | grep -v "$primary")
+ direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
+ xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
+ fi
+ }
+
+morescreen() { # If multi-monitor is selected and there are more than two screens.
+ primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
+ secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:")
+ direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
+ tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:")
+ xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
+ }
+
+multimon() { # Multi-monitor handler.
+ case "$(echo "$screens" | wc -l)" in
+ 2) twoscreen ;;
+ *) morescreen ;;
+ esac ;}
+
+onescreen() { # If only one output available or chosen.
+ xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)
+ }
+
+postrun() { # Stuff to run to clean up.
+ setbg # Fix background if screen size/arangement has changed.
+ remaps # Re-remap keys if keyboard added (for laptop bases)
+ { killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
+ }
+
+# Get all possible displays
+allposs=$(xrandr -q | grep "connected")
+
+# Get all connected screens.
+screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
+
+# If there's only one screen
+[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
+ { onescreen "$screens"; postrun; notify-send "π» Only one screen detected." "Using it in its optimal settings..."; exit ;}
+
+# Get user choice including multi-monitor and manual selection:
+chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
+case "$chosen" in
+ "manual selection") arandr ; exit ;;
+ "multi-monitor") multimon ;;
+ *) onescreen "$chosen" ;;
+esac
+
+postrun
A => +24 -0
@@ 1,24 @@
#!/bin/sh
# Must have keepassxc installed to show menu
keepassxc-cli -h >/dev/null || exit
# Set variables
PASSWD=$(dmenu -sb "#85add4" -sf "#e4e4e4" -nf "#3a3a3a" -nb "#3a3a3a" -p "Enter your master password:" <&- && echo)
KEYFILE="/home/ctb/Documents/KPXC/keyfile.txt"
DATABASE="/home/ctb/Documents/KPXC/Passwords.kdbx"
# Check if PASSWD is correct. If PASSWD is incorrect send a notification and exit the program
echo "$PASSWD" | keepassxc-cli ls -k $KEYFILE $DATABASE >/dev/null || notify-send "Incorrect master password."
echo "$PASSWD" | keepassxc-cli ls -k $KEYFILE $DATABASE >/dev/null || exit
# Choose an account
LOGIN=$(echo "$PASSWD" | keepassxc-cli ls -k $KEYFILE $DATABASE | grep -v $DATABASE | sort | dmenu -i -p "Which Account?")
# If account is valid copy the password to the clipboard
# If the account is invalid send a notification and exit the script
echo "$PASSWD" | keepassxc-cli clip -k $KEYFILE $DATABASE "$LOGIN" >/dev/null || notify-send "Invalid entry."
echo "$PASSWD" | keepassxc-cli clip -k $KEYFILE $DATABASE "$LOGIN" >/dev/null || exit
USERNAME=$( echo "$PASSWD" | keepassxc-cli show -k $KEYFILE $DATABASE "$LOGIN" | grep UserName ) || exit
notify-send "$USERNAME"
notify-send " "
notify-send "Password for $LOGIN copied to clipboard."
A => dmenuhandler +21 -0
@@ 1,21 @@
+#!/bin/sh
+
+# Feed this script a link and it will give dmenu
+# some choice programs to use to open it.
+feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
+
+case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dl\\nqueue yt-dl audio" | dmenu -i -p "Open it with?")" in
+ "copy url") echo "$feed" | xclip -selection clipboard ;;
+ mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
+ "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
+ "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
+ "queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;;
+ "queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;;
+ "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
+ PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
+ sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
+ vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
+ setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
+ browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
+ lynx) lynx "$feed" >/dev/null 2>&1 ;;
+esac
A => +67 -0
@@ 1,67 @@
#!/bin/sh
# Gives a dmenu prompt to mount unmounted drives and Android phones. If
# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll
# be prompted to give a mountpoint from already existsing directories. If you
# input a novel directory, it will prompt you to create that directory.
getmount() { \
[ -z "$chosen" ] && exit 1
# shellcheck disable=SC2086
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
test -z "$mp" && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
sudo -A mount "$chosen" 2>/dev/null && notify-send "π» USB mounting" "$chosen mounted." && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}')
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
esac
notify-send "π» USB mounting" "$chosen mounted to $mp."
}
mountandroid() { \
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
chosen="$(echo "$chosen" | cut -d : -f 1)"
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
simple-mtpfs --device "$chosen" "$mp"
notify-send "π€ Android Mounting" "Android device mounted to $mp."
}
asktype() { \
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
case $choice in
USB) mountusb ;;
Android) mountandroid ;;
esac
}
anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
echo "Android device(s) detected."
mountandroid
else
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected."
mountusb
else
echo "Mountable USB drive(s) and Android device(s) detected."
asktype
fi
fi
A => +19 -0
@@ 1,19 @@
#!/bin/sh
# Gives a dmenu prompt to mount unmounted local NAS shares for read/write.
# Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL"
#
# Browse for mDNS/DNS-SD services using the Avahi daemon...
srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | dmenu -i -p "Which NAS?") || exit 1
notify-send "Searching for network shares..." "Please wait..."
# Choose share disk...
share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p "Mount which share?") || exit 1
# Format URL...
share2mnt=//"$srvname".local/"$share"
sharemount() {
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
[ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
notify-send "Netshare $share already mounted"; exit 1
}
sharemount
A => +6 -0
@@ 1,6 @@
#!/bin/sh
# This script is the SUDO_ASKPASS variable, meaning that it will be used as a
# password prompt if needed.
dmenu -fn Monospace-18 -P -p "$1" <&- && echo
A => +123 -0
@@ 1,123 @@
#!/bin/sh
# Usage:
# `$0`: Ask for recording type via dmenu
# `$0 screencast`: Record both audio and screen
# `$0 video`: Record only screen
# `$0 audio`: Record only audio
# `$0 kill`: Kill existing recording
#
# If there is already a running instance, user will be prompted to end it.
updateicon() { \
echo "$1" > /tmp/recordingicon
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
}
killrecording() {
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f /tmp/recordingpid
updateicon ""
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
sleep 3
kill -9 "$recpid"
exit
}
screencast() { \
ffmpeg -y \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-f alsa -i default \
-r 30 \
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
echo $! > /tmp/recordingpid
updateicon "βΊοΈποΈ"
}
video() { ffmpeg \
-f x11grab \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "βΊοΈ"
}
webcamhidef() { ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "π₯"
}
webcam() { ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "π₯"
}
audio() { \
ffmpeg \
-f alsa -i default \
-c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! > /tmp/recordingpid
updateicon "ποΈ"
}
askrecording() { \
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in
screencast) screencast;;
audio) audio;;
video) video;;
*selected) videoselected;;
webcam) webcam;;
"webcam (hi-def)") webcamhidef;;
esac
}
asktoend() { \
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
[ "$response" = "Yes" ] && killrecording
}
videoselected()
{
slop -f "%x %y %w %h" > /tmp/slop
read -r X Y W H < /tmp/slop
rm /tmp/slop
ffmpeg \
-f x11grab \
-framerate 60 \
-video_size "$W"x"$H" \
-i :0.0+"$X,$Y" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > /tmp/recordingpid
updateicon "βΊοΈ"
}
case "$1" in
screencast) screencast;;
audio) audio;;
video) video;;
*selected) videoselected;;
kill) killrecording;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
esac
A => +44 -0
@@ 1,44 @@
#!/bin/sh
# A dmenu prompt to unmount drives.
# Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount.
unmountusb() {
[ -z "$drives" ] && exit
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
[ -z "$chosen" ] && exit
sudo -A umount "$chosen" && notify-send "π» USB unmounting" "$chosen unmounted."
}
unmountandroid() { \
chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
[ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && notify-send "π€ Android unmounting" "$chosen unmounted."
}
asktype() { \
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1
case "$choice" in
USB) unmountusb ;;
Android) unmountandroid ;;
esac
}
drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
if ! grep simple-mtpfs /etc/mtab; then
[ -z "$drives" ] && echo "No drives to unmount." && exit
echo "Unmountable USB drive detected."
unmountusb
else
if [ -z "$drives" ]
then
echo "Unmountable Android device detected."
unmountandroid
else
echo "Unmountable USB drive(s) and Android device(s) detected."
asktype
fi
fi
A => +18 -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/larbs/emoji | dmenu -i -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
printf "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
fi
A => dwmbar +96 -0
@@ 1,96 @@
+#!/bin/sh
+
+# This script sets the statusbar with the xsetroot command at the end. Have it
+# started by ~/.xinitrc or ~/.xprofile.
+
+# Handle SIGTRAP signals sent by refbar to update the status bar immediately.
+trap 'update' 5
+
+# Set the deliminter character.
+delim="|"
+
+# testweather checks to see if the most recent forecast is up to date. If it
+# isn't, it downloads a new weather forecast, then signals to update the
+# statusbar. Gets weather report from wttr.in.
+testweather() { \
+ [ "$(stat -c %y "$HOME/.local/share/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
+ ping -q -c 1 1.1.1.1 >/dev/null &&
+ curl -s "wttr.in/Nashville" > "$HOME/.local/share/weatherreport" &&
+ notify-send "π Weather" "New weather forecast for today." &&
+ refbar
+ }
+
+# Here is the (big) function that outputs the appearance of the statusbar. It
+# can really be broken down into many submodules which I've commented and
+# explained.
+status() { \
+
+ # Get current mpd track filename or artist - title if possible.
+ mpc -f "[[%artist% - ]%title%]|[%file%]" 2>/dev/null | grep -v "volume:" | head -n 1
+
+ # If the weather report is current, show daily precipitation chance,
+ # low and high. Don't even bother to understand this one unless you
+ # have all day. Takes the weather report format from wttr.in and makes
+ # it look like how I want it for the status bar.
+ [ "$(stat -c %y "$HOME/.local/share/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] &&
+ sed '16q;d' "$HOME/.local/share/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/ο© /g" | tr -d '\n' &&
+ sed '13q;d' "$HOME/.local/share/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ο",$1 "Β°","ο
",$2 "Β°"}' &&
+ echo "$delim"
+
+ # Get the volume of ALSA's master volume output. Show an icon if or
+ # not muted.
+ amixer get Master | grep -o "[0-9]*%\|\[on\]\|\[off\]" | sed "s/\[on\]/ο¨/;s/\[off\]/ο¦/" | sort | uniq
+
+ echo "$delim"
+
+ # Wifi quality percentage and icon if ethernet is connected.
+ grep "^\s*w" /proc/net/wireless | awk '{ print "ο«", int($3 * 100 / 70) "%" }'
+ #sed "s/down//;s/up/ο¬/" /sys/class/net/e*/operstate
+
+ # Show unread mail if mutt-wizard is installed.
+ command -v mw >/dev/null 2>&1 &&
+ echo "$delim" &&
+ du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | wc -l | sed 's/^/οΆ /'
+ echo "$delim"
+
+ # Will show all batteries with approximate icon for remaining power.
+ CHARGE=$(cat /sys/class/power_supply/BAT0/capacity)
+ STATUS=$(cat /sys/class/power_supply/BAT0/status)
+
+ if [ "$STATUS" = "Discharging" ]; then
+ printf "ο %s%% " "$CHARGE"
+ else
+ printf "ο§ %s%% " "$CHARGE"
+ fi
+ echo "$delim"
+
+ # Date and time.
+ date '+ο³ %B %d %I:%M'
+
+ }
+
+update() { \
+ # So all that big status function was just a command that quicking gets
+ # what we want to be the statusbar. This xsetroot command is what sets
+ # it. Note that the tr command replaces newlines with spaces. This is
+ # to prevent some weird issues that cause significant slowing of
+ # everything in dwm. Note entirely sure of the cause, but again, the tr
+ # command easily avoids it.
+ xsetroot -name "$(status | tr '\n' ' ')" &
+ wait
+
+ # Check to see if new weather report is needed.
+ testweather &
+ wait
+ }
+
+
+while :; do
+ update
+ # Sleep for a minute after changing the status bar before updating it
+ # again. We run sleep in the background and use wait until it finishes,
+ # because traps can interrupt wait immediately, but they can't do that
+ # with sleep.
+ sleep 1m &
+ wait
+done
A => ext +45 -0
@@ 1,45 @@
+#!/bin/sh
+
+# A general, all-purpose extraction script. Not all extraction programs here
+# are installed by LARBS automatically.
+#
+# Default behavior: Extract archive into new directory
+# Behavior with `-c` option: Extract contents into current directory
+
+while getopts "hc" o; do case "${o}" in
+ c) extracthere="True" ;;
+ *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;;
+esac done
+
+if [ -z "$extracthere" ]; then
+ archive="$(readlink -f "$*")" &&
+ directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
+ mkdir -p "$directory" &&
+ cd "$directory" || exit 1
+else
+ archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)"
+fi
+
+[ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1
+
+if [ -f "$archive" ] ; then
+ case "$archive" in
+ *.tar.bz2|*.tbz2) bsdtar -xf "$archive" ;;
+ *.tar.xz) bsdtar -xf "$archive" ;;
+ *.tar.gz|*.tgz) bsdtar -xf "$archive" ;;
+ *.tar.zst) bsdtar -xf "$archive" ;;
+ *.tar) bsdtar -xf "$archive" ;;
+ *.lzma) unlzma "$archive" ;;
+ *.bz2) bunzip2 "$archive" ;;
+ *.rar) unrar x -ad "$archive" ;;
+ *.gz) gunzip "$archive" ;;
+ *.zip) unzip "$archive" ;;
+ *.Z) uncompress "$archive" ;;
+ *.7z) 7z x "$archive" ;;
+ *.xz) unxz "$archive" ;;
+ *.exe) cabextract "$archive" ;;
+ *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
+ esac
+else
+ printf "File \"%s\" not found.\\n" "$archive"
+fi
A => getbib +14 -0
@@ 1,14 @@
+#!/bin/sh
+[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
+
+if [ -f "$1" ]; then
+ # Try to get DOI from pdfinfo or pdftotext output.
+ doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
+ doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
+ exit 1
+else
+ doi="$1"
+fi
+
+# Check crossref.org for the bib citation.
+curl -s "https://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
A => getkeys +5 -0
@@ 1,5 @@
+#!/bin/sh
+
+cat "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys/"$1" 2>/dev/null && exit
+echo "Run command with one of the following arguments for info about that program:"
+ls "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys
A => ifinstalled +13 -0
@@ 1,13 @@
+#!/bin/sh
+
+# Some optional functions in LARBS require programs not installed by default. I
+# use this little script to check to see if a command exists and if it doesn't
+# it informs the user that they need that command to continue. This is used in
+# various other scripts for clarity's sake.
+
+for x in "$@";do
+ notify() { notify-send "π¦ $x" "must be installed for this function." && exit 1 ;}
+ which_out="$( /usr/bin/which "$x" >/dev/null 2>&1 )" && exit 0 #you might have compiled the prog, and not install the repo pkg...
+ pkgname="$(pacman -Qqo "$which_out" >/dev/null 2>&1 )" #...thats why two variables.
+ pacman -Qq "$pkgname" >/dev/null 2>&1 || notify
+done
A => lf-select +9 -0
@@ 1,9 @@
+#!/bin/sh
+
+# Reads file names from stdin and selects them in lf.
+
+while read -r file; do
+ [ -z "$file" ] && continue
+ lf -remote "send select \"$file\""
+ lf -remote "send toggle"
+done
A => linkhandler +23 -0
@@ 1,23 @@
+#!/bin/sh
+
+# Feed script a url or file location.
+# If an image, it will view in sxiv,
+# if a video or gif, it will view in mpv
+# if a music file or pdf, it will download,
+# otherwise it opens link in browser.
+
+# If no url given. Opens browser. For using script as $BROWSER.
+[ -z "$1" ] && { "$BROWSER"; exit; }
+
+case "$1" in
+ *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
+ setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
+ *png|*jpg|*jpe|*jpeg|*gif)
+ curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
+ *pdf|*cbz|*cbr)
+ curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
+ *mp3|*flac|*opus|*mp3?source*)
+ qndl "$1" 'curl -LO' >/dev/null 2>&1 ;;
+ *)
+ [ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1
+esac
A => maimpick +14 -0
@@ 1,14 @@
+#!/bin/sh
+
+# This is bound to Shift+PrintScreen by default, requires maim. It lets you
+# choose the kind of screenshot to take, including copying the image or even
+# highlighting an area to copy. scrotcucks on suicidewatch right now.
+
+case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
+ "a selected area") maim -s pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
+ "current window") maim -i "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;;
+ "full screen") maim pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
+ "a selected area (copy)") maim -s | xclip -selection clipboard -t image/png ;;
+ "current window (copy)") maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;;
+ "full screen (copy)") maim | xclip -selection clipboard -t image/png ;;
+esac
A => noisereduce +81 -0
@@ 1,81 @@
+#!/usr/bin/sh
+
+usage ()
+{
+ printf "Usage : noisereduce <input video file> <output video file>\n"
+ exit
+}
+
+# Tests for requirements
+ifinstalled ffmpeg || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
+ifinstalled sox || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
+
+if [ "$#" -ne 2 ]
+then
+ usage
+fi
+
+if [ ! -e "$1" ]
+then
+ printf "File not found: %s\n" "$1"
+ exit
+fi
+
+if [ -e "$2" ]
+then
+ printf "File %s already exists, overwrite? [y/N]\n: " "$2"
+ read -r yn
+ case $yn in
+ [Yy]* ) ;;
+ * ) exit;;
+ esac
+fi
+
+inBasename=$(basename "$1")
+inExt="${inBasename##*.}"
+
+isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
+if [ -n "$isVideoStr" ]
+then
+ isVideo=1
+ printf "Detected %s as a video file\n" "$inBasename"
+else
+ isVideo=0
+ printf "Detected %s as an audio file\n" "$inBasename"
+fi
+
+printf "Sample noise start time [00:00:00]: "
+read -r sampleStart
+if [ -z "$sampleStart" ] ; then sampleStart="00:00:00"; fi
+printf "Sample noise end time [00:00:00.900]: "
+read -r sampleEnd
+if [ -z "$sampleEnd" ] ; then sampleEnd="00:00:00.900"; fi
+printf "Noise reduction amount [0.21]: "
+read -r sensitivity
+if [ -z "$sensitivity" ] ; then sensitivity="0.21"; fi
+
+
+tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
+tmpAudFile="/tmp/noiseclean_tmpaud.wav"
+noiseAudFile="/tmp/noiseclean_noiseaud.wav"
+noiseProfFile="/tmp/noiseclean_noise.prof"
+tmpAudCleanFile="/tmp/noiseclean_tmpaud-clean.wav"
+
+printf "Cleaning noise on %s...\n" "$1"
+
+if [ $isVideo -eq "1" ]; then
+ ffmpeg -v warning -y -i "$1" -qscale:v 0 -vcodec copy -an "$tmpVidFile"
+ ffmpeg -v warning -y -i "$1" -qscale:a 0 "$tmpAudFile"
+else
+ cp "$1" "$tmpAudFile"
+fi
+ffmpeg -v warning -y -i "$1" -vn -ss "$sampleStart" -t "$sampleEnd" "$noiseAudFile"
+sox "$noiseAudFile" -n noiseprof "$noiseProfFile"
+sox "$tmpAudFile" "$tmpAudCleanFile" noisered "$noiseProfFile" "$sensitivity"
+if [ $isVideo -eq "1" ]; then
+ ffmpeg -v warning -y -i "$tmpAudCleanFile" -i "$tmpVidFile" -vcodec copy -qscale:v 0 -qscale:a 0 "$2"
+else
+ cp "$tmpAudCleanFile" "$2"
+fi
+
+printf "Done"
A => opout +13 -0
@@ 1,13 @@
+#!/bin/sh
+
+# opout: "open output": A general handler for opening a file's intended output,
+# usually the pdf of a compiled document. I find this useful especially
+# running from vim.
+
+basename="$(echo "${*}" | sed 's/\.[^\/.]*$//')"
+
+case "${*}" in
+ *.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
+ *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
+ *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
+esac
A => pauseallmpv +10 -0
@@ 1,10 @@
+#!/bin/sh
+
+# You might notice all mpv commands are aliased to have this input-ipc-server
+# thing. That's just for this particular command, which allows us to pause
+# every single one of them with one command! This is bound to super + shift + p
+# (with other things) by default and is used in some other places.
+
+for i in $(ls /tmp/mpvSockets/*); do
+ echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
+done
A => peertubetorrent +7 -0
@@ 1,7 @@
+#!/bin/sh
+# torrent peertube videos, requires the transadd script
+# first argument is the video link, second is the quality (480 or 1080)
+# 13/07/20 - Arthur Bais
+
+link="$(echo "$1" | sed "s/w/download\/torrents/")""-$2.torrent"
+transadd "$link"
A => podentr +7 -0
@@ 1,7 @@
+#!/bin/sh
+
+# entr command to run `queueandnotify` when newsboat queue is changed
+
+[ "$(pgrep -x "$(basename "$0")" | wc -l)" -gt 2 ] && exit
+
+echo "${XDG_DATA_HOME:-$HOME/.local/share}"/newsboat/queue | entr -p queueandnotify 2>/dev/null
A => prompt +8 -0
@@ 1,8 @@
+#!/bin/sh
+
+# A dmenu binary prompt script.
+# Gives a dmenu prompt labeled with $1 to perform command $2.
+# For example:
+# `./prompt "Do you want to shutdown?" "shutdown -h now"`
+
+[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2
A => qndl +12 -0
@@ 1,12 @@
+#!/bin/sh
+
+# $1 is a url; $2 is a command
+[ -z "$1" ] && exit
+base="$(basename "$1")"
+notify-send "β³ Queuing $base..."
+cmd="$2"
+[ -z "$cmd" ] && cmd="youtube-dl --add-metadata -ic"
+idnum="$(tsp $cmd "$1")"
+realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
+tsp -D "$idnum" mv "$base" "$realname"
+tsp -D "$idnum" notify-send "π $realname done."
A => queueandnotify +14 -0
@@ 1,14 @@
+#!/bin/sh
+
+# Podboat sucks. This script replaces it.
+# It reads the newsboat queue, queuing downloads with taskspooler.
+# It also removes the junk from extentions.
+queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
+
+while read -r line; do
+ [ -z "$line" ] && continue
+ url="${line%%[ ]*}"
+ qndl "$url" "curl -LO"
+done < "$queuefile"
+
+echo > "$queuefile"
A => refbar +5 -0
@@ 1,5 @@
+#!/bin/sh
+
+# Refresh the dwmbar.
+# Send SIGTRAP signal to dwmbar script, which will handle it with a trap.
+pkill -SIGTRAP dwmbar
A => remaps +18 -0
@@ 1,18 @@
+#!/bin/sh
+
+# This script is called by dwm on startup.
+
+# Increase key speed via a rate change
+xset r rate 300 50
+# Map the caps lock key to super...
+setxkbmap -layout us -option ctrl:nocaps
+setxkbmap -option "shift:both_capslock"
+
+# But when it is pressed only once, treat it as escape.
+xcape -e 'Control_L=Escape'
+
+# Map simultaneous press of both shifts to capslock
+setxkbmap -option "shift:both_capslock"
+
+# Map the menu button to right super as well.
+xmodmap -e 'keycode 107 = Super_R'
A => rotdir +12 -0
@@ 1,12 @@
+#!/bin/sh
+
+# When I open an image from the file manager in sxiv (the image viewer), I want
+# to be able to press the next/previous keys to key through the rest of the
+# images in the same directory. This script "rotates" the content of a
+# directory based on the first chosen file, so that if I open the 15th image,
+# if I press next, it will go to the 16th etc. Autistic, I know, but this is
+# one of the reasons that sxiv is great for being able to read standard input.
+
+[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
+base="$(basename "$1")"
+ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
A => +18 -0
@@ 1,18 @@
#!/bin/sh
if echo "$1" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" ; then
url="$1"
else
url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" |
grep -o "https?://[^\" ]")"
echo "$url" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" ||
notify-send "That doesn't look like a full URL." && exit 1
fi
RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
if awk '{print $1}' "$RSSFILE" | grep "^$url$" >/dev/null; then
notify-send "You already have this RSS feed."
else
echo "$url" >> "$RSSFILE" && notify-send "RSS feed added."
fi
A => samedir +8 -0
@@ 1,8 @@
+#!/bin/sh
+
+# Open a terminal window in the same directory as the currently active window.
+
+PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
+PID="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')"
+cd "$(readlink /proc/"$PID"/cwd)" || return 1
+"$TERMINAL"
A => setbg +29 -0
@@ 1,29 @@
+#!/bin/sh
+
+# This script does the following:
+# Run by itself, set the wallpaper (at X start).
+# If given a file, set that as the new wallpaper.
+# If given a directory, choose random file in it.
+# If wal is installed, also generates a colorscheme.
+
+# Location of link to wallpaper link.
+bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
+
+trueloc="$(readlink -f "$1")" &&
+case "$(file --mime-type -b "$trueloc")" in
+ image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
+ inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
+ *) notify-send "Error" "Not a valid image." ; exit 1;;
+esac
+
+# If pywal is installed, use it.
+if command -v wal >/dev/null 2>&1 ; then
+ wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 &&
+ pidof dwm >/dev/null && xdotool key super+F12
+# If pywal is removed, return config files to normal.
+else
+ [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc.bak" ] && unlink "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc" && mv "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc.bak" "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
+ [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc.bak" ] && unlink "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc" && mv "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc.bak" "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
+fi
+
+xwallpaper --zoom "$bgloc"
A => shortcuts +40 -0
@@ 1,40 @@
+#!/bin/sh
+
+bmdirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs"
+bmfiles="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files"
+
+# Output locations. Unactivated progs should go to /dev/null.
+shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
+zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
+lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc"
+ranger_shortcuts="/dev/null"
+qute_shortcuts="/dev/null"
+fish_shortcuts="/dev/null"
+vifm_shortcuts="/dev/null"
+
+# Remove, prepare files
+rm -f "$lf_shortcuts" "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null
+printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
+printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
+printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
+
+# Format the `directories` file in the correct syntax and sent it to all three configs.
+eval "echo \"$(cat "$bmdirs")\"" | \
+awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
+ printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
+ printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
+ printf(\"abbr %s \42cd %s; and ls -a\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ;
+ printf(\"map g%s :cd %s<CR>\nmap t%s <tab>:cd %s<CR><tab>\nmap M%s <tab>:cd %s<CR><tab>:mo<CR>\nmap Y%s <tab>:cd %s<CR><tab>:co<CR> \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ;
+ printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ;
+ printf(\"map g%s cd %s\nmap t%s tab_new %s\nmap m%s shell mv -v %%s %s\nmap Y%s shell cp -rv %%s %s \n\",\$1,\$2,\$1,\$2, \$1, \$2, \$1, \$2) >> \"$ranger_shortcuts\" ;
+ printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }"
+
+# Format the `files` file in the correct syntax and sent it to both configs.
+eval "echo \"$(cat "$bmfiles")\"" | \
+awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
+ printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
+ printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
+ printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ;
+ printf(\"map %s :e %s<CR> \n\",\$1,\$2) >> \"$vifm_shortcuts\" ;
+ printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" ;
+ printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }"
A => slider +126 -0
@@ 1,126 @@
+#!/bin/sh
+
+# Give a file with images and timecodes and creates a video slideshow of them.
+#
+# Timecodes must be in format 00:00:00.
+#
+# Imagemagick and ffmpeg required.
+
+# Application cache if not stated elsewhere.
+cache="${XDG_CACHE_HOME:-$HOME/.cache}/slider"
+
+while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
+ c) bgc="$OPTARG" ;;
+ t) fgc="$OPTARG" ;;
+ f) font="$OPTARG" ;;
+ i) file="$OPTARG" ;;
+ a) audio="$OPTARG" ;;
+ o) outfile="$OPTARG" ;;
+ d) prepdir="$OPTARG" ;;
+ r) redo="$OPTARG" ;;
+ s) ppt="$OPTARG" ;;
+ e) endtime="$OPTARG" ;;
+ x) res="$OPTARG"
+ echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
+ echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
+ exit 1 ;;
+ p) echo "Purge old build files in $cache? [y/N]"
+ read -r confirm
+ echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
+ exit ;;
+ v) verbose=True ;;
+ *) echo "$(basename "$0") usage:
+ -i input timecode list (required)
+ -a audio file
+ -c color of background (use html names, black is default)
+ -t text color for text slides (white is default)
+ -s text font size for text slides (150 is default)
+ -f text font for text slides (sans serif is default)
+ -o output video file
+ -e if no audio given, the time in seconds that the last slide will be shown (5 is default)
+ -x resolution (1920x1080 is default)
+ -d tmp directory
+ -r rerun imagemagick commands even if done previously (in case files or background has changed)
+ -p purge old build files instead of running
+ -v be verbose" && exit 1
+
+esac done
+
+# Check that the input file looks like it should.
+{ head -n 1 "$file" 2>/dev/null | grep -q "^00:00:00 " ;} || {
+ echo "Give an input file with -i." &&
+ echo "The file should look as this example:
+
+00:00:00 first_image.jpg
+00:00:03 otherdirectory/next_image.jpg
+00:00:09 this_image_starts_at_9_seconds.jpg
+etc...
+
+Timecodes and filenames must be separated by Tabs." &&
+ exit 1
+ }
+
+if [ -n "${audio+x}" ]; then
+ # Check that the audio file looks like an actual audio file.
+ case "$(file --dereference --brief --mime-type -- "$audio")" in
+ audio/*) ;;
+ *) echo "That doesn't look like an audio file."; exit 1 ;;
+ esac
+ totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
+ endtime="$((totseconds-seconds))"
+fi
+
+prepdir="${prepdir:-$cache/$file}"
+outfile="${outfile:-$file.mp4}"
+prepfile="$prepdir/$file.prep"
+
+[ -n "${verbose+x}" ] && echo "Preparing images... May take a while depending on the number of files."
+mkdir -p "$prepdir"
+
+{
+while read -r x;
+do
+ # Get the time from the first column.
+ time="${x%% *}"
+ seconds="$(date '+%s' -d "$time")"
+ # Duration is not used on the first looped item.
+ duration="$((seconds - prevseconds))"
+
+ # Get the filename/text content from the rest.
+ content="${x#* }"
+ base="$(basename "$content")"
+ base="${base%.*}.jpg"
+
+ if [ -f "$content" ]; then
+ # If images have already been made in a previous run, do not recreate
+ # them unless -r was given.
+ { [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
+ convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base"
+ else
+ { [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} &&
+ convert -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base"
+ fi
+
+ # If the first line, do not write yet.
+ [ "$time" = "00:00:00" ] || echo "file '$prevbase'
+duration $duration"
+
+ # Keep the information required for the next file.
+ prevbase="$base"
+ prevtime="$time"
+ prevseconds="$(date '+%s' -d "$prevtime")"
+done < "$file"
+# Do last file which must be given twice as follows
+echo "file '$base'
+duration ${endtime:-5}
+file '$base'"
+} > "$prepfile"
+if [ -n "${audio+x}" ]; then
+ ffmpeg -hide_banner -y -f concat -safe 0 -i "$prepfile" -i "$audio" -c:a aac -vsync vfr -c:v libx264 -pix_fmt yuv420p "$outfile"
+else
+ ffmpeg -hide_banner -y -f concat -safe 0 -i "$prepfile" -vsync vfr -c:v libx264 -pix_fmt yuv420p "$outfile"
+fi
+
+# Might also try:
+# -vf "fps=${fps:-24},format=yuv420p" "$outfile"
+# but has given some problems.
A => ssh-select +10 -0
@@ 1,10 @@
+#!/usr/bin/env sh
+
+export FZF_DEFAULT_OPTS='
+--height=20%
+--reverse
+--prompt="SSH > "
+--preview="awk -v HOST={} -f ~/.ssh/bin/host2conf.awk ~/.ssh/config"'
+
+host=$(grep '^[[:space:]]*Host[[:space:]]' ~/.ssh/config | cut -d ' ' -f 2 | fzf)
+[ $? -eq 0 ] && ssh "$host"
A => statusbar/sb-battery +37 -0
@@ 1,37 @@
+#!/bin/sh
+
+# Prints all batteries, their percentage remaining and an emoji corresponding
+# to charge status (π for plugged up, π for discharging on battery, etc.).
+
+case $BLOCK_BUTTON in
+ 3) notify-send "π Battery module" "π: discharging
+π: not charging
+β»: stagnant charge
+π: charging
+β‘: charged
+β: battery very low!
+- Scroll to change adjust xbacklight." ;;
+ 4) xbacklight -inc 10 ;;
+ 5) xbacklight -dec 10 ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+# Loop through all attached batteries and format the info
+for battery in /sys/class/power_supply/BAT?*; do
+ # If non-first battery, print a space separator.
+ [ -n "${capacity+x}" ] && printf " "
+ # Sets up the status and capacity
+ case "$(cat "$battery/status" 2>&1)" in
+ "Full") status="β‘" ;;
+ "Discharging") status="π" ;;
+ "Charging") status="π" ;;
+ "Not charging") status="π" ;;
+ "Unknown") status="β»οΈ" ;;
+ *) exit 1 ;;
+ esac
+ capacity="$(cat "$battery/capacity" 2>&1)"
+ # Will make a warn variable if discharging and low
+ [ "$status" = "π" ] && [ "$capacity" -le 25 ] && warn="β"
+ # Prints the info
+ printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
+done && printf "\\n"
A => statusbar/sb-clock +29 -0
@@ 1,29 @@
+#!/bin/sh
+
+clock=$(date '+%I')
+
+case "$clock" in
+ "00") icon="π" ;;
+ "01") icon="π" ;;
+ "02") icon="π" ;;
+ "03") icon="π" ;;
+ "04") icon="π" ;;
+ "05") icon="π" ;;
+ "06") icon="π" ;;
+ "07") icon="π" ;;
+ "08") icon="π" ;;
+ "09") icon="π" ;;
+ "10") icon="π" ;;
+ "11") icon="π" ;;
+ "12") icon="π" ;;
+esac
+
+case $BLOCK_BUTTON in
+ 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
+ 2) setsid -f "$TERMINAL" -e calcurse ;;
+ 3) notify-send "π
Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
+- Middle click opens calcurse if installed" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+date "+%Y %b %d (%a) $icon%I:%M%p"
A => statusbar/sb-cpu +12 -0
@@ 1,12 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) notify-send "π₯ CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;;
+ 2) setsid -f "$TERMINAL" -e htop ;;
+ 3) notify-send "π₯ CPU module " "\- Shows CPU temperature.
+- Click to show intensive processes.
+- Middle click to open htop." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+sensors | awk '/Core 0/ {print "π‘" $3}'
A => statusbar/sb-cpubars +44 -0
@@ 1,44 @@
+#!/bin/sh
+
+# Module showing CPU load as a changing bars.
+# Just like in polybar.
+# Each bar represents amount of load on one core since
+# last run.
+
+# Cache in tmpfs to improve speed and reduce SSD load
+cache=/tmp/cpubarscache
+
+case $BLOCK_BUTTON in
+ 2) setsid -f "$TERMINAL" -e htop ;;
+ 3) notify-send "πͺ¨ CPU load module" "Each bar represents
+one CPU core";;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+# id total idle
+stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
+[ ! -f $cache ] && echo "$stats" > "$cache"
+old=$(cat "$cache")
+printf "πͺ¨"
+echo "$stats" | while read -r row; do
+ id=${row%% *}
+ rest=${row#* }
+ total=${rest%% *}
+ idle=${rest##* }
+
+ case "$(echo "$old" | awk '{if ($1 == id)
+ printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
+ id="$id" total="$total" idle="$idle")" in
+
+ "0") printf "β";;
+ "1") printf "β";;
+ "2") printf "β";;
+ "3") printf "β";;
+ "4") printf "β
";;
+ "5") printf "β";;
+ "6") printf "β";;
+ "7") printf "β";;
+ "8") printf "β";;
+ esac
+done; printf "\\n"
+echo "$stats" > "$cache"
A => statusbar/sb-disk +23 -0
@@ 1,23 @@
+#!/bin/sh
+
+# Status bar module for disk space
+# $1 should be drive mountpoint, otherwise assumed /.
+
+location=${1:-/}
+
+[ -d "$location" ] || exit
+
+case $BLOCK_BUTTON in
+ 1) notify-send "π½ Disk space" "$(df -h --output=target,used,size)" ;;
+ 3) notify-send "π½ Disk module" "\- Shows used hard drive space.
+- Click to show all disk info." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+case "$location" in
+ "/home"* ) icon="π " ;;
+ "/mnt"* ) icon="πΎ" ;;
+ *) icon="π₯";;
+esac
+
+printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
A => statusbar/sb-doppler +206 -0
@@ 1,206 @@
+#!/bin/sh
+
+# Show a Doppler RADAR of an American user's preferred location.
+
+secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds.
+radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar"
+doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif"
+
+pickloc() { chosen="$(echo "Northeast
+Southeast
+PacNorthWest
+PacSouthWest
+UpperMissVly
+SouthMissVly
+SouthPlains
+NorthRockies
+SouthRockies
+Alaska
+Carib
+Hawaii
+CentGrLakes
+Conus-Large
+KABR: Aberdeen, SD
+KBIS: Bismarck, ND
+KFTG: Denver/Boulder, CO
+KDMX: Des Moines, IA
+KDTX: Detroit, MI
+KDDC: Dodge City, KS
+KDLH: Duluth, MN
+KCYS: Cheyenne, WY
+KLOT: Chicago, IL
+KGLD: Goodland, KS
+KUEX: Hastings, NE
+KGJX: Grand Junction, CO
+KGRR: Grand Rapids, MI
+KMVX: Fargo/Grand Forks, ND
+KGRB: Green Bay, WI
+KIND: Indianapolis, IN
+KJKL: Jackson, KY
+KARX: La Crosse, WI
+KILX: Lincoln/Central Illinois, IL
+KLVX: Louisville, KY
+KMQT: Marquette
+KMKX: Milwaukee, WI
+KMPX: Minneapolis, MN
+KAPX: Gaylord/Alpena, MI
+KLNX: North Platte, NE
+KIWX: N. Webster/Northern, IN
+KOAX: Omaha, NE
+KPAH: Paducah, KY
+KEAX: Pleasant Hill, MO
+KPUX: Pueblo, CO
+KDVN: Quad Cities, IA
+KUDX: Rapid City, SD
+KRIW: Riverton, WY
+KSGF: Springfield, MO
+KLSX: St. LOUIS, MO
+KFSD: Sioux Falls, IA
+KTWX: Topeka, KS
+KICT: Wichita, KS
+KVWX: Paducah, KY
+ICAO: Responsible Wfo
+KLTX: WILMINGTON, NC
+KCCX: State College/Central, PA
+KLWX: Sterling, VA
+KFCX: Blacksburg/Roanoke, VA
+KRAX: Raleigh/Durham, NC
+KGYX: Portland, ME
+KDIX: Mt Holly/Philadelphia, PA
+KPBZ: Pittsburgh, PA
+KAKQ: Wakefield, VA
+KMHX: Morehead City, NC
+KGSP: Greer/Greenville/Sprtbg, SC
+KILN: Wilmington/Cincinnati, OH
+KCLE: Cleveland, OH
+KCAE: Columbia, SC
+KBGM: Binghamton, NY
+KENX: Albany, NY
+KBUF: Buffalo, NY
+KCXX: Burlington, VT
+KCBW: Caribou, ME
+KBOX: Boston /Taunton, MA
+KOKX: New York City, NY
+KCLX: Charleston, SC
+KRLX: Charleston, WV
+ICAO: Responsible WFO
+KBRO: Brownsville, TX
+KABX: Albuquerque, NM
+KAMA: Amarillo, TX
+KFFC: Peachtree City/Atlanta, GA
+KEWX: Austin/Sanantonio, TX
+KBMX: Birmingham, AL
+KCRP: Corpus Christi, TX
+KFWS: Dallas / Ft. Worth, TX
+KEPZ: El Paso, TX
+KHGX: Houston/ Galveston, TX
+KJAX: Jacksonville, FL
+KBYX: Key West, FL
+KMRX: Morristown/knoxville, TN
+KLBB: Lubbock, TX
+KLZK: Little Rock, AR
+KLCH: Lake Charles, LA
+KOHX: Nashville, TN
+KMLB: Melbourne, FL
+KNQA: Memphis, TN
+KAMX: Miami, FL
+KMAF: Midland/odessa, TX
+KTLX: Norman, OK
+KHTX: Huntsville, AL
+KMOB: Mobile, AL
+KTLH: Tallahassee, FL
+KTBW: Tampa Bay Area, FL
+KSJT: San Angelo, TX
+KINX: Tulsa, OK
+KSRX: Tulsa, OK
+KLIX: New Orleans/slidell, LA
+KDGX: Jackson, MS
+KSHV: Shreveport, LA
+ICAO: Responsible WFO
+KLGX: Seattle / Tacoma, WA
+KOTX: Spokane, WA
+KEMX: Tucson, AZ
+KYUX: Phoenix, AZ
+KNKX: San Diego, CA
+KMUX: Monterey/san Francisco, CA
+KHNX: San Joaquin/hanford, CA
+KSOX: San Diego, CA
+KATX: Seattle / Tacoma, WA
+KIWA: Phoenix, AZ
+KRTX: Portland, OR
+KSFX: Pocatello, ID
+KRGX: Reno, NV
+KDAX: Sacramento, CA
+KMTX: Salt Lake City, UT
+KPDT: Pendleton, OR
+KMSX: Missoula, MT
+KESX: Las Vegas, NV
+KVTX: Los Angeles, CA
+KMAX: Medford, OR
+KFSX: Flagstaff, AZ
+KGGW: Glasgow, MT
+KLRX: Elko, NV
+KBHX: Eureka, CA
+KTFX: Great Falls, MT
+KCBX: Boise, ID
+KBLX: Billings, MT
+KICX: Salt Lake City, UT
+ICAO: Responsible Wfo W/ MSCF
+PABC: Anchorage, AK
+PAPD: Fairbanks, AK
+PHKM: Honolulu, HI
+PAHG: Anchorage, AK
+PAKC: Anchorage, AK
+PAIH: Anchorage, AK
+PHMO: Honolulu, HI
+PAEC: Fairbanks, AK
+TJUA: San Juan, PR
+PACG: Juneau, AK
+PHKI: Honolulu, HI
+PHWA: Honolulu, HI
+ICAO: Responsible Wfo W/ MSCF
+KFDR: Norman, OK
+PGUA: Guam
+KBBX: Sacramento, CA
+KFDX: Albuquerque, NM
+KGWX: Jackson, MS
+KDOX: Wakefield, VA
+KDYX: San Angelo, TX
+KEYX: Las Vegas, NV
+KEVX: Mobile, AL
+KHPX: Paducah, KY
+KTYX: Burlington, VT
+KGRK: Dallas / Ft. Worth, TX
+KPOE: Lake Charles, LA
+KEOX: Tallahassee, FL
+KHDX: El Paso, TX
+KDFX: San Antonio, TX
+KMXX: Birmingham, AL
+KMBX: Bismarck, ND
+KVAX: Jacksonville, FL
+KJGX: Peachtree City/atlanta, GA
+KVNX: Norman, OK
+KVBX: Vandenberg Afb: Orcutt, CA" | dmenu -r -i -l 50 -p "Select a National Weather Service radar to use as default:" | sed "s/:.*//" | tr "[:lower:]" "[:upper:]")"
+
+# Sanity check of selection and ensure user did not escape.
+echo "$chosen" | grep -q "^[A-Z]\+$" && echo "$chosen" > "$radarloc" ;}
+
+getdoppler() {
+ loc="$(cat "$radarloc")"
+ notify-send "π¦οΈ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc."
+ curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;}
+
+showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" ;}
+
+case $BLOCK_BUTTON in
+ 1) [ ! -f "$radarloc" ] && pickloc && getdoppler
+ [ $(($(date '+%s') - $(stat -c %Y "$doppler"))) -gt "$secs" ] && getdoppler
+ showdoppler ;;
+ 2) pickloc && getdoppler && showdoppler ;;
+ 3) notify-send "πΊοΈ Doppler RADAR module" "\- Left click for local Doppler RADAR.
+- Middle click to update change RADAR location.
+After $secs seconds, new clicks will also automatically update the doppler RADAR." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+echo πΊοΈ
A => statusbar/sb-forecast +35 -0
@@ 1,35 @@
+#!/bin/sh
+
+# Displays todays precipication chance (β) and daily low (π₯Ά) and high (π).
+# Usually intended for the statusbar.
+
+# If we have internet, get a weather report from wttr.in and store it locally.
+# You could set up a shell alias to view the full file in a pager in the
+# terminal if desired. This function will only be run once a day when needed.
+weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport"
+getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;}
+
+# Some very particular and terse stream manipulation. We get the maximum
+# precipitation chance and the daily high and low from the downloaded file and
+# display them with coresponding emojis.
+showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" |
+ grep -wo "[0-9]*%" | sort -rn | sed "s/^/β/g;1q" | tr -d '\n')"
+sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " π₯Ά" $1 "Β°","π" $2 "Β°"}' ;}
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;;
+ 2) getforecast && showweather ;;
+ 3) notify-send "π Weather module" "\- Left click for full forecast.
+- Middle click to update forecast.
+β: Chance of rain/snow
+π₯Ά: Daily low
+π: Daily high" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+# The test if our forcecast is updated to the day. If it isn't download a new
+# weather report from wttr.in with the above function.
+[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
+ getforecast
+
+showweather
A => statusbar/sb-help-icon +17 -0
@@ 1,17 @@
+#!/bin/sh
+
+# The clickable help menu. Middle click to restart wm.
+
+# If dwm is running, use dwm's readme and restart.
+pidof dwm >/dev/null &&
+ READMEFILE=/usr/local/share/dwm/larbs.mom
+ restartwm() { pkill -HUP dwm ;} ||
+ restartwm() { i3 restart ;}
+
+case $BLOCK_BUTTON in
+ 1) groff -mom "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom}" -Tpdf | zathura - ;;
+ 2) restartwm ;;
+ 3) notify-send "β Help module" "\- Left click to open LARBS guide.
+- Middle click to refresh window manager." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac; echo "β"
A => statusbar/sb-internet +26 -0
@@ 1,26 @@
+#!/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
+β: wifi disabled
+π‘: no wifi connection
+πΆ: wifi connection with quality
+β: no ethernet
+π: ethernet working
+π: vpn is active
+" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
+ wifiicon="$(awk '/^\s*w/ { print "πΆ", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
+elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
+ grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="π‘ " || wifiicon="β "
+fi
+
+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)"
A => statusbar/sb-iplocate +10 -0
@@ 1,10 @@
+#!/bin/sh
+
+# Gets your public ip address checks which country you are in and
+# displays that information in the statusbar
+#
+# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
+
+ifinstalled "geoip" || exit
+addr="$(curl ifconfig.me 2>/dev/null)" || exit
+grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
A => statusbar/sb-kbselect +16 -0
@@ 1,16 @@
+#!/bin/sh
+# works on any init system
+# requirements: dmenu, xorg-setxkbmap
+kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1
+
+case $BLOCK_BUTTON in
+ 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)"
+ kb="$(echo "$kb_choice" | awk '{print $3}')"
+ setxkbmap "$kb"
+ pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";;
+ 3) notify-send "β¨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')")
+- Left click to change keyboard.";;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+echo "$kb"
A => statusbar/sb-mailbox +20 -0
@@ 1,20 @@
+#!/bin/sh
+
+# Displays number of unread mail and an loading icon if updating.
+# When clicked, brings up `neomutt`.
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e neomutt ;;
+ 2) setsid -f mw -Y >/dev/null ;;
+ 3) notify-send "π¬ Mail module" "\- Shows unread mail
+- Shows π if syncing mail
+- Left click opens neomutt
+- Middle click syncs mail" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
+
+pidof mbsync >/dev/null 2>&1 && icon="π"
+
+[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "π¬$unread$icon"
A => statusbar/sb-memory +12 -0
@@ 1,12 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) notify-send "π§ Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
+ 2) setsid -f "$TERMINAL" -e htop ;;
+ 3) notify-send "π§ Memory module" "\- Shows Memory Used/Total.
+- Click to show memory hogs.
+- Middle click to open htop." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+free --mebi | sed -n '2{p;q}' | awk '{printf ("π§ %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
A => statusbar/sb-moonphase +37 -0
@@ 1,37 @@
+#!/bin/sh
+
+# Shows the current moon phase.
+
+moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
+
+[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
+ { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;}
+
+icon="$(cat "$moonfile")"
+
+case "$icon" in
+ π) name="New" ;;
+ π) name="Waxing Crescent" ;;
+ π) name="First Quarter" ;;
+ π) name="Waxing Gibbous" ;;
+ π) name="Full" ;;
+ π) name="Waning Gibbous" ;;
+ π) name="Last Quarter" ;;
+ π) name="Waning Crescent" ;;
+ *) exit 1 ;;
+esac
+
+echo "${icon-?}"
+
+case $BLOCK_BUTTON in
+ 3) notify-send "π Moon phase module" "Displays current moon phase.
+- π: New
+- π: Waxing Crescent
+- π: First Quarter
+- π: Waxing Gibbous
+- π: Full
+- π: Waning Gibbous
+- π: Last Quarter
+- π: Waning Crescent" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
A => statusbar/sb-mpdup +8 -0
@@ 1,8 @@
+#!/bin/sh
+
+# This loop will update the mpd statusbar module whenever a command changes the
+# music player's status. mpd must be running on X's start for this to work.
+
+while : ; do
+ mpc idle >/dev/null && kill -45 "$(pidof "${STATUSBAR:-dwmblocks}")" || break
+done
A => statusbar/sb-music +19 -0
@@ 1,19 @@
+#!/bin/sh
+
+filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/βΈ/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;}
+
+pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
+
+case $BLOCK_BUTTON in
+ 1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause
+ 2) mpc toggle | filter ;; # right click, pause/unpause
+ 3) mpc status | filter ; notify-send "π΅ Music module" "\- Shows mpd song playing.
+- βΈ when paused.
+- Left click opens ncmpcpp.
+- Middle click pauses.
+- Scroll changes track.";; # right click, pause/unpause
+ 4) mpc prev | filter ;; # scroll up, previous
+ 5) mpc next | filter ;; # scroll down, next
+ 6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;;
+ *) mpc status | filter ;;
+esac
A => statusbar/sb-nettraf +29 -0
@@ 1,29 @@
+#!/bin/sh
+
+# Module showing network traffic. Shows how much data has been received (RX) or
+# transmitted (TX) since the previous time this script ran. So if run every
+# second, gives network traffic per second.
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e bmon ;;
+ 3) notify-send "π Network traffic module" "π»: Traffic received
+πΊ: Traffic transmitted" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+update() {
+ sum=0
+ for arg; do
+ read -r i < "$arg"
+ sum=$(( sum + i ))
+ done
+ cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
+ [ -f "$cache" ] && read -r old < "$cache" || old=0
+ printf %d\\n "$sum" > "$cache"
+ printf %d\\n $(( sum - old ))
+}
+
+rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
+tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
+
+printf "π»%4sB πΊ%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
A => statusbar/sb-news +17 -0
@@ 1,17 @@
+#!/bin/sh
+
+# Displays number of unread news items and an loading icon if updating.
+# When clicked, brings up `newsboat`.
+
+case $BLOCK_BUTTON in
+ 1) setsid "$TERMINAL" -e newsboat ;;
+ 2) setsid -f newsup >/dev/null exit ;;
+ 3) notify-send "π° News module" "\- Shows unread news items
+- Shows π if updating with \`newsup\`
+- Left click opens newsboat
+- Middle click syncs RSS feeds
+<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+ cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "π°" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)"
A => statusbar/sb-pacpackages +29 -0
@@ 1,29 @@
+#!/bin/sh
+
+# Displays number of upgradeable packages.
+# For this to work, have a `pacman -Sy` command run in the background as a
+# cronjob every so often as root. This script will then read those packages.
+# When clicked, it will run an upgrade via pacman.
+#
+# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook:
+#
+# [Trigger]
+# Operation = Upgrade
+# Type = Package
+# Target = *
+#
+# [Action]
+# Description = Updating statusbar...
+# When = PostTransaction
+# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e sb-popupgrade ;;
+ 2) notify-send "$(/usr/bin/pacman -Qu)" ;;
+ 3) notify-send "π Upgrade module" "π¦: number of upgradable packages
+- Left click to upgrade packages
+- Middle click to show upgradable packages" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/π¦/;s/^π¦0$//g"
A => +9 -0
@@ 1,9 @@
#!/bin/sh
printf "Beginning upgrade.\\n"
yay -Syu
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
read -r _
A => statusbar/sb-price +41 -0
@@ 1,41 @@
+#!/bin/sh
+
+# Usage:
+# price <url> <Name of currency> <icon> <Price to show in>
+# price bat "Basic Attention Token" π¦
+# When the name of the currency is multi-word, put it in quotes.
+
+[ -z "$3" ] && exit 1
+
+# use $4 as currency, if not passed in use "usd" as default
+currency="${4:-usd}"
+interval="@14d" # History contained in chart preceded by '@' (7d = 7 days)
+dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices"
+pricefile="$dir/$1"
+chartfile="$dir/$1-chart"
+
+updateprice() { ping -q -c 1 example.org >/dev/null 2>&1 &&
+ curl -s "$currency.rate.sx/1$1" > "$pricefile" &&
+ curl -s "$currency.rate.sx/$1$interval" > "$chartfile" ;}
+
+[ -d "$dir" ] || mkdir -p "$dir"
+
+[ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
+ updateprice "$1"
+
+case $BLOCK_BUTTON in
+ 1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;;
+ 2) notify-send -u low "$3 Updating..." "Updating $2 price..."
+ updateprice "$1" && notify-send "$3 Update complete." "$2 price is now
+\$$(cat "$pricefile")" ;;
+ 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")"
+ notify-send "$3 $2 module" "\- <b>Exact price: \$$(cat "$pricefile")</b>
+- Left click for chart of changes.
+- Middle click to update.
+- Shows π if updating prices.
+- <b>Last updated:
+ $uptime</b>" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+printf "$3%0.2f$currency" "$(cat "$pricefile")"
A => statusbar/sb-tasks +20 -0
@@ 1,20 @@
+#!/bin/sh
+
+# Originally by Andr3as07 <https://github.com/Andr3as07>
+# Some changes by Luke
+# Rebuild by Tenyun
+
+# This block displays the number running background tasks. Requires tsp.
+
+num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}')
+
+# Handle mouse clicks
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e tsp -l ;;
+ 3) notify-send "Tasks module" "π€: number of running/queued background tasks
+- Left click opens tsp" ;; # Right click
+ 2) $EDITOR "$0" ;; # Middle click
+esac
+
+[ "$num" != "0(0)" ] &&
+ echo "π€$num"
A => statusbar/sb-torrent +27 -0
@@ 1,27 @@
+#!/bin/sh
+
+transmission-remote -l | grep % |
+ sed " # The letters are for sorting and will not appear.
+ s/.*Stopped.*/A π/;
+ s/.*Seeding.*/Z π±/;
+ s/.*100%.*/N β
/;
+ s/.*Idle.*/B π°οΈ/;
+ s/.*Uploading.*/L β¬οΈ/;
+ s/.*%.*/M β¬οΈ/" |
+ sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' -
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e tremc ;;
+ 2) td-toggle ;;
+ 3) notify-send "π± Torrent module" "\- Left click to open tremc.
+- Middle click to toggle transmission.
+- Shift click to edit script.
+Module shows number of torrents:
+π: paused
+π°: idle (seeds needed)
+πΌ: uploading (unfinished)
+π½: downloading
+β
: done
+π±: done and seeding" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
A => statusbar/sb-volume +28 -0
@@ 1,28 @@
+#!/bin/sh
+
+# Prints the current volume or π if muted.
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e pulsemixer ;;
+ 2) pamixer -t ;;
+ 4) pamixer --allow-boost -i 1 ;;
+ 5) pamixer --allow-boost -d 1 ;;
+ 3) notify-send "π’ Volume module" "\- Shows volume π, π if muted.
+- Middle click to mute.
+- Scroll to change." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+[ $(pamixer --get-mute) = true ] && echo π && exit
+
+vol="$(pamixer --get-volume)"
+
+if [ "$vol" -gt "70" ]; then
+ icon="π"
+elif [ "$vol" -lt "30" ]; then
+ icon="π"
+else
+ icon="π"
+fi
+
+echo "$icon$vol%"
A => sysact +18 -0
@@ 1,18 @@
+#!/bin/sh
+# A dmenu wrapper script for system functions.
+case "$(readlink -f /sbin/init)" in
+ *systemd*) ctl='systemctl' ;;
+ *) ctl='loginctl' ;;
+esac
+
+case "$(printf "π lock\nπͺ leave dwm\nβ»οΈ renew dwm\nπ» hibernate\nπ€ sleep\nπ reboot\nπ₯οΈshutdown\nπΊ display off" | dmenu -i -p 'Action: ')" in
+ 'π lock') slock ;;
+ 'πͺ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
+ 'β»οΈ renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
+ 'π» hibernate') slock $ctl hibernate ;;
+ 'π€ sleep') slock $ctl suspend ;;
+ 'π reboot') $ctl reboot ;;
+ 'π₯οΈshutdown') $ctl poweroff ;;
+ 'πΊ display off') xset dpms force off ;;
+ *) exit 1 ;;
+esac
A => tag +67 -0
@@ 1,67 @@
+#!/bin/sh
+
+err() { echo "Usage:
+ tag [OPTIONS] file
+Options:
+ -a: artist/author
+ -t: song/chapter title
+ -A: album/book title
+ -n: track/chapter number
+ -N: total number of tracks/chapters
+ -d: year of publication
+ -g: genre
+ -c: comment
+You will be prompted for title, artist, album and track if not given." && exit 1 ;}
+
+while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in
+ a) artist="${OPTARG}" ;;
+ t) title="${OPTARG}" ;;
+ A) album="${OPTARG}" ;;
+ n) track="${OPTARG}" ;;
+ N) total="${OPTARG}" ;;
+ d) date="${OPTARG}" ;;
+ g) genre="${OPTARG}" ;;
+ c) comment="${OPTARG}" ;;
+ f) file="${OPTARG}" ;;
+ *) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
+esac done
+
+shift $((OPTIND - 1))
+
+file="$1"
+
+[ ! -f "$file" ] && echo "Provide file to tag." && err
+
+[ -z "$title" ] && echo "Enter a title." && read -r title
+[ -z "$artist" ] && echo "Enter an artist." && read -r artist
+[ -z "$album" ] && echo "Enter an album." && read -r album
+[ -z "$track" ] && echo "Enter a track number." && read -r track
+
+case "$file" in
+ *.ogg) echo "Title=$title
+Artist=$artist
+Album=$album
+Track=$track
+Total=$total
+Date=$date
+Genre=$genre
+Comment=$comment" | vorbiscomment -w "$file" ;;
+ *.opus) echo "Title=$title
+Artist=$artist
+Album=$album
+Track=$track
+Total=$total
+Date=$date
+Genre=$genre
+Comment=$comment" | opustags -i -S "$file" ;;
+ *.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
+ *.flac) echo "TITLE=$title
+ARTIST=$artist
+ALBUM=$album
+TRACKNUMBER=$track
+TOTALTRACKS=$total
+DATE=$date
+GENRE=$genre
+DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;;
+ *) echo "File type not implemented yet." ;;
+esac
A => td-toggle +12 -0
@@ 1,12 @@
+#!/bin/sh
+
+# If transmission-daemon is running, will ask to kill, else will ask to start.
+
+if pidof transmission-daemon >/dev/null ;
+then
+ [ "$(printf "No\\nYes" | dmenu -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon disabled."
+else
+ ifinstalled transmission-cli || exit
+ [ "$(printf "No\\nYes" | dmenu -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "transmission-daemon enabled."
+fi
+sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}"
A => texclear +16 -0
@@ 1,16 @@
+#!/bin/sh
+
+# Clears the build files of a LaTeX/XeLaTeX build.
+# I have vim run this file whenever I exit a .tex file.
+
+case "$1" in
+ *.tex)
+ file=$(readlink -f "$1")
+ dir=$(dirname "$file")
+ base="${file%.*}"
+ find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyg|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete
+ rm -rdf "$dir/_minted-$(basename -- $base)"
+ ;;
+ *) printf "Give .tex file as argument.\\n" ;;
+esac
+
A => torwrap +7 -0
@@ 1,7 @@
+#!/bin/sh
+
+ifinstalled tremc transmission-cli || exit
+
+! pidof transmission-daemon >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..."
+
+$TERMINAL -e tremc; pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}"
A => transadd +9 -0
@@ 1,9 @@
+#!/bin/sh
+
+# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running.
+
+# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep.
+
+pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}")
+
+transmission-remote -a "$@" && notify-send "π½ Torrent added."
A => tutorialvids +26 -0
@@ 1,26 @@
+#!/bin/sh
+
+# This gives the user a list of videos they can select and watch without a
+# browser. If you want to check a tutorial video, it makes it easy. I'll
+# add/remove videos from this list as I go on.
+
+vidlist="
+dwm (window manager) https://videos.lukesmith.xyz/videos/watch/f6b78db7-b368-4647-bc64-28c08fff1988
+pacman (installing/managing programs) https://videos.lukesmith.xyz/videos/watch/8e7cadb9-0fed-47ce-a2a8-6635fa48614b
+status bar https://videos.lukesmith.xyz/videos/watch/a4d5326b-0aac-496e-bfc3-5acd5cee89f0
+sxiv (image viewer) https://videos.lukesmith.xyz/videos/watch/ad4c8d85-90c3-4f3d-a1f3-89129e64a3c2
+st (terminal) https://videos.lukesmith.xyz/videos/watch/efddd39d-bac5-4599-b572-177beb4ce6e8
+i3 (old window manager) https://videos.lukesmith.xyz/videos/watch/b861525c-7ada-40ee-a2bb-b5e1ffe0f48b
+neomutt (email) https://videos.lukesmith.xyz/videos/watch/83122e83-52d9-4278-ae1a-7d1beeb50c8e
+ncmpcpp (music player) https://videos.lukesmith.xyz/videos/watch/b5ac6f0d-a220-4433-88e3-e98fc791dc0a
+newsboat (RSS reader) https://videos.lukesmith.xyz/videos/watch/bd2c3fff-40fa-47ea-aa98-5b1ec0c903b6
+ranger (file manager) https://videos.lukesmith.xyz/videos/watch/785d914f-8cbd-4a3d-a1f6-d75675fc7549
+zathura (pdf viewer) https://videos.lukesmith.xyz/videos/watch/c780f75a-11f6-48a9-a191-d079ebc36ea4
+gpg keys https://videos.lukesmith.xyz/videos/watch/040f5530-4830-4583-9ddc-2080b421531b
+calcurse (calendar) https://videos.lukesmith.xyz/videos/watch/4b937e8b-7654-46e3-8d01-79392ec5b3d1
+urlview https://videos.lukesmith.xyz/videos/watch/31a4918f-633b-4bd6-b08e-956ac75d0324
+colorschemes with pywal https://videos.lukesmith.xyz/videos/watch/1b476003-61b2-4609-ac4b-820c3d128643
+vi mode in shell https://videos.lukesmith.xyz/videos/watch/228aa50c-836f-456f-9f0d-a45157fe4313
+pass (password manager) https://videos.lukesmith.xyz/videos/watch/432fc942-5e28-4682-9beb-f5cb237a1dd6
+"
+echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 20 | awk '{print $1}')\s" | sed 's/.*\t//' | xargs -r mpv
A => unix +26 -0
@@ 1,26 @@
+#!/bin/sh
+
+#original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes
+#converted to shell by #nixers @ irc.unix.chat
+
+cat << 'eof'
+ [38;5;255m,_ ,_==ββ[0m
+ [38;5;255m, βββββ
β
[48;5;240mβ
[48;5;20mβ[48;5;240mβ
ΒΎ[0m. [38;5;199m/ [38;5;20m/[0m
+ [38;5;255m[48;5;20mβ[0m[38;5;255m[48;5;199mβ[38;5;16m[48;5;255m<Β΄ [38;5;32m"[38;5;34mΒ»[38;5;255mββ[48;5;32mβ[48;5;240m%[0m\ [38;5;199m/ [38;5;20m/ [38;5;45m/ [38;5;118m/[0m
+ [38;5;255m,[38;5;255m[48;5;240mβ
[38;5;16m[48;5;255m7" [38;5;160mΒ΄[38;5;34m>[38;5;255m[48;5;39mββ[38;5;199m[48;5;255mβ[0m[38;5;255m% [38;5;20m/ [38;5;118m/ [38;5;199m> [38;5;118m/ [38;5;199m>[38;5;255m/[38;5;45m%[0m
+ [38;5;255mβ[48;5;240m[38;5;255mΒΆ[48;5;240m[38;5;255mβ[48;5;255m [38;5;196m,[38;5;34mΒ»[48;5;201m[38;5;255mββ[0m[38;5;255mΒΎΒ΄[0m [38;5;199m/[38;5;255m> %[38;5;199m/[38;5;118m%[38;5;255m/[38;5;199m/ [38;5;45m/ [38;5;199m/[0m
+ [38;5;255m[48;5;240mβ[48;5;255m[38;5;16mβ[48;5;16m[38;5;255mβ
β
[38;5;16m[48;5;255mβ
β,,[38;5;32mβ[38;5;16mβ
[38;5;255m[48;5;16mβ
β
[38;5;255m[48;5;20mΓ[0m[38;5;255m\[0m[38;5;20m/[38;5;118m/[38;5;255m /[38;5;118m/[38;5;199m/[38;5;255m>[38;5;45m// [38;5;255m/[38;5;118m>[38;5;199m/ [38;5;20m/[0m
+ [48;5;20m[38;5;255mV[48;5;255m[38;5;16mβ[48;5;20m[38;5;255mΒ«[0m[38;5;255mΒΌ.;[48;5;240m[38;5;255mβ[48;5;255m[38;5;16m β[0m[38;5;255m<Β«.,[48;5;25m[38;5;255m`[48;5;240m=[0m[38;5;20m/[38;5;199m/ [38;5;255m/>[38;5;45m/[38;5;118m/[38;5;255m%/[38;5;199m% / [38;5;20m/[0m
+ [38;5;20m//[48;5;255m[38;5;16mβ <Β΄ -Β²,)[48;5;16m[38;5;255m(β[48;5;255m[38;5;16m~"-[38;5;199mβ/[0m[38;5;255mΒΎ[0m[38;5;199m/ [38;5;118m%[38;5;255m/[38;5;118m>[38;5;45m/ [38;5;118m/[38;5;199m>[0m
+ [38;5;20m/ / [38;5;118m/ [48;5;20m[38;5;255mβ[48;5;240m[38;5;16m%[48;5;255m -./βββ[48;5;16m[38;5;255mβ
[48;5;255m[38;5;16mβ[48;5;255m[38;5;16m, [38;5;199m/[48;5;199m[38;5;255m7[0m[38;5;20m/[38;5;199m/[38;5;255m;/[38;5;199m/[38;5;118m% [38;5;20m/ /[0m
+ [38;5;20m/ [38;5;199m/[38;5;255m/[38;5;45m/[38;5;118m/[38;5;255m[48;5;240m`[48;5;20m[38;5;255mβ[48;5;20m[38;5;255mβ[48;5;255m[38;5;16m %z[0m[38;5;255mWv xX[48;5;20m[38;5;255mβ[48;5;34m[38;5;255mβ[48;5;199m[38;255mβ[0m[38;5;20m/[38;5;199m/[38;5;255m&;[38;5;20m% [38;5;199m/ [38;5;20m/[0m
+ [38;5;20m/ / [38;5;255m/ [38;5;118m%[38;5;199m/[38;5;255m/%/[48;5;240m[38;5;255mΒΎ[48;5;255m[38;5;16mΒ½Β΄[38;5;255m[48;5;16mβ[0m[38;5;246mββ[38;5;255mββ[38;5;246mβββ[0m[48;5;16m[38;5;255mβ[38;5;255m[48;5;199mΒΆ[48;5;20m[38;5;255m\[0m[38;5;20m/[0m[48;5;255m[38;5;240m&[0m [38;5;20m/[0m
+ [38;5;199m<[38;5;118m/ [38;5;45m/[38;5;255m</[38;5;118m%[38;5;255m/[38;5;45m/[38;5;255m`[48;5;16mβ[48;5;255m[38;5;16m![48;5;240m[38;5;255m%[48;5;16m[38;5;255mβ[0m[38;5;255m%[48;5;240m[38;5;255mβ£[48;5;240m[38;5;255;β£[0m[38;5;255mW[0m[38;5;250mY<Y)[48;5;255m[38;5;16my&[0m[38;5;255m/`[48;5;240m\[0m
+ [38;5;20m/ [38;5;199m/ [38;5;199m%[38;5;255m/%[38;5;118m/[38;5;45m/[38;5;255m<[38;5;118m/[38;5;199m%[38;5;45m/[38;5;20m/[48;5;240m[38;5;255m\[38;5;16m[48;5;255mi7; β N[0m[38;5;246m>[38;5;255m)VY>[48;5;240m[38;5;255m7[0m[38;5;255m; [38;5;255m[48;5;240m\[0m[38;5;255m_[0m [38;5;255mUNIX IS VERY SIMPLE [38;5;45mIT JUST NEEDS A[0m
+ [38;5;20m/ [38;5;255m/[38;5;118m<[38;5;255m/ [38;5;45m/[38;5;255m/<[38;5;199m/[38;5;20m/[38;5;199m/[38;5;20m<[38;5;255m_/%\[38;5;255m[48;5;16mβ[48;5;255m[38;5;16m V[0m[38;5;255m%[48;5;255m[38;5;16mW[0m[38;5;255m%Β£)XY[0m [38;5;240m_/%[38;5;255mβΎ\_,[0m [38;5;45mGENIUS TO UNDERSTAND ITS SIMPLICITY[38;5;255m[0m
+ [38;5;199m/ [38;5;255m/ [38;5;199m/[38;5;255m/[38;5;118m%[38;5;199m/[48;5;240m[38;5;255m_,=-[48;5;20m-^[0m[38;5;255m/%/%%[48;5;255m[38;5;16m\ΒΎ%[0m[38;5;255mΒΆ[0m[48;5;255m[38;5;16m%[0m[38;5;255m%}[0m [38;5;240m/%%%[38;5;20m%%[38;5;240m%;\,[0m
+ [38;5;45m%[38;5;20m/[38;5;199m< [38;5;20m/[48;5;20m[38;5;255m_/[48;5;240m [0m[38;5;255m%%%[38;5;240m%%[38;5;20m;[38;5;255mX[38;5;240m%[38;5;20m%[38;5;255m\%[38;5;240m%;, _/%%%;[38;5;20m,[38;5;240m \[0m
+ [38;5;118m/ [38;5;20m/ [38;5;240m%[38;5;20m%%%%[38;5;240m%;, [38;5;255m\[38;5;240m%[38;5;20m%[38;5;255ml[38;5;240m%%;// _/[38;5;20m%;,[0m [38;5;234mdmr[0m
+ [38;5;20m/ [38;5;240m%[38;5;20m%%;,[0m [38;5;255m<[38;5;20m;[38;5;240m\-=-/ /[0m
+ [38;5;20m;,[0m [38;5;240ml[0m
+eof