summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '.local')
-rw-r--r--.local/bin/SCRIPTS.md87
-rw-r--r--.local/bin/cron/IMPORTANT_NOTE.md11
-rwxr-xr-x.local/bin/cron/checkup18
-rwxr-xr-x.local/bin/cron/cronbat8
-rwxr-xr-x.local/bin/cron/crontog5
-rwxr-xr-x.local/bin/cron/newsup16
-rwxr-xr-x.local/bin/i3cmds/cabl26
-rwxr-xr-x.local/bin/i3cmds/camtoggle2
-rwxr-xr-x.local/bin/i3cmds/ddspawn19
-rwxr-xr-x.local/bin/i3cmds/displayselect73
-rwxr-xr-x.local/bin/i3cmds/dmenumount59
-rwxr-xr-x.local/bin/i3cmds/dmenurecord105
-rwxr-xr-x.local/bin/i3cmds/dmenuumount41
-rwxr-xr-x.local/bin/i3cmds/dmenuunicode18
-rwxr-xr-x.local/bin/i3cmds/dropdowncalc2
-rwxr-xr-x.local/bin/i3cmds/ducksearch20
-rwxr-xr-x.local/bin/i3cmds/hover14
-rwxr-xr-x.local/bin/i3cmds/i3resize27
-rwxr-xr-x.local/bin/i3cmds/killrecording7
-rwxr-xr-x.local/bin/i3cmds/maimpick9
-rwxr-xr-x.local/bin/i3cmds/prompt7
-rwxr-xr-x.local/bin/i3cmds/samedir5
-rwxr-xr-x.local/bin/i3cmds/showclip10
-rwxr-xr-x.local/bin/i3cmds/td-toggle10
-rwxr-xr-x.local/bin/i3cmds/tmuxdd4
-rwxr-xr-x.local/bin/i3cmds/toggletouchpad4
-rwxr-xr-x.local/bin/i3cmds/torwrap6
-rwxr-xr-x.local/bin/i3cmds/tutorialvids18
-rwxr-xr-x.local/bin/i3cmds/winresize2
-rw-r--r--.local/bin/larbs.pngbin0 -> 47351 bytes
-rwxr-xr-x.local/bin/statusbar/battery32
-rwxr-xr-x.local/bin/statusbar/clock10
-rwxr-xr-x.local/bin/statusbar/cpu10
-rwxr-xr-x.local/bin/statusbar/disk18
-rwxr-xr-x.local/bin/statusbar/help7
-rwxr-xr-x.local/bin/statusbar/internet17
-rwxr-xr-x.local/bin/statusbar/iplocate9
-rwxr-xr-x.local/bin/statusbar/mailbox16
-rwxr-xr-x.local/bin/statusbar/memory9
-rwxr-xr-x.local/bin/statusbar/mpdupdate8
-rwxr-xr-x.local/bin/statusbar/music18
-rwxr-xr-x.local/bin/statusbar/news17
-rwxr-xr-x.local/bin/statusbar/pacpackages18
-rwxr-xr-x.local/bin/statusbar/popupgrade9
-rwxr-xr-x.local/bin/statusbar/torrent28
-rwxr-xr-x.local/bin/statusbar/volume25
-rwxr-xr-x.local/bin/statusbar/weather23
-rwxr-xr-x.local/bin/tools/compiler37
-rwxr-xr-x.local/bin/tools/dmenuhandler15
-rwxr-xr-x.local/bin/tools/dmenupass2
l---------.local/bin/tools/ext1
-rwxr-xr-x.local/bin/tools/extract41
-rwxr-xr-x.local/bin/tools/getbib14
-rwxr-xr-x.local/bin/tools/getkeys4
-rwxr-xr-x.local/bin/tools/ifinstalled3
-rwxr-xr-x.local/bin/tools/linkhandler22
-rwxr-xr-x.local/bin/tools/lmc42
-rwxr-xr-x.local/bin/tools/opout11
-rwxr-xr-x.local/bin/tools/pauseallmpv4
-rwxr-xr-x.local/bin/tools/podentr6
-rwxr-xr-x.local/bin/tools/qndl11
-rwxr-xr-x.local/bin/tools/queueandnotify13
-rwxr-xr-x.local/bin/tools/remaps10
-rwxr-xr-x.local/bin/tools/rotdir4
-rwxr-xr-x.local/bin/tools/rssadd9
-rwxr-xr-x.local/bin/tools/setbg4
-rwxr-xr-x.local/bin/tools/shortcuts26
-rwxr-xr-x.local/bin/tools/texclear14
-rwxr-xr-x.local/bin/tools/transadd9
-rwxr-xr-x.local/bin/tools/vifmimg13
-rwxr-xr-x.local/bin/tools/vu15
-rw-r--r--.local/bin/ttymaps.kmap2
-rwxr-xr-x.local/bin/unix25
-rw-r--r--.local/share/larbs/readme.mom8
74 files changed, 1268 insertions, 4 deletions
diff --git a/.local/bin/SCRIPTS.md b/.local/bin/SCRIPTS.md
new file mode 100644
index 0000000..08bca91
--- /dev/null
+++ b/.local/bin/SCRIPTS.md
@@ -0,0 +1,87 @@
+# Directory of Scripts
+
+I keep all my user-created scripts here in `~/.local/bin/`. Scripts are sorted
+into sub-directories for easy management, and all are seamlessly added to
+`$PATH` with the command below in `~/.profile`:
+
+```
+export PATH="$(du $HOME/.local/bin/ | cut -f2 | tr '\n' ':')$PATH"
+```
+
+## `statusbar/`
+
+For modules used in i3blocks.
+
+- `battery` -- i3blocks module. Shows available power remaining with icon indicating battery status. Colors indicate different levels of charge.
+- `clock` -- Shows time and date. If clicked, brings up calender or coming calcuse events.
+- `cpu` -- Shows CPU temperature. If clicked, shows most processor-intensive processes.
+- `help` -- Module which appears as a question mark. Brings up readme if clicked.
+- `internet` -- Shows whether machine is connected to wifi and ethernet. If clicked, brings up `nmtui`.
+- `mailbox` -- i3blocks module for use with mutt-wizard. Shows unread mail and if `mailsync.sh` is running.
+- `mem` -- Shows memory usage. If clicked, shows most memory-intensive processes.
+- `music` -- i3blocks module. Shows current song; if paused, name will be grayed and italic.
+- `mpdupdate` -- A daemon running by default that will update the i3mpd block on mpd change.
+- `news` -- Shows unread newsboat articles. Brings up newsboat or refreshes RSS feeds.
+- `pacpackages` -- i3blocks module. Detects new installable upgrades. Only works if you use cronjobs to automatically sync repositories.
+- `popupgrade` -- Called by clicking on the update icon if there are new packages. Spawns a `yay` upgrade of the main Arch repos and AUR packages, updates the i3blocks module once complete.
+- `torrent` -- i3blocks module. Shows torrents idle (βŒ›οΈ), downloading (⬇️) or finished (🌱).
+- `volume` -- i3blocks module. Shows volume percentage or mute notification.
+- `weather` -- i3blocks module. Gets weather forcast from wttr.in and returns today's precipitation chance (β˜”), daily low (❄️) and daily high (β˜€οΈ).
+
+## `cron/`
+
+For scripts meant to be cronjobs. None are active by default on LARBS.
+
+- `checkup` -- If connected to internet, syncs package repositories and downloads (but does not install) any potential updates. Gives `notify-send` notifications of when it is active since other `pacman` install commands cannot be run simultaneously. You may need to grant your user the ability to run `pacman -Syyuw --noconfirm` without a password (done in `/etc/sudoers`).
+- `cronbat` -- Gives a dunst notification if the battery is less than 25%.
+- `crontog` -- Not actually a cronjob, but just turns off/on all user cronjobs.
+- `getforecast` -- Updates the weather forecast. This is automatically run by `weather` if there hasn't been a new forecast today.
+- `newsup` -- Updates newsboat RSS feeds if connected to internet. Will also display a newspaper update icon on i3blocks if it has not be user disabled.
+
+## `tools/`
+
+Scripts intended to be run either manually by the user or linked to a shortcut
+in vim or another program.
+
+- `compiler` -- Compiles a markdown, R markdown or LaTeX document with the approriate command. Will also run `make && sudo make install` if in a `config.h` file. Otherwise it will create a sent presentation. This can be thought of a general output handler. I have it bound to `<leader>c` in vim.
+- `dmenuhandler` -- Give this script a url and it will offer dmenu options for opening it. Used by `newsboat` and some other programs as a link handler.
+- `extract` -- Will detect file type of archive and run appropriate extraction command.
+- `getbib` -- Use crossref.org to automatically detect bibtex entry of a .pdf. Attempts to search for the .pdf's DOI. Returns nothing if none detected.
+- `getkeys` -- Get the LARBS documentation on what bindings exist for main programs.
+- `linkhandler` -- The automatic link handler used by `newsboat` and other programs. Urls of video sites or of video files are opened in `mpv`, images are downloaded/opened in `feh`, music files are downloaded with `wget` and all other urls are opened in the default browser.
+- `lmc` -- A music controller that simplifies music/audio management and improves the interface with i3blocks. Check inside to see what it does. This is what i3 audio/music commands run by default. If you use a difference music system or ALSA, you can change this script rather than changing all the shortcuts in different places.
+- `note` -- Give this script some text/a message as an argument. It will print it to the terminal, and if `dunst` is running, display a notification.
+- `opout` -- "Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or `.rmd` file, or if given an `.html` file, will open it in the browser. Bound to `<leader>p` in my vim config to reveal typical output.
+- `pauseallmpv` -- Pauses all mpv instances by sending the `,` key to each. Used by several scripts, but can be used alone as well. It will not pause an audio only mpv instance. If you know how to add a hack to do this, feel free to PR it or email me an addition.
+- `remaps` -- Remaps capslock to escape when pressed and super/mod when held. Maps the menu key to super as well. Runs the US international keyboard setup. If you want another keyboard setup, edit this fine.
+- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.config/bmdirs` and `~/.config/bmfiles` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.config/shortcutrc` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.bm*` files.
+- `speedvid` -- Speed up a given video file (`$1`) by a given ammount (`$2`).
+- `tpb` -- Search Pirate Bay for the certain search terms given as arguments.
+- `texclear` -- Remove all `.tex` related build files. This is run by my vim when I stop editing any `.tex` file.
+- `transadd` -- The mimeapp default script for handling torrent magnet links. Starts `transmission-daemon` if not running and adds the link.
+
+## `i3cmds`
+
+These are scripts linked to bindings in i3. They typically perform
+user-interface actions or involve dmenu.
+
+- `bottomleft` and `bottomright` -- Makes the currently selected window float in one of the bottom corners of the screen. `bottomleft` is bound to `mod+B` by default.
+- `camtoggle` -- Starts/kills /dev/video0 webcam. Placed in bottom right by default.
+- `ddspawn` -- This is the script called to create, show and hide the dropdown tmux terminal mapped to `mod+u`, but also the dropdown calculator mapped to `mod+a`. Give the script an argument that is a script the window will run. If a window does not already exist, `ddspawn` creates it, if it does, `ddspawn` will toggle its visibility. The the script itself for usage.
+- `displayselect` -- Select which displays to use. Bound to `mod+F3`.
+- `dmenumount` -- Gives a dmenu prompt for mounting USB drives or Android devices. Bound to `mod+F9`. Will do nothing if none are available.
+- `dmenurecord` -- Gives a list of recording commands: `audio`, `video` and `screencast` (both) in dmenu for selection. Bound to `mod+PrintScreen` by default. Should be killed by `killrecording`.
+- `dmenuumount` -- Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing if none are mounted. It will not try to unmount essential system partitions.
+- `dmenuunicode` -- Shows a searchable dmenu prompt of emoji characters. The selected emoji is copied to the system clipboard, while its character code is copied to primary selection (middle mouse button).
+- `dropdowncalc` -- The dropdown calculator script called by `ddspawn` and bound to `mod+a` by default. Will run an R calculator if installed, otherwise python.
+- `ducksearch` -- Show a dmenu prompt and search for the inputed text in DuckDuckGo. Can take bangtags as expected, i.e. typing in `!aw Arch Linux` will search the Arch Wiki for "Arch Linux" or `!yt Luke Smith` will search YouTube for "Luke Smith", etc.
+- `i3resize` -- A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`.
+- `killrecording` -- End a recording started by `dmenurecord` the proper way without file trucation or lingering background processes, mapped to `mod+Delete` by default.
+- `lockscreen` -- The screen locker. Gives a confirm prompt and if user says yes, all audio will be paused and the screen will be distorted and locked and screen will soon time out. User must insert password to unlock. Mapped to `mod+x` by default.
+- `newspod` -- A silly line that has a script all to itself due to i3's idiosyncracies. Starts `newsboat`, if `newsboat` cannot open because of another instance being open, opens `podboat`.
+- `prompt` -- Gives a Yes/No prompt to a question given as an argument. Used by numerous bindings like `mod+shift+x`, `mod+shift+backspace` and `mod+shift+escape`.
+- `samedir` -- Opens a terminal window in the same directory as the window currently selection. Bound to `mod+shift+enter`.
+- `td-toggle` -- Gives a dmenu prompt to start `transmission-daemon` if not running, or the kill it if it is. Obviously you need `transmission-cli` installed for this to work. Mapped to `mod+F7` by default.
+- `tmuxdd` -- The startup script for the dropdown terminal (toggleable with `mod+u`). Either attaches to an existing tmux session or begins a new one.
+- `toggletouchpad` -- As the name suggests, turns off TouchPad if on, and turns it on if off. Requires `xf86-input-synaptics`. If your laptop has a special button for this, it will be mapped by default.
+- `tutorialvids` -- A dmenu prompt that gives some options of tutorial videos to watch. Bound to `mod+shift+e`.
diff --git a/.local/bin/cron/IMPORTANT_NOTE.md b/.local/bin/cron/IMPORTANT_NOTE.md
new file mode 100644
index 0000000..4568a77
--- /dev/null
+++ b/.local/bin/cron/IMPORTANT_NOTE.md
@@ -0,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/1000/bus; export DISPLAY=:0; . $HOME/.profile; then_command_goes_here
+```
+
+This ensures that notifications will display, xdotool commands will function and environmental varialbes will work as well.
diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup
new file mode 100755
index 0000000..0bda098
--- /dev/null
+++ b/.local/bin/cron/checkup
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Syncs repositories and downloads updates, meant to be run as a cronjob.
+
+ping -q -c 1 1.1.1.1 > /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 i3blocks
+
+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
diff --git a/.local/bin/cron/cronbat b/.local/bin/cron/cronbat
new file mode 100755
index 0000000..c09ff42
--- /dev/null
+++ b/.local/bin/cron/cronbat
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Notify me with notify-send if my battery is below 25%.
+# You can set this to run via cron.
+
+[ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit
+[ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] &&
+export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus &&
+notify-send -u critical "Battery critically low."
diff --git a/.local/bin/cron/crontog b/.local/bin/cron/crontog
new file mode 100755
index 0000000..93c2d30
--- /dev/null
+++ b/.local/bin/cron/crontog
@@ -0,0 +1,5 @@
+#!/bin/sh
+# Toggles all cronjobs off/on.
+# Stores disabled crontabs in ~/.consaved until restored.
+
+([ -f ~/.config/cronsaved ] && crontab - < ~/.config/cronsaved && rm ~/.config/cronsaved && notify-send "πŸ•“ Cronjobs re-enabled.") || ( crontab -l > ~/.config/cronsaved && crontab -r && notify-send "πŸ•“ Cronjobs saved and disabled.")
diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup
new file mode 100755
index 0000000..f894927
--- /dev/null
+++ b/.local/bin/cron/newsup
@@ -0,0 +1,16 @@
+#!/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 1.1.1.1 > /dev/null || exit
+
+/usr/bin/notify-send "πŸ“° Updating RSS feeds..."
+
+pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
+
+echo πŸ”ƒ > /tmp/newsupdate
+pkill -RTMIN+6 i3blocks
+/usr/bin/newsboat -x reload
+rm -f /tmp/newsupdate
+pkill -RTMIN+6 i3blocks
+/usr/bin/notify-send "πŸ“° RSS feed update complete."
diff --git a/.local/bin/i3cmds/cabl b/.local/bin/i3cmds/cabl
new file mode 100755
index 0000000..b5b1b3f
--- /dev/null
+++ b/.local/bin/i3cmds/cabl
@@ -0,0 +1,26 @@
+#!/bin/bash
+# Dependencies are xclip and xorg-xprop.
+# qrencode required for qrcode generation.
+# groff/zathura required for man pages.
+prim="$(xclip -o)"; [ -z "$prim" ] && exit
+
+PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
+PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
+cd "$(readlink /proc/"$PID"/cwd)"
+[ -f "$prim" ] && xdg-open "$prim" && exit
+[ -d "$prim" ] && "$TERMINAL" "$prim" && exit
+
+websearch() { "$BROWSER" "https://duckduckgo.com/?q=$@" ;}
+wikipedia() { "$BROWSER" "https://en.wikipedia.org/wiki/$@" ;}
+wiktionary() { "$BROWSER" "https://en.wiktionary.org/wiki/$@" ;}
+maps() { "$BROWSER" "https://www.openstreetmap.org/search?query=$@" ;}
+ebay() { "$BROWSER" "https://www.ebay.com/sch/$@" ;}
+
+echo "$prim" | grep "^.*\.[A-Za-z]\+.*" >/dev/null && gotourl() { "$BROWSER" "$@" ;}
+echo "$prim" | grep "^.*@.*\.[A-Za-z]\+$" >/dev/null && email() { xdg-email "$@" ;}
+command -v qrencode >/dev/null && qrcode() { qrencode "$@" -s 10 -o /tmp/qr.png && xdg-open /tmp/qr.png ;}
+man -k "^$prim$" >/dev/null && manual() { man -Tpdf "$prim" | zathura - ;}
+
+func="$(declare -F | awk '{print $3}' | dmenu -p "Plumb \"$(echo "$prim" | cut -c -30)\" to?" -i -l 15)"
+
+[ -z "$func" ] || "$func" "$prim"
diff --git a/.local/bin/i3cmds/camtoggle b/.local/bin/i3cmds/camtoggle
new file mode 100755
index 0000000..05679c0
--- /dev/null
+++ b/.local/bin/i3cmds/camtoggle
@@ -0,0 +1,2 @@
+#!/bin/sh
+pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video0
diff --git a/.local/bin/i3cmds/ddspawn b/.local/bin/i3cmds/ddspawn
new file mode 100755
index 0000000..d4a4034
--- /dev/null
+++ b/.local/bin/i3cmds/ddspawn
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Toggle floating dropdown terminal in i3, or start if non-existing.
+# $1 is the script run in the terminal.
+# All other args are terminal settings.
+# Terminal names are in dropdown_* to allow easily setting i3 settings.
+
+[ -z "$1" ] && exit
+
+script=$1
+shift
+if xwininfo -tree -root | grep "(\"dropdown_$script\" ";
+then
+ echo "Window detected."
+ i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center"
+else
+ echo "Window not detected... spawning."
+ i3 "exec --no-startup-id $TERMINAL -n dropdown_$script $@ -e $script"
+fi
diff --git a/.local/bin/i3cmds/displayselect b/.local/bin/i3cmds/displayselect
new file mode 100755
index 0000000..e526014
--- /dev/null
+++ b/.local/bin/i3cmds/displayselect
@@ -0,0 +1,73 @@
+#!/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.
+# I plan on adding a routine from multi-monitor setups later.
+
+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
+ 1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
+ 2) twoscreen ;;
+ *) morescreen ;;
+ esac ;}
+
+# Get all possible displays
+allposs=$(xrandr -q | grep "connected")
+
+# Get all connected screens.
+screens=$(echo "$allposs" | grep " connected" | awk '{print $1}')
+
+# 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 ;;
+ *) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
+esac
+
+setbg # Fix background if screen size/arangement has changed.
+remaps # Re-remap keys if keyboard added (for laptop bases)
+pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen
diff --git a/.local/bin/i3cmds/dmenumount b/.local/bin/i3cmds/dmenumount
new file mode 100755
index 0000000..9129643
--- /dev/null
+++ b/.local/bin/i3cmds/dmenumount
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Gives a dmenu prompt to mount unmounted drives.
+# 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
+ mp="$(find $1 | dmenu -i -p "Type in mount point.")"
+ [ "$mp" = "" ] && exit 1
+ if [ ! -d "$mp" ]; then
+ mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
+ [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
+ fi
+ }
+
+mountusb() { \
+ chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
+ sudo -A mount "$chosen" && notify-send "πŸ’» USB mounting" "$chosen mounted." && exit 0
+ alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$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;;
+ *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";;
+ esac
+ notify-send "πŸ’» USB mounting" "$chosen mounted to $mp."
+ }
+
+mountandroid() { \
+ chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1)
+ getmount "$HOME -maxdepth 3 -type d"
+ simple-mtpfs --device "$chosen" "$mp"
+ notify-send "πŸ€– Android Mounting" "Android device mounted to $mp."
+ }
+
+asktype() { \
+ case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in
+ USB) mountusb ;;
+ Android) mountandroid ;;
+ esac
+ }
+
+anddrives=$(simple-mtpfs -l 2>/dev/null)
+usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$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
diff --git a/.local/bin/i3cmds/dmenurecord b/.local/bin/i3cmds/dmenurecord
new file mode 100755
index 0000000..0047e7a
--- /dev/null
+++ b/.local/bin/i3cmds/dmenurecord
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+# Usage:
+# `record`: Ask for recording type via dmenu
+# `record screencast`: Record both audio and screen
+# `record video`: Record only screen
+# `record audio`: Record only audio
+# `record 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 i3blocks
+ }
+
+killrecording() {
+ recpid="$(cat /tmp/recordingpid)"
+ # kill with SIGTERM, allowing finishing touches.
+ kill -15 "$recpid"
+ rm -f /tmp/recordingpid
+ updateicon ""
+ pkill -RTMIN+9 i3blocks
+ # 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 | grep dimensions | awk '{print $2;}') \
+ -i :0.0 \
+ -f alsa -i default \
+ -r 30 \
+ -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \
+ "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" &
+ echo $! > /tmp/recordingpid
+ updateicon "βΊοΈπŸŽ™οΈ"
+ }
+
+video() { ffmpeg \
+ -f x11grab \
+ -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
+ -i :0.0 \
+ -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\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
+ case "$choice" in
+ screencast) screencast;;
+ audio) audio;;
+ video) video;;
+ webcam) webcam;;
+ "webcam (hi-def)") webcamhidef;;
+ esac
+ }
+
+asktoend() { \
+ response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
+ [ "$response" = "Yes" ] && killrecording
+ }
+
+
+case "$1" in
+ screencast) screencast;;
+ audio) audio;;
+ video) video;;
+ kill) killrecording;;
+ *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
+esac
diff --git a/.local/bin/i3cmds/dmenuumount b/.local/bin/i3cmds/dmenuumount
new file mode 100755
index 0000000..dee53e7
--- /dev/null
+++ b/.local/bin/i3cmds/dmenuumount
@@ -0,0 +1,41 @@
+#!/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?" | 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?")
+ [ -z "$chosen" ] && exit
+ sudo -A umount -l "$chosen" && notify-send "πŸ€– Android unmounting" "$chosen unmounted."
+ }
+
+asktype() { \
+ case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in
+ USB) unmountusb ;;
+ Android) unmountandroid ;;
+ esac
+ }
+
+drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
+
+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
diff --git a/.local/bin/i3cmds/dmenuunicode b/.local/bin/i3cmds/dmenuunicode
new file mode 100755
index 0000000..4abf202
--- /dev/null
+++ b/.local/bin/i3cmds/dmenuunicode
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Give dmenu list of all unicode characters to copy.
+# Shows the selected character in dunst if running.
+
+# Must have xclip installed to even show menu.
+xclip -h >/dev/null || exit
+
+chosen=$(grep -v "#" ~/.config/emoji | dmenu -i -l 20 -fn Monospace-18)
+
+[ "$chosen" != "" ] || exit
+
+c=$(echo "$chosen" | sed "s/ .*//")
+echo "$c" | tr -d '\n' | xclip -selection clipboard
+notify-send "'$c' copied to clipboard." &
+
+s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}')
+echo "$s" | tr -d '\n' | xclip
+notify-send "'$s' copied to primary." &
diff --git a/.local/bin/i3cmds/dropdowncalc b/.local/bin/i3cmds/dropdowncalc
new file mode 100755
index 0000000..4d41f88
--- /dev/null
+++ b/.local/bin/i3cmds/dropdowncalc
@@ -0,0 +1,2 @@
+#!/bin/sh
+ifinstalled bc && echo "Welcome to the Calculator." && bc -lq
diff --git a/.local/bin/i3cmds/ducksearch b/.local/bin/i3cmds/ducksearch
new file mode 100755
index 0000000..7b5bca6
--- /dev/null
+++ b/.local/bin/i3cmds/ducksearch
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Gives a dmenu prompt to search DuckDuckGo.
+# Without input, will open DuckDuckGo.com.
+# URLs will be directly handed to the browser.
+# Anything else, it search it.
+browser=${BROWSER:-firefox}
+
+pgrep -x dmenu && exit
+
+choice=$(echo "πŸ¦†" | dmenu -i -p "Search DuckDuckGo:") || exit 1
+
+if [ "$choice" = "πŸ¦†" ]; then
+ $browser "https://duckduckgo.com"
+else
+ if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then
+ $browser "$choice"
+ else
+ $browser "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1"
+ fi
+fi
diff --git a/.local/bin/i3cmds/hover b/.local/bin/i3cmds/hover
new file mode 100755
index 0000000..8d03a99
--- /dev/null
+++ b/.local/bin/i3cmds/hover
@@ -0,0 +1,14 @@
+#!/bin/sh
+[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right
+current=$(xdotool getwindowfocus)
+newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3))
+newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3))
+xdotool windowsize "$current" $newheight $newwidth
+newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
+newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*")
+
+case "$1" in
+ left) horizontal=0; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;;
+ right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) ; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;;
+esac
+xdotool windowmove "$current" $horizontal $vertical
diff --git a/.local/bin/i3cmds/i3resize b/.local/bin/i3cmds/i3resize
new file mode 100755
index 0000000..11b0992
--- /dev/null
+++ b/.local/bin/i3cmds/i3resize
@@ -0,0 +1,27 @@
+#!/bin/sh
+# This script was made by `goferito` on Github.
+# Some cleanup by Luke.
+
+[ -z "$1" ] && echo "No direction provided" && exit 1
+distanceStr="2 px or 2 ppt"
+
+moveChoice() {
+ i3-msg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \
+ i3-msg resize "$3" "$4" "$distanceStr"
+}
+
+case $1 in
+ up)
+ moveChoice grow up shrink down
+ ;;
+ down)
+ moveChoice shrink up grow down
+ ;;
+ left)
+ moveChoice shrink right grow left
+ ;;
+ right)
+ moveChoice grow right shrink left
+ ;;
+esac
+
diff --git a/.local/bin/i3cmds/killrecording b/.local/bin/i3cmds/killrecording
new file mode 100755
index 0000000..ec9a698
--- /dev/null
+++ b/.local/bin/i3cmds/killrecording
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+kill -9 "$(cat ~/.recordingpid)"
+
+# Update i3bar.
+echo "" > ~/.recordingicon
+pkill -RTMIN+9 i3blocks
diff --git a/.local/bin/i3cmds/maimpick b/.local/bin/i3cmds/maimpick
new file mode 100755
index 0000000..07d032f
--- /dev/null
+++ b/.local/bin/i3cmds/maimpick
@@ -0,0 +1,9 @@
+#!/bin/sh
+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
diff --git a/.local/bin/i3cmds/prompt b/.local/bin/i3cmds/prompt
new file mode 100755
index 0000000..56de2f8
--- /dev/null
+++ b/.local/bin/i3cmds/prompt
@@ -0,0 +1,7 @@
+#!/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
diff --git a/.local/bin/i3cmds/samedir b/.local/bin/i3cmds/samedir
new file mode 100755
index 0000000..88845fc
--- /dev/null
+++ b/.local/bin/i3cmds/samedir
@@ -0,0 +1,5 @@
+#!/bin/sh
+PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
+PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
+cd "$(readlink /proc/"$PID"/cwd)"
+"$TERMINAL"
diff --git a/.local/bin/i3cmds/showclip b/.local/bin/i3cmds/showclip
new file mode 100755
index 0000000..d2faff8
--- /dev/null
+++ b/.local/bin/i3cmds/showclip
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Display contents of selection via dunst if running.
+# Separate script for i3.
+
+clip=$(xclip -o -selection clipboard)
+prim=$(xclip -o -selection primary)
+
+[ -n "$clip" ] && notify-send "Clipboard:" "$clip"
+[ -n "$prim" ] && notify-send "Primary:" "$prim"
diff --git a/.local/bin/i3cmds/td-toggle b/.local/bin/i3cmds/td-toggle
new file mode 100755
index 0000000..dc727b9
--- /dev/null
+++ b/.local/bin/i3cmds/td-toggle
@@ -0,0 +1,10 @@
+#!/bin/sh
+# If transmission-daemon is running, will ask to kill, else will ask to start.
+if pgrep -x transmission-da >/dev/null ;
+then
+ [ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon killed."
+else
+ ifinstalled transmission-cli || exit
+ [ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon started."
+fi
+sleep 3 && pkill -RTMIN+7 i3blocks
diff --git a/.local/bin/i3cmds/tmuxdd b/.local/bin/i3cmds/tmuxdd
new file mode 100755
index 0000000..c194ff1
--- /dev/null
+++ b/.local/bin/i3cmds/tmuxdd
@@ -0,0 +1,4 @@
+#!/bin/sh
+# This is the script that i3 runs to either start tmux in
+# the dropdown terminal or log into a previous session.
+tmux a || tmux
diff --git a/.local/bin/i3cmds/toggletouchpad b/.local/bin/i3cmds/toggletouchpad
new file mode 100755
index 0000000..6d8c9c8
--- /dev/null
+++ b/.local/bin/i3cmds/toggletouchpad
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Toggle touchpad. Requires xf86-input-synaptics.
+(synclient | grep "TouchpadOff.*1" && synclient TouchpadOff=0)>/dev/null && echo "TouchPad reactivated." && exit
+synclient TouchpadOff=1 && echo "TouchPad deactivated."
diff --git a/.local/bin/i3cmds/torwrap b/.local/bin/i3cmds/torwrap
new file mode 100755
index 0000000..04e7a51
--- /dev/null
+++ b/.local/bin/i3cmds/torwrap
@@ -0,0 +1,6 @@
+#!/bin/sh
+ifinstalled transmission-remote-cli transmission-cli || exit
+
+! pgrep -x transmission-da >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks
+
+$TERMINAL -e transmission-remote-cli
diff --git a/.local/bin/i3cmds/tutorialvids b/.local/bin/i3cmds/tutorialvids
new file mode 100755
index 0000000..f1357eb
--- /dev/null
+++ b/.local/bin/i3cmds/tutorialvids
@@ -0,0 +1,18 @@
+#!/bin/sh
+vidlist="
+status bar https://www.youtube.com/watch?v=gKumet6b-WY
+sxiv (image viewer) https://www.youtube.com/watch?v=GYW9i_u5PYs
+st (terminal) https://www.youtube.com/watch?v=9H75enWM22k
+i3 (window manager) https://www.youtube.com/watch?v=GKviflL9XeI
+pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRKs
+mutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A
+ncmpcpp (music player) https://www.youtube.com/watch?v=sZIEdI9TS2U
+newsboat (RSS reader) https://www.youtube.com/watch?v=dUFCRqs822w
+zathura (pdf viewer) https://www.youtube.com/watch?v=V_Iz4zdyRM4
+gpg keys https://www.youtube.com/watch?v=DMGIlj7u7Eo
+calcurse (calendar) https://www.youtube.com/watch?v=hvc-pHjbhdE
+urlview https://www.youtube.com/watch?v=IgzpAjFgbCw
+colorschemes with pywal https://www.youtube.com/watch?v=Es79N_9BblE
+vi mode in shell https://www.youtube.com/watch?v=GqoJQft5R2E
+"
+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
diff --git a/.local/bin/i3cmds/winresize b/.local/bin/i3cmds/winresize
new file mode 100755
index 0000000..090bbf3
--- /dev/null
+++ b/.local/bin/i3cmds/winresize
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo "πŸ“" | dmenu -p "Give width and height:" | xargs xdotool windowsize "$(xdotool getwindowfocus)"
diff --git a/.local/bin/larbs.png b/.local/bin/larbs.png
new file mode 100644
index 0000000..0dbc687
--- /dev/null
+++ b/.local/bin/larbs.png
Binary files differ
diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery
new file mode 100755
index 0000000..25c9269
--- /dev/null
+++ b/.local/bin/statusbar/battery
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Give a battery name (e.g. BAT0) as an argument.
+
+case $BLOCK_BUTTON in
+ 3) pgrep -x dunst >/dev/null && notify-send "πŸ”‹ Battery module" "πŸ”‹: discharging
+πŸ›‘: not charging
+β™»: stagnant charge
+πŸ”Œ: charging
+⚑: charged
+❗: battery very low!
+- Text color reflects charge left" ;;
+esac
+
+capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
+status=$(cat /sys/class/power_supply/"$1"/status)
+
+if [ "$capacity" -ge 75 ]; then
+ color="#00ff00"
+elif [ "$capacity" -ge 50 ]; then
+ color="#ffffff"
+elif [ "$capacity" -ge 25 ]; then
+ color="#ffff00"
+else
+ color="#ff0000"
+ warn="❗"
+fi
+
+[ -z $warn ] && warn=" "
+
+[ "$status" = "Charging" ] && color="#ffffff"
+
+printf "<span color='%s'>%s%s%s</span>" "$color" "$(echo "$status" | sed -e "s/,//;s/Discharging/πŸ”‹/;s/Not Charging/πŸ›‘/;s/Charging/πŸ”Œ/;s/Unknown/♻️/;s/Full/⚑/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')"
diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock
new file mode 100755
index 0000000..d6d54ef
--- /dev/null
+++ b/.local/bin/statusbar/clock
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+date '+%Y %b %d (%a) %I:%M%p'
+
+case $BLOCK_BUTTON in
+ 1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;;
+ 2) "$TERMINAL" -e calcurse -D ~/.config/calcurse ;;
+ 3) pgrep -x dunst >/dev/null && 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" ;;
+esac
diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu
new file mode 100755
index 0000000..3b1394a
--- /dev/null
+++ b/.local/bin/statusbar/cpu
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) notify-send "πŸ–₯ CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)" ;;
+ 3) notify-send "πŸ–₯ CPU module " "\- Shows CPU temperature.
+- Click to show intensive processes.
+- % is of single core." ;;
+esac
+
+sensors | awk '/Core 0/ {print $3}'
diff --git a/.local/bin/statusbar/disk b/.local/bin/statusbar/disk
new file mode 100755
index 0000000..d3dd07d
--- /dev/null
+++ b/.local/bin/statusbar/disk
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Status bar module for disk space
+# $1 should be drive mountpoint
+# $2 is optional icon, otherwise mountpoint will displayed
+
+[ -z "$1" ] && exit
+
+icon="$2"
+[ -z "$2" ] && icon="$1"
+
+case $BLOCK_BUTTON in
+ 1) pgrep -x dunst >/dev/null && notify-send "πŸ’½ Disk space" "$(df -h --output=target,used,size)" ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "πŸ’½ Disk module" "\- Shows used hard drive space.
+- Click to show all disk info." ;;
+esac
+
+printf "%s: %s" "$icon" "$(df -h "$1" | awk ' /[0-9]/ {print $3 "/" $2}')"
diff --git a/.local/bin/statusbar/help b/.local/bin/statusbar/help
new file mode 100755
index 0000000..4916d5c
--- /dev/null
+++ b/.local/bin/statusbar/help
@@ -0,0 +1,7 @@
+#!/bin/sh
+case $BLOCK_BUTTON in
+ 1) groff -mom ~/.local/share/larbs/readme.mom -Tpdf | zathura - ;;
+ 2) i3 restart ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide.
+- Middle click to refresh i3.";;
+esac; echo "❓"
diff --git a/.local/bin/statusbar/internet b/.local/bin/statusbar/internet
new file mode 100755
index 0000000..1d2f2e8
--- /dev/null
+++ b/.local/bin/statusbar/internet
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) $TERMINAL -e nmtui ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module" "\- Click to connect
+πŸ“‘: no wifi connection
+πŸ“Ά: wifi connection with quality
+❎: no ethernet
+🌐: ethernet working
+" ;;
+esac
+
+[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="πŸ“‘"
+
+[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "πŸ“Ά", int($3 * 100 / 70) "%" }')
+
+printf "%s %s" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")"
diff --git a/.local/bin/statusbar/iplocate b/.local/bin/statusbar/iplocate
new file mode 100755
index 0000000..4ca4f10
--- /dev/null
+++ b/.local/bin/statusbar/iplocate
@@ -0,0 +1,9 @@
+#!/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 "geoiplookup" || exit
+addr="$(curl ifconfig.me 2>/dev/null)" || exit
+grep "flag: " ~/.config/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox
new file mode 100755
index 0000000..21c85ab
--- /dev/null
+++ b/.local/bin/statusbar/mailbox
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# i3blocks mail module.
+# Displays number of unread mail and an loading icon if updating.
+# When clicked, brings up `neomutt`.
+
+case $BLOCK_BUTTON in
+ 1) "$TERMINAL" -e neomutt ;;
+ 2) setsid mailsync >/dev/null & ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "πŸ“¬ Mail module" "\- Shows unread mail
+- Shows πŸ”ƒ if syncing mail
+- Left click opens neomutt
+- Middle click syncs mail" ;;
+esac
+
+echo "$(du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null)"
diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory
new file mode 100755
index 0000000..dfd3d7b
--- /dev/null
+++ b/.local/bin/statusbar/memory
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
+ 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total.
+- Click to show memory hogs." ;;
+esac
+
+free -h | awk '/^Mem:/ {print $3 "/" $2}'
diff --git a/.local/bin/statusbar/mpdupdate b/.local/bin/statusbar/mpdupdate
new file mode 100755
index 0000000..afe11bb
--- /dev/null
+++ b/.local/bin/statusbar/mpdupdate
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Whenever the mpd state changes, update the mpd i3 module.
+kill -0 "$(cat /tmp/mpdupdate)" 2>/dev/null && exit || echo $$ > /tmp/mpdupdate
+
+sleep 5 && while : ; do
+ pkill -RTMIN+11 i3blocks
+ mpc idle >/dev/null || exit
+done
diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music
new file mode 100755
index 0000000..93c2c9c
--- /dev/null
+++ b/.local/bin/statusbar/music
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+filter() {
+ sed "/^volume:/d" | tac | sed -e "s/\\&/&amp;/g;s/\\[paused\\].*/<span color=\"gray\" font_style=\"italic\">/g;s/\\[playing\\].*/<span>/g" | tr -d '\n' | sed -e "s/$/<\\/span>/g"
+ }
+
+case $BLOCK_BUTTON in
+ 1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause
+ 2) mpc toggle | filter ;; # right click, pause/unpause
+ 3) mpc status | filter && pgrep -x dunst >/dev/null && notify-send "🎡 Music module" "\- Shows mpd song playing.
+- Italic 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
+ *) mpc status | filter ;;
+esac; exit
diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news
new file mode 100755
index 0000000..b7ca1a7
--- /dev/null
+++ b/.local/bin/statusbar/news
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# i3blocks newsboat module.
+# 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 newsup >/dev/null & exit ;;
+ 3) pgrep -x dunst >/dev/null && 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." ;;
+esac
+
+ cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print $1}' | sed s/^0$//g)$(cat ~/.config/newsboat/.update 2>/dev/null)"
diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages
new file mode 100755
index 0000000..418bc2d
--- /dev/null
+++ b/.local/bin/statusbar/pacpackages
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# i3blocks module for pacman upgrades.
+# 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.
+
+case $BLOCK_BUTTON in
+ 1) $TERMINAL -e popupgrade ;;
+ 2) notify-send "$(/usr/bin/pacman -Qu)" ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "Upgrade module" "πŸ“¦: number of upgradable packages
+- Left click to upgrade packages
+- Middle click to show upgradable packages" ;;
+esac
+
+
+pacman -Qu | grep -v "\[ignored\]" | wc -l | sed -e "s/^0$//g"
diff --git a/.local/bin/statusbar/popupgrade b/.local/bin/statusbar/popupgrade
new file mode 100755
index 0000000..83035c3
--- /dev/null
+++ b/.local/bin/statusbar/popupgrade
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+printf "Beginning upgrade.\\n"
+
+yay -Syu
+pkill -RTMIN+8 i3blocks
+
+printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
+read -r
diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent
new file mode 100755
index 0000000..0ab811c
--- /dev/null
+++ b/.local/bin/statusbar/torrent
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+transmission-remote -l | grep % |
+ sed " # This first sed command is to ensure a desirable order with sort
+ s/.*Stopped.*/A/g;
+ s/.*Seeding.*/Z/g;
+ s/.*100%.*/N/g;
+ s/.*Idle.*/B/g;
+ s/.*Uploading.*/L/g;
+ s/.*%.*/M/g" |
+ sort -h | uniq -c | sed " # Now we replace the standin letters with icons.
+ s/A/πŸ›‘/g;
+ s/B/βŒ›οΈ/g;
+ s/L/πŸ”Ό/g;
+ s/M/πŸ”½/g;
+ s/N/βœ…/g;
+ s/Z/🌱/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed -e "s/ $//g"
+
+case $BLOCK_BUTTON in
+ 1) $TERMINAL -e transmission-remote-cli ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "Torrent module" "πŸ›‘: paused
+⏳: idle (seeds needed)
+πŸ”Ό: uploading (unfinished)
+πŸ”½: downloading
+βœ…: done
+🌱: done and seeding" ;;
+esac
+
diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume
new file mode 100755
index 0000000..3bbb32b
--- /dev/null
+++ b/.local/bin/statusbar/volume
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) setsid "$TERMINAL" -e pulsemixer & ;;
+ 2) pulsemixer --toggle-mute ;;
+ 4) pulsemixer --change-volume +5 ;;
+ 5) pulsemixer --change-volume -5 ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted.
+- Middle click to mute.
+- Scroll to change."
+esac
+
+[ "$(pulsemixer --get-mute)" = "1" ] && printf "πŸ”‡\\n" && exit
+
+vol=$(pulsemixer --get-volume | awk '{print $1}')
+
+if [ "$vol" -gt "70" ]; then
+ icon="πŸ”Š"
+elif [ "$vol" -lt "30" ]; then
+ icon="πŸ”ˆ"
+else
+ icon="πŸ”‰"
+fi
+
+printf "%s %s%%\\n" "$icon" "$vol"
diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather
new file mode 100755
index 0000000..e4de680
--- /dev/null
+++ b/.local/bin/statusbar/weather
@@ -0,0 +1,23 @@
+#!/bin/sh
+location="$1"; [ -z "$location" ] || { location="$location+" && rm -f "$HOME/.local/share/weatherreport" ;}
+
+getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1
+curl -s "wttr.in/$location" > "$HOME/.local/share/weatherreport" || exit 1 ;}
+
+showweather() { printf "%s" "$(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 "Β°"}' ;}
+
+case $BLOCK_BUTTON in
+ 1) $TERMINAL -e less -S "$HOME/.local/share/weatherreport" ;;
+ 2) getforecast && showweather ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast.
+- Middle click to update forecast.
+β˜”: Chance of rain/snow
+❄: Daily low
+🌞: Daily high" ;;
+esac
+
+if [ "$(stat -c %y "$HOME/.local/share/weatherreport" >/dev/null 2>&1 | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ]
+ then getforecast && showweather
+ else showweather
+fi
diff --git a/.local/bin/tools/compiler b/.local/bin/tools/compiler
new file mode 100755
index 0000000..7d3bf1d
--- /dev/null
+++ b/.local/bin/tools/compiler
@@ -0,0 +1,37 @@
+#!/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.
+# Opens .sent files as sent presentations.
+# Runs scripts based on extention or shebang
+
+file=$(readlink -f "$1")
+dir=$(dirname "$file")
+base="${file%.*}"
+
+cd "$dir" || exit
+
+textype() { \
+ command="pdflatex"
+ ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
+ $command --output-directory="$dir" "$base" &&
+ grep -i addbibresource "$file" >/dev/null &&
+ biber --input-directory "$dir" "$base" &&
+ $command --output-directory="$dir" "$base" &&
+ $command --output-directory="$dir" "$base"
+ }
+
+case "$file" in
+ *\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;;
+ *\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;;
+ *\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
+ *\.tex) textype "$file" ;;
+ *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
+ *config.h) sudo make install ;;
+ *\.c) cc "$file" -o "$base" && "$base" ;;
+ *\.py) python "$file" ;;
+ *\.go) go run "$file" ;;
+ *\.sent) setsid sent "$file" 2>/dev/null & ;;
+ *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
+esac
diff --git a/.local/bin/tools/dmenuhandler b/.local/bin/tools/dmenuhandler
new file mode 100755
index 0000000..391bdc1
--- /dev/null
+++ b/.local/bin/tools/dmenuhandler
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Feed this script a link and it will give dmenu
+# some choice programs to use to open it.
+
+case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in
+ "copy url") echo "$1" | xclip -selection clipboard ;;
+ mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;;
+ "mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;;
+ "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;;
+ "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;;
+ browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;;
+ feh) setsid feh "$1" >/dev/null 2>&1 & ;;
+ w3m) w3m "$1" >/dev/null 2>&1 ;;
+ "mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
+esac
diff --git a/.local/bin/tools/dmenupass b/.local/bin/tools/dmenupass
new file mode 100755
index 0000000..4fc464f
--- /dev/null
+++ b/.local/bin/tools/dmenupass
@@ -0,0 +1,2 @@
+#!/bin/sh
+dmenu -fn Monospace-18 -sb "#d79921" -sf "#1d2021" -nf "#000000" -nb "#000000" -p "$1" <&- && echo
diff --git a/.local/bin/tools/ext b/.local/bin/tools/ext
new file mode 120000
index 0000000..562d2b3
--- /dev/null
+++ b/.local/bin/tools/ext
@@ -0,0 +1 @@
+extract \ No newline at end of file
diff --git a/.local/bin/tools/extract b/.local/bin/tools/extract
new file mode 100755
index 0000000..a63ab10
--- /dev/null
+++ b/.local/bin/tools/extract
@@ -0,0 +1,41 @@
+#!/bin/sh
+# A general, all-purpose extraction script.
+#
+# 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 ;;
+esac done
+
+if [ -z "$extracthere" ]; then
+ archive="$(readlink -f "$*")" &&
+ directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
+ mkdir -p "$directory" &&
+ cd "$directory" || exit
+else
+ archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")"
+fi
+
+[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit
+
+if [ -f "$archive" ] ; then
+ case "$archive" in
+ *.tar.bz2|*.tar.xz|*.tbz2) tar xvjf "$archive" ;;
+ *.tar.gz|*.tgz) tar xvzf "$archive" ;;
+ *.lzma) unlzma "$archive" ;;
+ *.bz2) bunzip2 "$archive" ;;
+ *.rar) unrar x -ad "$archive" ;;
+ *.gz) gunzip "$archive" ;;
+ *.tar) tar xvf "$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
diff --git a/.local/bin/tools/getbib b/.local/bin/tools/getbib
new file mode 100755
index 0000000..ed441c5
--- /dev/null
+++ b/.local/bin/tools/getbib
@@ -0,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 "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
diff --git a/.local/bin/tools/getkeys b/.local/bin/tools/getkeys
new file mode 100755
index 0000000..444f4c0
--- /dev/null
+++ b/.local/bin/tools/getkeys
@@ -0,0 +1,4 @@
+#!/bin/sh
+cat ~/.config/getkeys/"$1" 2>/dev/null && exit
+echo "Run command with one of the following arguments for info about that program:"
+ls ~/.config/getkeys
diff --git a/.local/bin/tools/ifinstalled b/.local/bin/tools/ifinstalled
new file mode 100755
index 0000000..b0d23e5
--- /dev/null
+++ b/.local/bin/tools/ifinstalled
@@ -0,0 +1,3 @@
+#!/bin/sh
+# If $1 command is not available, error code and notify.
+command -v "$1" >/dev/null || { notify-send "πŸ“¦ $1" "must be installed for this function." && exit 1 ;}
diff --git a/.local/bin/tools/linkhandler b/.local/bin/tools/linkhandler
new file mode 100755
index 0000000..c616d04
--- /dev/null
+++ b/.local/bin/tools/linkhandler
@@ -0,0 +1,22 @@
+#!/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*|*youtu.be*|*hooktube.com*|*bitchute.com*)
+ setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
+ *png|*jpg|*jpe|*jpeg|*gif)
+ curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
+ *mp3|*flac|*opus|*mp3?source*)
+ setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
+ *)
+ if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1"
+ else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;;
+esac
diff --git a/.local/bin/tools/lmc b/.local/bin/tools/lmc
new file mode 100755
index 0000000..18cf2c2
--- /dev/null
+++ b/.local/bin/tools/lmc
@@ -0,0 +1,42 @@
+#!/bin/sh
+# A general audio interface for LARBS.
+
+[ -z "$2" ] && num="2" || num="$2"
+
+case "$1" in
+ u*) pulsemixer --change-volume +"$num" ;;
+ d*) pulsemixer --change-volume -"$num" ;;
+ m*) pulsemixer --toggle-mute ;;
+ truemute) pulsemixer --mute ;;
+ play) mpc play ;;
+ n*) mpc next ;;
+ prev) mpc prev ;;
+ t*) mpc toggle ;;
+ p*) mpc pause ; pauseallmpv ;;
+ f*) mpc seek +"$num" ;;
+ b*) mpc seek -"$num" ;;
+ r*) mpc seek 0% ;;
+ *) cat << EOF
+lmc: cli music interface for mpd and pulse for those with divine intellect too
+grand to remember the mpc/pamixer commands.
+
+Allowed options:
+ up NUM Increase volume (2 secs default)
+ down NUM Decrease volume (2 secs default)
+ mute Toggle mute
+ truemute Mute
+ next Next track
+ prev Previous track
+ toggle Toggle pause
+ truepause Pause
+ foward NUM Seek foward in song (2 secs default)
+ back NUM Seek back in song (2 secs default)
+ restart Restart current song
+ all else Print this message
+
+All of these commands, except for \`truemute\`, \`prev\` and \`play\` can be truncated,
+i.e. \`lmc r\` for \`lmc restart\`.
+EOF
+esac
+
+pkill -RTMIN+10 i3blocks
diff --git a/.local/bin/tools/opout b/.local/bin/tools/opout
new file mode 100755
index 0000000..c742aa9
--- /dev/null
+++ b/.local/bin/tools/opout
@@ -0,0 +1,11 @@
+#!/bin/sh
+# opout: "open output": A general handler for opening a file's intended output.
+# I find this useful especially running from vim.
+
+basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
+
+case "$1" in
+ *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;;
+ *.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;;
+ *.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
+esac
diff --git a/.local/bin/tools/pauseallmpv b/.local/bin/tools/pauseallmpv
new file mode 100755
index 0000000..c5da220
--- /dev/null
+++ b/.local/bin/tools/pauseallmpv
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in $(ls /tmp/mpvsoc*); do
+ echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
+done
diff --git a/.local/bin/tools/podentr b/.local/bin/tools/podentr
new file mode 100755
index 0000000..13ab4a8
--- /dev/null
+++ b/.local/bin/tools/podentr
@@ -0,0 +1,6 @@
+#!/bin/sh
+# entr command to run `queueandnotify` when newsboat queue is changed
+
+[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit
+
+echo ~/.local/share/newsboat/queue | entr -p queueandnotify 2>/dev/null
diff --git a/.local/bin/tools/qndl b/.local/bin/tools/qndl
new file mode 100755
index 0000000..a99d37e
--- /dev/null
+++ b/.local/bin/tools/qndl
@@ -0,0 +1,11 @@
+#!/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"
+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."
diff --git a/.local/bin/tools/queueandnotify b/.local/bin/tools/queueandnotify
new file mode 100755
index 0000000..a1417ec
--- /dev/null
+++ b/.local/bin/tools/queueandnotify
@@ -0,0 +1,13 @@
+#!/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="$HOME/.local/share/newsboat/queue"
+
+while read -r line; do
+ [ -z "$line" ] && continue
+ url="$(echo "$line" | awk '{print $1}')"
+ qndl "$url" "curl -LO"
+done < "$queuefile"
+
+echo > "$queuefile"
diff --git a/.local/bin/tools/remaps b/.local/bin/tools/remaps
new file mode 100755
index 0000000..df7d6c9
--- /dev/null
+++ b/.local/bin/tools/remaps
@@ -0,0 +1,10 @@
+#!/bin/sh
+# This script is called by i3 on startup to remap keys.
+# Increase key speed via a rate change
+xset r rate 300 50
+# Map the caps lock key to super...
+setxkbmap -option caps:super
+# But when it is pressed only once, treat it as escape.
+killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
+# Map the menu button to right super as well.
+xmodmap -e 'keycode 135 = Super_R'
diff --git a/.local/bin/tools/rotdir b/.local/bin/tools/rotdir
new file mode 100755
index 0000000..e7103db
--- /dev/null
+++ b/.local/bin/tools/rotdir
@@ -0,0 +1,4 @@
+#!/bin/sh
+[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
+base="$(basename $1)"
+ ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$base$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }"
diff --git a/.local/bin/tools/rssadd b/.local/bin/tools/rssadd
new file mode 100755
index 0000000..8822fc5
--- /dev/null
+++ b/.local/bin/tools/rssadd
@@ -0,0 +1,9 @@
+#!/bin/sh
+! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null &&
+ notify-send "That doesn't look like a full URL." && exit
+RSSFILE="$HOME/.config/newsboat/urls"
+if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then
+ notify-send "You already have this RSS feed."
+else
+ echo "$1" >> "$RSSFILE" && notify-send "RSS feed added."
+fi
diff --git a/.local/bin/tools/setbg b/.local/bin/tools/setbg
new file mode 100755
index 0000000..950ae7c
--- /dev/null
+++ b/.local/bin/tools/setbg
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Sets the background. If given an argument, will set file as background.
+[ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed."
+xwallpaper --zoom ~/.config/wall.png
diff --git a/.local/bin/tools/shortcuts b/.local/bin/tools/shortcuts
new file mode 100755
index 0000000..1c4f278
--- /dev/null
+++ b/.local/bin/tools/shortcuts
@@ -0,0 +1,26 @@
+#!/bin/bash
+# Output locations. Unactivated progs should go to /dev/null.
+shell_shortcuts="$HOME/.config/shortcutrc"
+ranger_shortcuts="/dev/null"
+qute_shortcuts="/dev/null"
+fish_shortcuts="/dev/null"
+vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts"
+
+# Remove, prepare files
+rm -f "$ranger_shortcuts" "$qute_shortcuts" 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 `bmdirs` file in the correct syntax and sent it to all three configs.
+sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
+ >(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \
+ >(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$vifm_shortcuts") \
+ >(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \
+ | awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts"
+
+# Format the `configs` file in the correct syntax and sent it to both configs.
+sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
+ >(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
+ >(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
+ | awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"
diff --git a/.local/bin/tools/texclear b/.local/bin/tools/texclear
new file mode 100755
index 0000000..f6a5062
--- /dev/null
+++ b/.local/bin/tools/texclear
@@ -0,0 +1,14 @@
+#!/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|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 ;;
+ *) printf "Give .tex file as argument.\\n" ;;
+esac
+
diff --git a/.local/bin/tools/transadd b/.local/bin/tools/transadd
new file mode 100755
index 0000000..ad2ee7f
--- /dev/null
+++ b/.local/bin/tools/transadd
@@ -0,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.
+
+pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks)
+
+transmission-remote -a "$@" && notify-send "πŸ”½ Torrent added."
diff --git a/.local/bin/tools/vifmimg b/.local/bin/tools/vifmimg
new file mode 100755
index 0000000..1569962
--- /dev/null
+++ b/.local/bin/tools/vifmimg
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+[ -z "$FIFO_UEBERZUG" ] && exit
+
+readonly ID_PREVIEW="preview"
+
+if [ "$1" = "draw" ]; then
+ declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG"
+elif [ "$1" = "videopreview" ]; then
+ [ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 &&
+ declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG"
+else
+ declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG"
+fi
diff --git a/.local/bin/tools/vu b/.local/bin/tools/vu
new file mode 100755
index 0000000..778835a
--- /dev/null
+++ b/.local/bin/tools/vu
@@ -0,0 +1,15 @@
+#!/usr/bin/env sh
+export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
+
+cleanup() {
+ rm "$FIFO_UEBERZUG" 2>/dev/null
+ pkill -P $$ 2>/dev/null
+}
+
+rm "$FIFO_UEBERZUG" 2>/dev/null
+mkfifo "$FIFO_UEBERZUG"
+trap cleanup EXIT
+tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash &
+
+vifm
+cleanup
diff --git a/.local/bin/ttymaps.kmap b/.local/bin/ttymaps.kmap
new file mode 100644
index 0000000..51a7042
--- /dev/null
+++ b/.local/bin/ttymaps.kmap
@@ -0,0 +1,2 @@
+keycode 1 = Caps_Lock
+keycode 58 = Escape
diff --git a/.local/bin/unix b/.local/bin/unix
new file mode 100755
index 0000000..14d7ef0
--- /dev/null
+++ b/.local/bin/unix
@@ -0,0 +1,25 @@
+#!/bin/sh
+#original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes
+#converted to shell by #nixers @ irc.unix.chat
+
+cat << 'eof'
+ ,_ ,_==β–„β–‚
+ , β–‚β–ƒβ–„β–„β–…β–…β–…β–‚β–…ΒΎ. / /
+ β–„β–†<Β΄ "Β»β–“β–“β–“%\ / / / /
+ ,β–…7" Β΄>β–“β–“β–“% / / > / >/%
+ ▐ΒΆβ–“ ,Β»β–“β–“ΒΎΒ΄ /> %/%// / /
+ ▓▃▅▅▅▃,,▄▅▅▅Æ\// ///>// />/ /
+ V║«¼.;→ ║<«.,`=// />//%/% / /
+ //β• <Β΄ -Β²,)(β–“~"-╝/ΒΎ/ %/>/ />
+ / / / ▐% -./β–„β–ƒβ–„β–…▐, /7//;//% / /
+ / ////`β–Œ▐ %zWv xXβ–“β–‡β–Œ//&;% / /
+ / / / %//%/ΒΎΒ½Β΄β–Œβ–ƒβ–„β–„β–„β–„β–ƒβ–ƒ▐ΒΆ\/& /
+ </ /</%//`β–“!%β–“%β•£[38;5;255;β•£WY<Y)y&/`\
+ / / %/%//</%//\i7; β• N>)VY>7; \_ UNIX IS VERY SIMPLE IT JUST NEEDS A
+ / /</ //<///<_/%\β–“ V%W%Β£)XY _/%β€Ύ\_, GENIUS TO UNDERSTAND ITS SIMPLICITY
+ / / //%/_,=--^/%/%%\ΒΎ%ΒΆ%%} /%%%%%%;\,
+ %/< /_/ %%%%%;X%%\%%;, _/%%%;, \
+ / / %%%%%%;, \%%l%%;// _/%;, dmr
+ / %%%;, <;\-=-/ /
+ ;, l
+eof \ No newline at end of file
diff --git a/.local/share/larbs/readme.mom b/.local/share/larbs/readme.mom
index 9ba7452..62bc06e 100644
--- a/.local/share/larbs/readme.mom
+++ b/.local/share/larbs/readme.mom
@@ -70,7 +70,7 @@ but you can also hold it down and it will act as another Windows/super/mod key.
The menu button (usually between the right Alt and Ctrl) is an alternative Super/Mod button.
This is to make one-handing on laptops easier.
.LIST OFF
-If you'd like to change any of these keyboard changes, you need only open and change \f(CW~/.scripts/tools/remaps\fP.
+If you'd like to change any of these keyboard changes, you need only open and change \f(CW~/.local/bin/tools/remaps\fP.
Actually, this should go without saying, but \fIeverything\fP here can easily be changed.
.PP
Additionally, while this isn't a part of i3, the default editing mode in the shell is using vi bindings.
@@ -91,8 +91,8 @@ If you just want black and white icons, you should actually just be able to unin
.PP
The i3blocks config is \f(CW~/.config/i3blocks/config\fP, which you can access by the
terminal shortcut \f(CWcfB\fP. Notice that the config file refers to several module
-scripts in the \f(CW~/.scripts/\fP directory. You can read a summary of all of these
-scripts in the file \f(CW~/.scripts/SCRIPTS.md\fP.
+scripts in the \f(CW~/.local/bin/\fP directory. You can read a summary of all of these
+scripts in the file \f(CW~/.local/bin/SCRIPTS.md\fP.
.HEADING 2 "Deeper Tutorials"
.PP
In addition to this guide and reading the dotfiles of programs manually, you
@@ -338,7 +338,7 @@ Note that it is your responsibility to ensure that none of the bindings you add
.HEADING 1 "Frequently Asked Questions (FAQs)"
.HEADING 2 "My keyboard isn't working as expected!"
.PP
-LARBS runs some custom keyboard settings in \f(CW~/.scripts/tools/remaps\fP.
+LARBS runs some custom keyboard settings in \f(CW~/.local/bin/tools/remaps\fP.
These settings may override your preferred settings, so you should open this file and comment out troublesome lines if you have issues.
.HEADING 2 "My audio isn't working!"
.PP