summaryrefslogtreecommitdiff
path: root/.scripts/not needed
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2022-03-12 19:54:51 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2022-03-12 19:54:51 +0530
commit54b772cae06eb25adf33297e35234f33ded81a7b (patch)
treef287ee48faa8013e4a8f0ee764a6d3cd850bb24d /.scripts/not needed
parent7197e45d94dbcf4877d585fff8e634896876ae83 (diff)
neovim addition
Diffstat (limited to '.scripts/not needed')
-rwxr-xr-x.scripts/not needed/doppler206
-rwxr-xr-x.scripts/not needed/forecast35
-rwxr-xr-x.scripts/not needed/help-icon17
-rwxr-xr-x.scripts/not needed/kbselect16
-rwxr-xr-x.scripts/not needed/mailbox20
-rwxr-xr-x.scripts/not needed/moonphase37
-rwxr-xr-x.scripts/not needed/mpdup8
-rwxr-xr-x.scripts/not needed/music19
-rwxr-xr-x.scripts/not needed/news17
-rwxr-xr-x.scripts/not needed/pacpackages29
-rwxr-xr-x.scripts/not needed/popupgrade9
-rwxr-xr-x.scripts/not needed/tasks20
-rwxr-xr-x.scripts/not needed/torrent27
13 files changed, 460 insertions, 0 deletions
diff --git a/.scripts/not needed/doppler b/.scripts/not needed/doppler
new file mode 100755
index 0000000..dc93db0
--- /dev/null
+++ b/.scripts/not needed/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/.scripts/not needed/forecast b/.scripts/not needed/forecast
new file mode 100755
index 0000000..7b8416e
--- /dev/null
+++ b/.scripts/not needed/forecast
@@ -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
+# precipitation chance and the daily high and low from the downloaded file and
+# display them with coresponding emojis.
+showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" |
+ grep -wo "[0-9]*%" | sort -rn | sed "s/^/β˜”/g;1q" | tr -d '\n')"
+sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " πŸ₯Ά" $1 "Β°","🌞" $2 "Β°"}' ;}
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;;
+ 2) getforecast && showweather ;;
+ 3) notify-send "🌈 Weather module" "\- Left click for full forecast.
+- Middle click to update forecast.
+β˜”: Chance of rain/snow
+πŸ₯Ά: Daily low
+🌞: Daily high" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+# The test if our forcecast is updated to the day. If it isn't download a new
+# weather report from wttr.in with the above function.
+[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
+ getforecast
+
+showweather
diff --git a/.scripts/not needed/help-icon b/.scripts/not needed/help-icon
new file mode 100755
index 0000000..8fa4a52
--- /dev/null
+++ b/.scripts/not needed/help-icon
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# The clickable help menu. Middle click to restart wm.
+
+# If dwm is running, use dwm's readme and restart.
+pidof dwm >/dev/null &&
+ READMEFILE=/usr/local/share/dwm/larbs.mom
+ restartwm() { pkill -HUP dwm ;} ||
+ restartwm() { i3 restart ;}
+
+case $BLOCK_BUTTON in
+ 1) groff -mom "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom}" -Tpdf | zathura - ;;
+ 2) restartwm ;;
+ 3) notify-send "❓ Help module" "\- Left click to open LARBS guide.
+- Middle click to refresh window manager." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac; echo "❓"
diff --git a/.scripts/not needed/kbselect b/.scripts/not needed/kbselect
new file mode 100755
index 0000000..f0c923f
--- /dev/null
+++ b/.scripts/not needed/kbselect
@@ -0,0 +1,16 @@
+#!/bin/sh
+# works on any init system
+# requirements: dmenu, xorg-setxkbmap
+kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1
+
+case $BLOCK_BUTTON in
+ 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)"
+ kb="$(echo "$kb_choice" | awk '{print $3}')"
+ setxkbmap "$kb"
+ pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";;
+ 3) notify-send "⌨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')")
+- Left click to change keyboard.";;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+echo "$kb"
diff --git a/.scripts/not needed/mailbox b/.scripts/not needed/mailbox
new file mode 100755
index 0000000..2132184
--- /dev/null
+++ b/.scripts/not needed/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 mw -Y >/dev/null ;;
+ 3) notify-send "πŸ“¬ Mail module" "\- Shows unread mail
+- Shows πŸ”ƒ if syncing mail
+- Left click opens neomutt
+- Middle click syncs mail" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
+
+pidof mbsync >/dev/null 2>&1 && icon="πŸ”ƒ"
+
+[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "πŸ“¬$unread$icon"
diff --git a/.scripts/not needed/moonphase b/.scripts/not needed/moonphase
new file mode 100755
index 0000000..fab8b4d
--- /dev/null
+++ b/.scripts/not needed/moonphase
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Shows the current moon phase.
+
+moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
+
+[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
+ { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;}
+
+icon="$(cat "$moonfile")"
+
+case "$icon" in
+ πŸŒ‘) name="New" ;;
+ πŸŒ’) name="Waxing Crescent" ;;
+ πŸŒ“) name="First Quarter" ;;
+ πŸŒ”) name="Waxing Gibbous" ;;
+ πŸŒ•) name="Full" ;;
+ πŸŒ–) name="Waning Gibbous" ;;
+ πŸŒ—) name="Last Quarter" ;;
+ 🌘) name="Waning Crescent" ;;
+ *) exit 1 ;;
+esac
+
+echo "${icon-?}"
+
+case $BLOCK_BUTTON in
+ 3) notify-send "🌜 Moon phase module" "Displays current moon phase.
+- πŸŒ‘: New
+- πŸŒ’: Waxing Crescent
+- πŸŒ“: First Quarter
+- πŸŒ”: Waxing Gibbous
+- πŸŒ•: Full
+- πŸŒ–: Waning Gibbous
+- πŸŒ—: Last Quarter
+- 🌘: Waning Crescent" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
diff --git a/.scripts/not needed/mpdup b/.scripts/not needed/mpdup
new file mode 100755
index 0000000..af81a7d
--- /dev/null
+++ b/.scripts/not needed/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/.scripts/not needed/music b/.scripts/not needed/music
new file mode 100755
index 0000000..7ea7032
--- /dev/null
+++ b/.scripts/not needed/music
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+filter() { mpc | sed "/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;}
+
+pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
+
+case $BLOCK_BUTTON in
+ 1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause
+ 2) mpc toggle | filter ;; # right click, pause/unpause
+ 3) mpc status | filter ; notify-send "🎡 Music module" "\- Shows mpd song playing.
+- ⏸ when paused.
+- Left click opens ncmpcpp.
+- Middle click pauses.
+- Scroll changes track.";; # right click, pause/unpause
+ 4) mpc prev | filter ;; # scroll up, previous
+ 5) mpc next | filter ;; # scroll down, next
+ 6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;;
+ *) mpc status | filter ;;
+esac
diff --git a/.scripts/not needed/news b/.scripts/not needed/news
new file mode 100755
index 0000000..fe701db
--- /dev/null
+++ b/.scripts/not needed/news
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Displays number of unread news items and an loading icon if updating.
+# When clicked, brings up `newsboat`.
+
+case $BLOCK_BUTTON in
+ 1) setsid "$TERMINAL" -e newsboat ;;
+ 2) setsid -f newsup >/dev/null exit ;;
+ 3) notify-send "πŸ“° News module" "\- Shows unread news items
+- Shows πŸ”ƒ if updating with \`newsup\`
+- Left click opens newsboat
+- Middle click syncs RSS feeds
+<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+ cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "πŸ“°" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)"
diff --git a/.scripts/not needed/pacpackages b/.scripts/not needed/pacpackages
new file mode 100755
index 0000000..37ebed3
--- /dev/null
+++ b/.scripts/not needed/pacpackages
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Displays number of upgradeable packages.
+# For this to work, have a `pacman -Sy` command run in the background as a
+# cronjob every so often as root. This script will then read those packages.
+# When clicked, it will run an upgrade via pacman.
+#
+# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook:
+#
+# [Trigger]
+# Operation = Upgrade
+# Type = Package
+# Target = *
+#
+# [Action]
+# Description = Updating statusbar...
+# When = PostTransaction
+# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e sb-popupgrade ;;
+ 2) notify-send "$(/usr/bin/pacman -Qu)" ;;
+ 3) notify-send "🎁 Upgrade module" "πŸ“¦: number of upgradable packages
+- Left click to upgrade packages
+- Middle click to show upgradable packages" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/πŸ“¦/;s/^πŸ“¦0$//g"
diff --git a/.scripts/not needed/popupgrade b/.scripts/not needed/popupgrade
new file mode 100755
index 0000000..29d6230
--- /dev/null
+++ b/.scripts/not needed/popupgrade
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+printf "Beginning upgrade.\\n"
+
+yay -Syu
+pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
+
+printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
+read -r _
diff --git a/.scripts/not needed/tasks b/.scripts/not needed/tasks
new file mode 100755
index 0000000..586300e
--- /dev/null
+++ b/.scripts/not needed/tasks
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Originally by Andr3as07 <https://github.com/Andr3as07>
+# Some changes by Luke
+# Rebuild by Tenyun
+
+# This block displays the number running background tasks. Requires tsp.
+
+num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}')
+
+# Handle mouse clicks
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e tsp -l ;;
+ 3) notify-send "Tasks module" "πŸ€–: number of running/queued background tasks
+- Left click opens tsp" ;; # Right click
+ 2) $EDITOR "$0" ;; # Middle click
+esac
+
+[ "$num" != "0(0)" ] &&
+ echo "πŸ€–$num"
diff --git a/.scripts/not needed/torrent b/.scripts/not needed/torrent
new file mode 100755
index 0000000..6527005
--- /dev/null
+++ b/.scripts/not needed/torrent
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+transmission-remote -l | grep % |
+ sed " # The letters are for sorting and will not appear.
+ s/.*Stopped.*/A πŸ›‘/;
+ s/.*Seeding.*/Z 🌱/;
+ s/.*100%.*/N βœ…/;
+ s/.*Idle.*/B πŸ•°οΈ/;
+ s/.*Uploading.*/L ⬆️/;
+ s/.*%.*/M ⬇️/" |
+ sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' -
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e tremc ;;
+ 2) td-toggle ;;
+ 3) notify-send "🌱 Torrent module" "\- Left click to open tremc.
+- Middle click to toggle transmission.
+- Shift click to edit script.
+Module shows number of torrents:
+πŸ›‘: paused
+πŸ•°: idle (seeds needed)
+πŸ”Ό: uploading (unfinished)
+πŸ”½: downloading
+βœ…: done
+🌱: done and seeding" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac