summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/statusbar')
-rwxr-xr-x.local/bin/statusbar/cpu12
-rwxr-xr-x.local/bin/statusbar/doppler206
-rwxr-xr-x.local/bin/statusbar/internet26
-rwxr-xr-x.local/bin/statusbar/mailbox4
-rwxr-xr-x.local/bin/statusbar/news3
5 files changed, 247 insertions, 4 deletions
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)"