diff options
author | Jackson Taylor <jackson@jacksontaylor.xyz> | 2021-02-01 19:04:54 -0500 |
---|---|---|
committer | Jackson Taylor <jackson@jacksontaylor.xyz> | 2021-02-01 19:04:54 -0500 |
commit | aa3f11586147f2a9528e59688a6607d386d2b818 (patch) | |
tree | e2b26ad9c82fcd1163df4c6acf6a4cce89527cbe /.local/bin | |
parent | 445f6eaeb94d97aa271970b0fdbbb6841dd349a4 (diff) |
Add local bin folder
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/displayselect | 70 | ||||
-rwxr-xr-x | .local/bin/dmenu_shudown | 12 | ||||
-rwxr-xr-x | .local/bin/dmenupass | 7 | ||||
-rwxr-xr-x | .local/bin/doc_compiler | 38 | ||||
-rwxr-xr-x | .local/bin/edit_screen.sh | 5 | ||||
-rwxr-xr-x | .local/bin/internet_test | 3 | ||||
-rwxr-xr-x | .local/bin/linkhandler | 22 | ||||
-rwxr-xr-x | .local/bin/mpdup | 8 | ||||
-rwxr-xr-x | .local/bin/newsup | 17 | ||||
-rwxr-xr-x | .local/bin/opout | 14 | ||||
-rwxr-xr-x | .local/bin/read_books | 8 | ||||
-rwxr-xr-x | .local/bin/set_wallpaper | 10 | ||||
-rwxr-xr-x | .local/bin/statusbar/battery | 34 | ||||
-rwxr-xr-x | .local/bin/statusbar/clock | 30 | ||||
-rwxr-xr-x | .local/bin/statusbar/mailbox | 20 | ||||
-rwxr-xr-x | .local/bin/statusbar/music | 19 | ||||
-rwxr-xr-x | .local/bin/statusbar/news | 18 | ||||
-rwxr-xr-x | .local/bin/statusbar/volume | 38 | ||||
-rwxr-xr-x | .local/bin/statusbar/weather | 35 | ||||
-rwxr-xr-x | .local/bin/texclear | 13 | ||||
-rwxr-xr-x | .local/bin/unix | 26 |
21 files changed, 447 insertions, 0 deletions
diff --git a/.local/bin/displayselect b/.local/bin/displayselect new file mode 100755 index 0000000..745fdeb --- /dev/null +++ b/.local/bin/displayselect @@ -0,0 +1,70 @@ +#!/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 + 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 + +pgrep -x dunst >/dev/null && killall dunst && setsid dunst & # Restart dunst to ensure proper location on screen diff --git a/.local/bin/dmenu_shudown b/.local/bin/dmenu_shudown new file mode 100755 index 0000000..ed868e7 --- /dev/null +++ b/.local/bin/dmenu_shudown @@ -0,0 +1,12 @@ +#!/bin/sh + +choice=$(printf "no\\nYES" | dmenu -p "Shutdown?") + +if [ "$choice" = "YES" ]; then + + choice=$(printf "no\\nYES" | dmenu -p "Are you sure?") + if [ "$choice" = "YES" ]; then + echo "Shutting down" + # shutdown -h now + fi +fi diff --git a/.local/bin/dmenupass b/.local/bin/dmenupass new file mode 100755 index 0000000..59aa75f --- /dev/null +++ b/.local/bin/dmenupass @@ -0,0 +1,7 @@ +#!/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 + diff --git a/.local/bin/doc_compiler b/.local/bin/doc_compiler new file mode 100755 index 0000000..1ae86bc --- /dev/null +++ b/.local/bin/doc_compiler @@ -0,0 +1,38 @@ +#!/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 -kept -T pdf > "$base".pdf ;; + *\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf > "$base".pdf ;; + *\.[0-9]) refer -PS -e "$file" | groff -mandoc -T pdf > "$base".pdf ;; + *\.[rR]md) Rscript -e "require(rmarkdown); rmarkdown::render('$file', quiet=TRUE)" ;; + *\.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/edit_screen.sh b/.local/bin/edit_screen.sh new file mode 100755 index 0000000..39eda14 --- /dev/null +++ b/.local/bin/edit_screen.sh @@ -0,0 +1,5 @@ +#!/bin/sh +tmpfile=$(mktemp /tmp/st-edit.XXXXXX) +trap 'rm "$tmpfile"' 0 1 15 +cat > "$tmpfile" +$TERMINAL -e "$EDITOR" "$tmpfile" diff --git a/.local/bin/internet_test b/.local/bin/internet_test new file mode 100755 index 0000000..099be10 --- /dev/null +++ b/.local/bin/internet_test @@ -0,0 +1,3 @@ +#!/bin/sh + +ping -c 3 jacksontaylor.xyz diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler new file mode 100755 index 0000000..7c7e96f --- /dev/null +++ b/.local/bin/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/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) + setsid -f mpv -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 -f tsp curl -LO "$1" >/dev/null 2>&1 ;; + *) + if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1" + else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;; +esac diff --git a/.local/bin/mpdup b/.local/bin/mpdup new file mode 100755 index 0000000..af81a7d --- /dev/null +++ b/.local/bin/mpdup @@ -0,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 diff --git a/.local/bin/newsup b/.local/bin/newsup new file mode 100755 index 0000000..29f2b3c --- /dev/null +++ b/.local/bin/newsup @@ -0,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." diff --git a/.local/bin/opout b/.local/bin/opout new file mode 100755 index 0000000..f81daa2 --- /dev/null +++ b/.local/bin/opout @@ -0,0 +1,14 @@ +#!/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 "$1" | sed 's/\.[^\/.]*$//')" + +case "$1" in + *.tex|*.md|*.[rR]md|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;; + *.[0-9]) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;; + *.html) setsid $BROWSER "$basename".html >/dev/null 2>&1 & ;; + *.sent) setsid sent "$1" >/dev/null 2>&1 & ;; +esac diff --git a/.local/bin/read_books b/.local/bin/read_books new file mode 100755 index 0000000..3ff2411 --- /dev/null +++ b/.local/bin/read_books @@ -0,0 +1,8 @@ +#!/bin/sh + +#DMENU_OPTION="dmenu -fn \"hack:size=10\" -nb \"#3c302e\" -nf \"#bbbbbb\" -sb \"#a86438\" -sf \"#000000\" -l 20" + +#du -a ~/Documents/books/* | awk '/\.pdf/{print $2}' | dmenu -fn "hack:size=10" -nb "#3c302e" -nf "#bbbbbb" -sb "#a86438" -sf "#000000" -l 20 | xargs -r $READER ; +book=$(du -a ~/Documents/books/* | awk '/\.pdf/{print $2}' | dmenu -fn "hack:size=10" -nb "#3c302e" -nf "#bbbbbb" -sb "#a86438" -sf "#000000" -l 20); +if [ -n $book ]; then $READER $book; fi + diff --git a/.local/bin/set_wallpaper b/.local/bin/set_wallpaper new file mode 100755 index 0000000..3229094 --- /dev/null +++ b/.local/bin/set_wallpaper @@ -0,0 +1,10 @@ +#!/bin/sh +pape=$1 + +if [ -z "$pape" ] +then + pape=$WALLPAPER +fi + +xwallpaper --zoom $pape +wal -i $pape diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery new file mode 100755 index 0000000..f42d096 --- /dev/null +++ b/.local/bin/statusbar/battery @@ -0,0 +1,34 @@ +#!/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 + +# acpi alternative +# acpi | sed "s/Battery [0-9]: //;s/[Dd]ischarging, /π/;s/[Nn]ot charging, /π/;s/[Cc]harging, /π/;s/[Uu]nknown, /β»οΈ/;s/[Ff]ull, /β‘/;s/ \(remaining\|until charged\)//"; exit + +# Loop through all attached batteries. +for battery in /sys/class/power_supply/BAT? +do + # Get its remaining capacity and charge status. + capacity=$(cat "$battery"/capacity 2>/dev/null) || break + status=$(sed "s/[Dd]ischarging/π/;s/[Nn]ot charging/π/;s/[Cc]harging/π/;s/[Uu]nknown/β»οΈ/;s/[Ff]ull/β‘/" "$battery"/status) + + # If it is discharging and 25% or less, we will add a β as a warning. + [ "$capacity" -le 25 ] && [ "$status" = "π" ] && warn="β" + + printf "%s%s%s%% " "$status" "$warn" "$capacity" + unset warn +done | sed 's/ *$//' diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock new file mode 100755 index 0000000..04deca4 --- /dev/null +++ b/.local/bin/statusbar/clock @@ -0,0 +1,30 @@ +#!/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 -D ~/.config/calcurse -d3)" ;; + 2) setsid -f "$TERMINAL" -e calcurse -D ~/.config/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 "+%a %m/%d/%y $icon%I:%M%p" +# date "+%Y %b %d (%a) $icon%I:%M%p" diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox new file mode 100755 index 0000000..ca77f5c --- /dev/null +++ b/.local/bin/statusbar/mailbox @@ -0,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 mailsync >/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" diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music new file mode 100755 index 0000000..faba0c3 --- /dev/null +++ b/.local/bin/statusbar/music @@ -0,0 +1,19 @@ +#!/bin/sh + +filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/βΈ/g;/\\[playing\\].*/d" | paste -sd ' ';} + +pidof -x mpdup >/dev/null 2>&1 || 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. +- 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 + 6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;; + *) mpc status | filter ;; +esac diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news new file mode 100755 index 0000000..a850aff --- /dev/null +++ b/.local/bin/statusbar/news @@ -0,0 +1,18 @@ +#!/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)" + cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>-1) print "π°" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume new file mode 100755 index 0000000..2766ed2 --- /dev/null +++ b/.local/bin/statusbar/volume @@ -0,0 +1,38 @@ +#!/bin/sh + +# Prints the current volume or π if muted. Uses PulseAudio by default, +# uncomment the ALSA lines if you remove PulseAudio. + +case $BLOCK_BUTTON in + # 1) setsid -f "$TERMINAL" -e alsamixer ;; + # 2) amixer sset Master toggle ;; + # 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;; + # 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;; + 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 + +volstat="$(pactl list sinks)" +# volstat="$(amixer get Master)" # ALSA only equivalent. + +echo "$volstat" | grep -q "Mute: yes" && printf "π\\n" && exit +# echo "$volstat" | grep "\[off\]" >/dev/null && printf "π\\n" && exit # ALSA + +vol="$(echo "$volstat" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")" +# vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA + +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..e04bac0 --- /dev/null +++ b/.local/bin/statusbar/weather @@ -0,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 +# precipication 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]\\+" | 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 diff --git a/.local/bin/texclear b/.local/bin/texclear new file mode 100755 index 0000000..2061a2e --- /dev/null +++ b/.local/bin/texclear @@ -0,0 +1,13 @@ +#!/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/unix b/.local/bin/unix new file mode 100755 index 0000000..a9fb96e --- /dev/null +++ b/.local/bin/unix @@ -0,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 |