diff options
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/compiler | 57 | ||||
-rwxr-xr-x | .local/bin/dmenuhandler | 21 | ||||
-rwxr-xr-x | .local/bin/dmenurecord | 123 | ||||
-rwxr-xr-x | .local/bin/dmenuunicode | 18 | ||||
-rwxr-xr-x | .local/bin/linkhandler | 11 | ||||
-rwxr-xr-x | .local/bin/maimpick | 14 | ||||
-rwxr-xr-x | .local/bin/newsup | 4 | ||||
-rwxr-xr-x | .local/bin/peertubetorrent | 7 | ||||
-rwxr-xr-x | .local/bin/qndl | 12 | ||||
-rwxr-xr-x | .local/bin/read_books | 2 | ||||
-rwxr-xr-x | .local/bin/shortcuts | 40 | ||||
-rwxr-xr-x | .local/bin/statusbar/cpu | 12 | ||||
-rwxr-xr-x | .local/bin/statusbar/doppler | 206 | ||||
-rwxr-xr-x | .local/bin/statusbar/internet | 26 | ||||
-rwxr-xr-x | .local/bin/statusbar/mailbox | 4 | ||||
-rwxr-xr-x | .local/bin/statusbar/news | 3 | ||||
-rwxr-xr-x | .local/bin/transadd | 9 | ||||
-rwxr-xr-x | .local/bin/ytrss | 3 |
18 files changed, 559 insertions, 13 deletions
diff --git a/.local/bin/compiler b/.local/bin/compiler new file mode 100755 index 0000000..faf37c9 --- /dev/null +++ b/.local/bin/compiler @@ -0,0 +1,57 @@ +#!/bin/sh + +# This script will compile or run another finishing operation on a document. I +# have this script run via vim. +# +# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent +# presentations. Runs scripts based on extention or shebang. +# +# Note that .tex files which you wish to compile with XeLaTeX should have the +# string "xelatex" somewhere in a comment/command in the first 5 lines. + +file=$(readlink -f "$1") +dir=${file%/*} +base="${file%.*}" +ext="${file##*.}" + +cd "$dir" || exit 1 + +textype() { \ + command="pdflatex" + ( head -n5 "$file" | grep -qi 'xelatex' ) && command="xelatex" + $command --output-directory="$dir" "$base" && + grep -qi addbibresource "$file" && + biber --input-directory "$dir" "$base" && + $command --output-directory="$dir" "$base" && + $command --output-directory="$dir" "$base" +} + +case "$ext" in + # Try to keep these cases in alphabetical order. + [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; + c) cc "$file" -o "$base" && "$base" ;; + cpp) g++ "$file" -o "$base" && "$base" ;; + cs) mcs "$file" && mono "$base".exe ;; + go) go run "$file" ;; + h) sudo make install ;; + java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; + m) octave "$file" ;; + md) if [ -x "$(command -v lowdown)" ]; then + lowdown -d nointem -e super "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf + elif [ -x "$(command -v groffdown)" ]; then + groffdown -i "$file" | groff > "$base.pdf" + else + pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" + fi ; ;; + mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; + ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; + org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;; + py) python "$file" ;; + [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; + rs) cargo build ;; + sass) sassc -a "$file" "$base.css" ;; + scad) openscad -o "$base".stl "$file" ;; + sent) setsid -f sent "$file" 2>/dev/null ;; + tex) textype "$file" ;; + *) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;; +esac diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler new file mode 100755 index 0000000..e5de8ef --- /dev/null +++ b/.local/bin/dmenuhandler @@ -0,0 +1,21 @@ +#!/bin/sh + +# Feed this script a link and it will give dmenu +# some choice programs to use to open it. +feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}" + +case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dl\\nqueue yt-dl audio" | dmenu -i -p "Open it with?")" in + "copy url") echo "$feed" | xclip -selection clipboard ;; + mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;; + "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;; + "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;; + "queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;; + "queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;; + "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; + PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;; + browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; + lynx) lynx "$feed" >/dev/null 2>&1 ;; +esac diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord new file mode 100755 index 0000000..b83a7c5 --- /dev/null +++ b/.local/bin/dmenurecord @@ -0,0 +1,123 @@ +#!/bin/sh + +# Usage: +# `$0`: Ask for recording type via dmenu +# `$0 screencast`: Record both audio and screen +# `$0 video`: Record only screen +# `$0 audio`: Record only audio +# `$0 kill`: Kill existing recording +# +# If there is already a running instance, user will be prompted to end it. + +updateicon() { \ + echo "$1" > /tmp/recordingicon + pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" + } + +killrecording() { + recpid="$(cat /tmp/recordingpid)" + # kill with SIGTERM, allowing finishing touches. + kill -15 "$recpid" + rm -f /tmp/recordingpid + updateicon "" + pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" + # even after SIGTERM, ffmpeg may still run, so SIGKILL it. + sleep 3 + kill -9 "$recpid" + exit + } + +screencast() { \ + ffmpeg -y \ + -f x11grab \ + -framerate 60 \ + -s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \ + -i "$DISPLAY" \ + -f alsa -i default \ + -r 30 \ + -c:v h264 -crf 0 -preset ultrafast -c:a aac \ + "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" & + echo $! > /tmp/recordingpid + updateicon "βΊοΈποΈ" + } + +video() { ffmpeg \ + -f x11grab \ + -s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \ + -i "$DISPLAY" \ + -c:v libx264 -qp 0 -r 30 \ + "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "βΊοΈ" + } + +webcamhidef() { ffmpeg \ + -f v4l2 \ + -i /dev/video0 \ + -video_size 1920x1080 \ + "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "π₯" + } + +webcam() { ffmpeg \ + -f v4l2 \ + -i /dev/video0 \ + -video_size 640x480 \ + "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "π₯" + } + + +audio() { \ + ffmpeg \ + -f alsa -i default \ + -c:a flac \ + "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & + echo $! > /tmp/recordingpid + updateicon "ποΈ" + } + +askrecording() { \ + choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") + case "$choice" in + screencast) screencast;; + audio) audio;; + video) video;; + *selected) videoselected;; + webcam) webcam;; + "webcam (hi-def)") webcamhidef;; + esac + } + +asktoend() { \ + response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") && + [ "$response" = "Yes" ] && killrecording + } + +videoselected() +{ + slop -f "%x %y %w %h" > /tmp/slop + read -r X Y W H < /tmp/slop + rm /tmp/slop + + ffmpeg \ + -f x11grab \ + -framerate 60 \ + -video_size "$W"x"$H" \ + -i :0.0+"$X,$Y" \ + -c:v libx264 -qp 0 -r 30 \ + "$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "βΊοΈ" +} + +case "$1" in + screencast) screencast;; + audio) audio;; + video) video;; + *selected) videoselected;; + kill) killrecording;; + *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; +esac diff --git a/.local/bin/dmenuunicode b/.local/bin/dmenuunicode new file mode 100755 index 0000000..c6d9ddd --- /dev/null +++ b/.local/bin/dmenuunicode @@ -0,0 +1,18 @@ +#!/bin/sh + +# The famous "get a menu of emojis to copy" script. + +# Get user selection via dmenu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/emoji.txt | dmenu -i -l 30 | sed "s/ .*//") + +# Exit if none chosen. +[ -z "$chosen" ] && exit + +# If you run this command with an argument, it will automatically insert the +# character. Otherwise, show a message that the emoji has been copied. +if [ -n "$1" ]; then + xdotool type "$chosen" +else + printf "$chosen" | xclip -selection clipboard + notify-send "'$chosen' copied to clipboard." & +fi diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler index 7c7e96f..fa74caf 100755 --- a/.local/bin/linkhandler +++ b/.local/bin/linkhandler @@ -10,13 +10,14 @@ [ -z "$1" ] && { "$BROWSER"; exit; } case "$1" in - *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) + *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;; *png|*jpg|*jpe|*jpeg|*gif) - curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; + curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *pdf|*cbz|*cbr) + curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) - setsid -f tsp curl -LO "$1" >/dev/null 2>&1 ;; + qndl "$1" 'curl -LO' >/dev/null 2>&1 ;; *) - if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1" - else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;; + [ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1 esac diff --git a/.local/bin/maimpick b/.local/bin/maimpick new file mode 100755 index 0000000..7125e61 --- /dev/null +++ b/.local/bin/maimpick @@ -0,0 +1,14 @@ +#!/bin/sh + +# This is bound to Shift+PrintScreen by default, requires maim. It lets you +# choose the kind of screenshot to take, including copying the image or even +# highlighting an area to copy. scrotcucks on suicidewatch right now. + +case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in + "a selected area") maim -s pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;; + "current window") maim -i "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;; + "full screen") maim pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;; + "a selected area (copy)") maim -s | xclip -selection clipboard -t image/png ;; + "current window (copy)") maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;; + "full screen (copy)") maim | xclip -selection clipboard -t image/png ;; +esac diff --git a/.local/bin/newsup b/.local/bin/newsup index 29f2b3c..ed266d7 100755 --- a/.local/bin/newsup +++ b/.local/bin/newsup @@ -3,11 +3,9 @@ # 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 +pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit echo π > /tmp/newsupdate pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" diff --git a/.local/bin/peertubetorrent b/.local/bin/peertubetorrent new file mode 100755 index 0000000..7a7a483 --- /dev/null +++ b/.local/bin/peertubetorrent @@ -0,0 +1,7 @@ +#!/bin/sh +# torrent peertube videos, requires the transadd script +# first argument is the video link, second is the quality (480 or 1080) +# 13/07/20 - Arthur Bais + +link="$(echo "$1" | sed "s/w/download\/torrents/")""-$2.torrent" +transadd "$link" diff --git a/.local/bin/qndl b/.local/bin/qndl new file mode 100755 index 0000000..f6fbe87 --- /dev/null +++ b/.local/bin/qndl @@ -0,0 +1,12 @@ +#!/bin/sh + +# $1 is a url; $2 is a command +[ -z "$1" ] && exit +base="$(basename "$1")" +notify-send "β³ Queuing $base..." +cmd="$2" +[ -z "$cmd" ] && cmd="youtube-dl --add-metadata -ic" +idnum="$(tsp $cmd "$1")" +realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")" +tsp -D "$idnum" mv "$base" "$realname" +tsp -D "$idnum" notify-send "π $realname done." diff --git a/.local/bin/read_books b/.local/bin/read_books index 3ff2411..9c4b82f 100755 --- a/.local/bin/read_books +++ b/.local/bin/read_books @@ -3,6 +3,6 @@ #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); +book=$(du -a ~/Documents/books/* | awk '/\.(pdf)|(epub)/{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/shortcuts b/.local/bin/shortcuts new file mode 100755 index 0000000..2984863 --- /dev/null +++ b/.local/bin/shortcuts @@ -0,0 +1,40 @@ +#!/bin/sh + +bmdirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" +bmfiles="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files" + +# Output locations. Unactivated progs should go to /dev/null. +shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" +zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" +lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc" +ranger_shortcuts="$HOME/.config/ranger/shortcuts.conf" +qute_shortcuts="/dev/null" +fish_shortcuts="/dev/null" +vifm_shortcuts="/dev/null" + +# Remove, prepare files +rm -f "$lf_shortcuts" "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null +printf "# vim: filetype=sh\\n" > "$fish_shortcuts" +printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" +printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" + +# Format the `directories` file in the correct syntax and sent it to all three configs. +eval "echo \"$(cat "$bmdirs")\"" | \ +awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); + printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; + printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; + printf(\"abbr %s \42cd %s; and ls -a\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ; + printf(\"map g%s :cd %s<CR>\nmap t%s <tab>:cd %s<CR><tab>\nmap M%s <tab>:cd %s<CR><tab>:mo<CR>\nmap Y%s <tab>:cd %s<CR><tab>:co<CR> \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ; + printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ; + printf(\"map g%s cd %s\nmap t%s tab_new %s\nmap m%s shell mv -v %%s %s\nmap Y%s shell cp -rv %%s %s \n\",\$1,\$2,\$1,\$2, \$1, \$2, \$1, \$2) >> \"$ranger_shortcuts\" ; + printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }" + +# Format the `files` file in the correct syntax and sent it to both configs. +eval "echo \"$(cat "$bmfiles")\"" | \ +awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); + printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; + printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; + printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ; + printf(\"map %s :e %s<CR> \n\",\$1,\$2) >> \"$vifm_shortcuts\" ; + printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" ; + printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" }" diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu new file mode 100755 index 0000000..1572b52 --- /dev/null +++ b/.local/bin/statusbar/cpu @@ -0,0 +1,12 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "π₯ CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; + 2) setsid -f "$TERMINAL" -e htop ;; + 3) notify-send "π₯ CPU module " "\- Shows CPU temperature. +- Click to show intensive processes. +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +sensors | awk '/Core 0/ {print "π‘" $3}' diff --git a/.local/bin/statusbar/doppler b/.local/bin/statusbar/doppler new file mode 100755 index 0000000..dc93db0 --- /dev/null +++ b/.local/bin/statusbar/doppler @@ -0,0 +1,206 @@ +#!/bin/sh + +# Show a Doppler RADAR of an American user's preferred location. + +secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds. +radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar" +doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif" + +pickloc() { chosen="$(echo "Northeast +Southeast +PacNorthWest +PacSouthWest +UpperMissVly +SouthMissVly +SouthPlains +NorthRockies +SouthRockies +Alaska +Carib +Hawaii +CentGrLakes +Conus-Large +KABR: Aberdeen, SD +KBIS: Bismarck, ND +KFTG: Denver/Boulder, CO +KDMX: Des Moines, IA +KDTX: Detroit, MI +KDDC: Dodge City, KS +KDLH: Duluth, MN +KCYS: Cheyenne, WY +KLOT: Chicago, IL +KGLD: Goodland, KS +KUEX: Hastings, NE +KGJX: Grand Junction, CO +KGRR: Grand Rapids, MI +KMVX: Fargo/Grand Forks, ND +KGRB: Green Bay, WI +KIND: Indianapolis, IN +KJKL: Jackson, KY +KARX: La Crosse, WI +KILX: Lincoln/Central Illinois, IL +KLVX: Louisville, KY +KMQT: Marquette +KMKX: Milwaukee, WI +KMPX: Minneapolis, MN +KAPX: Gaylord/Alpena, MI +KLNX: North Platte, NE +KIWX: N. Webster/Northern, IN +KOAX: Omaha, NE +KPAH: Paducah, KY +KEAX: Pleasant Hill, MO +KPUX: Pueblo, CO +KDVN: Quad Cities, IA +KUDX: Rapid City, SD +KRIW: Riverton, WY +KSGF: Springfield, MO +KLSX: St. LOUIS, MO +KFSD: Sioux Falls, IA +KTWX: Topeka, KS +KICT: Wichita, KS +KVWX: Paducah, KY +ICAO: Responsible Wfo +KLTX: WILMINGTON, NC +KCCX: State College/Central, PA +KLWX: Sterling, VA +KFCX: Blacksburg/Roanoke, VA +KRAX: Raleigh/Durham, NC +KGYX: Portland, ME +KDIX: Mt Holly/Philadelphia, PA +KPBZ: Pittsburgh, PA +KAKQ: Wakefield, VA +KMHX: Morehead City, NC +KGSP: Greer/Greenville/Sprtbg, SC +KILN: Wilmington/Cincinnati, OH +KCLE: Cleveland, OH +KCAE: Columbia, SC +KBGM: Binghamton, NY +KENX: Albany, NY +KBUF: Buffalo, NY +KCXX: Burlington, VT +KCBW: Caribou, ME +KBOX: Boston /Taunton, MA +KOKX: New York City, NY +KCLX: Charleston, SC +KRLX: Charleston, WV +ICAO: Responsible WFO +KBRO: Brownsville, TX +KABX: Albuquerque, NM +KAMA: Amarillo, TX +KFFC: Peachtree City/Atlanta, GA +KEWX: Austin/Sanantonio, TX +KBMX: Birmingham, AL +KCRP: Corpus Christi, TX +KFWS: Dallas / Ft. Worth, TX +KEPZ: El Paso, TX +KHGX: Houston/ Galveston, TX +KJAX: Jacksonville, FL +KBYX: Key West, FL +KMRX: Morristown/knoxville, TN +KLBB: Lubbock, TX +KLZK: Little Rock, AR +KLCH: Lake Charles, LA +KOHX: Nashville, TN +KMLB: Melbourne, FL +KNQA: Memphis, TN +KAMX: Miami, FL +KMAF: Midland/odessa, TX +KTLX: Norman, OK +KHTX: Huntsville, AL +KMOB: Mobile, AL +KTLH: Tallahassee, FL +KTBW: Tampa Bay Area, FL +KSJT: San Angelo, TX +KINX: Tulsa, OK +KSRX: Tulsa, OK +KLIX: New Orleans/slidell, LA +KDGX: Jackson, MS +KSHV: Shreveport, LA +ICAO: Responsible WFO +KLGX: Seattle / Tacoma, WA +KOTX: Spokane, WA +KEMX: Tucson, AZ +KYUX: Phoenix, AZ +KNKX: San Diego, CA +KMUX: Monterey/san Francisco, CA +KHNX: San Joaquin/hanford, CA +KSOX: San Diego, CA +KATX: Seattle / Tacoma, WA +KIWA: Phoenix, AZ +KRTX: Portland, OR +KSFX: Pocatello, ID +KRGX: Reno, NV +KDAX: Sacramento, CA +KMTX: Salt Lake City, UT +KPDT: Pendleton, OR +KMSX: Missoula, MT +KESX: Las Vegas, NV +KVTX: Los Angeles, CA +KMAX: Medford, OR +KFSX: Flagstaff, AZ +KGGW: Glasgow, MT +KLRX: Elko, NV +KBHX: Eureka, CA +KTFX: Great Falls, MT +KCBX: Boise, ID +KBLX: Billings, MT +KICX: Salt Lake City, UT +ICAO: Responsible Wfo W/ MSCF +PABC: Anchorage, AK +PAPD: Fairbanks, AK +PHKM: Honolulu, HI +PAHG: Anchorage, AK +PAKC: Anchorage, AK +PAIH: Anchorage, AK +PHMO: Honolulu, HI +PAEC: Fairbanks, AK +TJUA: San Juan, PR +PACG: Juneau, AK +PHKI: Honolulu, HI +PHWA: Honolulu, HI +ICAO: Responsible Wfo W/ MSCF +KFDR: Norman, OK +PGUA: Guam +KBBX: Sacramento, CA +KFDX: Albuquerque, NM +KGWX: Jackson, MS +KDOX: Wakefield, VA +KDYX: San Angelo, TX +KEYX: Las Vegas, NV +KEVX: Mobile, AL +KHPX: Paducah, KY +KTYX: Burlington, VT +KGRK: Dallas / Ft. Worth, TX +KPOE: Lake Charles, LA +KEOX: Tallahassee, FL +KHDX: El Paso, TX +KDFX: San Antonio, TX +KMXX: Birmingham, AL +KMBX: Bismarck, ND +KVAX: Jacksonville, FL +KJGX: Peachtree City/atlanta, GA +KVNX: Norman, OK +KVBX: Vandenberg Afb: Orcutt, CA" | dmenu -r -i -l 50 -p "Select a National Weather Service radar to use as default:" | sed "s/:.*//" | tr "[:lower:]" "[:upper:]")" + +# Sanity check of selection and ensure user did not escape. +echo "$chosen" | grep -q "^[A-Z]\+$" && echo "$chosen" > "$radarloc" ;} + +getdoppler() { + loc="$(cat "$radarloc")" + notify-send "π¦οΈ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc." + curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;} + +showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" ;} + +case $BLOCK_BUTTON in + 1) [ ! -f "$radarloc" ] && pickloc && getdoppler + [ $(($(date '+%s') - $(stat -c %Y "$doppler"))) -gt "$secs" ] && getdoppler + showdoppler ;; + 2) pickloc && getdoppler && showdoppler ;; + 3) notify-send "πΊοΈ Doppler RADAR module" "\- Left click for local Doppler RADAR. +- Middle click to update change RADAR location. +After $secs seconds, new clicks will also automatically update the doppler RADAR." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +echo πΊοΈ diff --git a/.local/bin/statusbar/internet b/.local/bin/statusbar/internet new file mode 100755 index 0000000..94b7da2 --- /dev/null +++ b/.local/bin/statusbar/internet @@ -0,0 +1,26 @@ +#!/bin/sh + +# Show wifi πΆ and percent strength or π‘ if none. +# Show π if connected to ethernet or β if none. +# Show π if a vpn connection is active + +case $BLOCK_BUTTON in + 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; + 3) notify-send "π Internet module" "\- Click to connect +β: wifi disabled +π‘: no wifi connection +πΆ: wifi connection with quality +β: no ethernet +π: ethernet working +π: vpn is active +" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then + wifiicon="$(awk '/^\s*w/ { print "πΆ", int($3 * 100 / 70) "% " }' /proc/net/wireless)" +elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then + grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="π‘ " || wifiicon="β " +fi + +printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/β/;s/up/π/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/π/" /sys/class/net/tun*/operstate 2>/dev/null)" diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox index ca77f5c..4d40f60 100755 --- a/.local/bin/statusbar/mailbox +++ b/.local/bin/statusbar/mailbox @@ -5,7 +5,7 @@ case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e neomutt ;; - 2) setsid -f mailsync >/dev/null ;; + 2) setsid -f mw -Y >/dev/null ;; 3) notify-send "π¬ Mail module" "\- Shows unread mail - Shows π if syncing mail - Left click opens neomutt @@ -13,7 +13,7 @@ case $BLOCK_BUTTON in 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)" +unread="$(/bin/find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)" pidof mbsync >/dev/null 2>&1 && icon="π" diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news index a850aff..4ddd50c 100755 --- a/.local/bin/statusbar/news +++ b/.local/bin/statusbar/news @@ -14,5 +14,4 @@ case $BLOCK_BUTTON in 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)" +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)" diff --git a/.local/bin/transadd b/.local/bin/transadd new file mode 100755 index 0000000..a598fad --- /dev/null +++ b/.local/bin/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, hence the sleep. + +pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") + +transmission-remote -a "$@" && notify-send "π½ Torrent added." diff --git a/.local/bin/ytrss b/.local/bin/ytrss new file mode 100755 index 0000000..9703399 --- /dev/null +++ b/.local/bin/ytrss @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "https://www.youtube.com/feeds/videos.xml?channel_id=$1 \"~$2\"" |