aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.local/bin/cron/checkup8
-rwxr-xr-x.local/bin/cron/newsup2
-rwxr-xr-x.local/bin/sb-scripts/sb-doppler241
-rwxr-xr-x.local/bin/sb-scripts/sb-internet41
-rwxr-xr-x.local/bin/sb-scripts/sb-mouse26
-rwxr-xr-x.local/bin/sb-scripts/sb-news17
-rwxr-xr-x.local/bin/sb-scripts/sb-pacpackages29
-rwxr-xr-x.local/bin/sb-scripts/sb-popupgrade9
8 files changed, 368 insertions, 5 deletions
diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup
index a571a35..fbe8e0f 100755
--- a/.local/bin/cron/checkup
+++ b/.local/bin/cron/checkup
@@ -2,16 +2,16 @@
# Syncs repositories and downloads updates, meant to be run as a cronjob.
-notify-send " Repository Sync" "Checking for package updates..."
+notify-send "📦 Repository Sync" "Checking for package updates..."
doas 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 "${STATUSBAR:-i3blocks}"
+pkill -RTMIN+8 "${STATUSBAR:-waybar}"
if pacman -Qu | rg -v "\[ignored\]"
then
- notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
+ notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update."
else
- notify-send " Repository Sync" "Sync complete. No new packages for update."
+ notify-send "📦 Repository Sync" "Sync complete. No new packages for update."
fi
diff --git a/.local/bin/cron/newsup b/.local/bin/cron/newsup
index 2fb090c..a53c2e2 100755
--- a/.local/bin/cron/newsup
+++ b/.local/bin/cron/newsup
@@ -8,7 +8,7 @@ export WAYLAND_DISPLAY=wayland-1
/usr/bin/notify-send "󰎕 Updating RSS feeds..."
-pgrep -f newsraft$ && hyprctl --instance 0 dispatch sendshortcut ,R ,title:newsraft && exit
+pgrep -f newsraft$ && hyprctl --instance 0 dispatch sendshortcut ,R ,title:newsraft
echo 🔃 > /tmp/newsupdate
pkill -RTMIN+6 "${STATUSBAR:-waybar}"
diff --git a/.local/bin/sb-scripts/sb-doppler b/.local/bin/sb-scripts/sb-doppler
new file mode 100755
index 0000000..1930752
--- /dev/null
+++ b/.local/bin/sb-scripts/sb-doppler
@@ -0,0 +1,241 @@
+#!/bin/sh
+
+# Show a Doppler RADAR of a 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 "US: CONUS: Continental United States
+US: Northeast
+US: Southeast
+US: PacNorthWest
+US: PacSouthWest
+US: UpperMissVly
+US: SouthMissVly
+US: SouthPlains
+US: NorthRockies
+US: SouthRockies
+US: Alaska
+US: Carib
+US: Hawaii
+US: CentGrLakes
+US: Conus-Large
+US: KABR: Aberdeen, SD
+US: KBIS: Bismarck, ND
+US: KFTG: Denver/Boulder, CO
+US: KDMX: Des Moines, IA
+US: KDTX: Detroit, MI
+US: KDDC: Dodge City, KS
+US: KDLH: Duluth, MN
+US: KCYS: Cheyenne, WY
+US: KLOT: Chicago, IL
+US: KGLD: Goodland, KS
+US: KUEX: Hastings, NE
+US: KGJX: Grand Junction, CO
+US: KGRR: Grand Rapids, MI
+US: KMVX: Fargo/Grand Forks, ND
+US: KGRB: Green Bay, WI
+US: KIND: Indianapolis, IN
+US: KJKL: Jackson, KY
+US: KARX: La Crosse, WI
+US: KILX: Lincoln/Central Illinois, IL
+US: KLVX: Louisville, KY
+US: KMQT: Marquette
+US: KMKX: Milwaukee, WI
+US: KMPX: Minneapolis, MN
+US: KAPX: Gaylord/Alpena, MI
+US: KLNX: North Platte, NE
+US: KIWX: N. Webster/Northern, IN
+US: KOAX: Omaha, NE
+US: KPAH: Paducah, KY
+US: KEAX: Pleasant Hill, MO
+US: KPUX: Pueblo, CO
+US: KDVN: Quad Cities, IA
+US: KUDX: Rapid City, SD
+US: KRIW: Riverton, WY
+US: KSGF: Springfield, MO
+US: KLSX: St. LOUIS, MO
+US: KFSD: Sioux Falls, SD
+US: KTWX: Topeka, KS
+US: KICT: Wichita, KS
+US: KVWX: Paducah, KY
+US: ICAO: Responsible Wfo
+US: KLTX: WILMINGTON, NC
+US: KCCX: State College/Central, PA
+US: KLWX: Sterling, VA
+US: KFCX: Blacksburg/Roanoke, VA
+US: KRAX: Raleigh/Durham, NC
+US: KGYX: Portland, ME
+US: KDIX: Mt Holly/Philadelphia, PA
+US: KPBZ: Pittsburgh, PA
+US: KAKQ: Wakefield, VA
+US: KMHX: Morehead City, NC
+US: KGSP: Greer/Greenville/Sprtbg, SC
+US: KILN: Wilmington/Cincinnati, OH
+US: KCLE: Cleveland, OH
+US: KCAE: Columbia, SC
+US: KBGM: Binghamton, NY
+US: KENX: Albany, NY
+US: KBUF: Buffalo, NY
+US: KCXX: Burlington, VT
+US: KCBW: Caribou, ME
+US: KBOX: Boston /Taunton, MA
+US: KOKX: New York City, NY
+US: KCLX: Charleston, SC
+US: KRLX: Charleston, WV
+US: ICAO: Responsible WFO
+US: KBRO: Brownsville, TX
+US: KABX: Albuquerque, NM
+US: KAMA: Amarillo, TX
+US: KFFC: Peachtree City/Atlanta, GA
+US: KEWX: Austin/Sanantonio, TX
+US: KBMX: Birmingham, AL
+US: KCRP: Corpus Christi, TX
+US: KFWS: Dallas / Ft. Worth, TX
+US: KEPZ: El Paso, TX
+US: KHGX: Houston/ Galveston, TX
+US: KJAX: Jacksonville, FL
+US: KBYX: Key West, FL
+US: KMRX: Morristown/knoxville, TN
+US: KLBB: Lubbock, TX
+US: KLZK: Little Rock, AR
+US: KLCH: Lake Charles, LA
+US: KOHX: Nashville, TN
+US: KMLB: Melbourne, FL
+US: KNQA: Memphis, TN
+US: KAMX: Miami, FL
+US: KMAF: Midland/odessa, TX
+US: KTLX: Norman, OK
+US: KHTX: Huntsville, AL
+US: KMOB: Mobile, AL
+US: KTLH: Tallahassee, FL
+US: KTBW: Tampa Bay Area, FL
+US: KSJT: San Angelo, TX
+US: KINX: Tulsa, OK
+US: KSRX: Tulsa, OK
+US: KLIX: New Orleans/slidell, LA
+US: KDGX: Jackson, MS
+US: KSHV: Shreveport, LA
+US: ICAO: Responsible WFO
+US: KLGX: Seattle / Tacoma, WA
+US: KOTX: Spokane, WA
+US: KEMX: Tucson, AZ
+US: KYUX: Phoenix, AZ
+US: KNKX: San Diego, CA
+US: KMUX: Monterey/san Francisco, CA
+US: KHNX: San Joaquin/hanford, CA
+US: KSOX: San Diego, CA
+US: KATX: Seattle / Tacoma, WA
+US: KIWA: Phoenix, AZ
+US: KRTX: Portland, OR
+US: KSFX: Pocatello, ID
+US: KRGX: Reno, NV
+US: KDAX: Sacramento, CA
+US: KMTX: Salt Lake City, UT
+US: KPDT: Pendleton, OR
+US: KMSX: Missoula, MT
+US: KESX: Las Vegas, NV
+US: KVTX: Los Angeles, CA
+US: KMAX: Medford, OR
+US: KFSX: Flagstaff, AZ
+US: KGGW: Glasgow, MT
+US: KLRX: Elko, NV
+US: KBHX: Eureka, CA
+US: KTFX: Great Falls, MT
+US: KCBX: Boise, ID
+US: KBLX: Billings, MT
+US: KICX: Salt Lake City, UT
+US: ICAO: Responsible Wfo W/ MSCF
+US: PABC: Anchorage, AK
+US: PAPD: Fairbanks, AK
+US: PHKM: Honolulu, HI
+US: PAHG: Anchorage, AK
+US: PAKC: Anchorage, AK
+US: PAIH: Anchorage, AK
+US: PHMO: Honolulu, HI
+US: PAEC: Fairbanks, AK
+US: TJUA: San Juan, PR
+US: PACG: Juneau, AK
+US: PHKI: Honolulu, HI
+US: PHWA: Honolulu, HI
+US: ICAO: Responsible Wfo W/ MSCF
+US: KFDR: Norman, OK
+US: PGUA: Guam
+US: KBBX: Sacramento, CA
+US: KFDX: Albuquerque, NM
+US: KGWX: Jackson, MS
+US: KDOX: Wakefield, VA
+US: KDYX: San Angelo, TX
+US: KEYX: Las Vegas, NV
+US: KEVX: Mobile, AL
+US: KHPX: Paducah, KY
+US: KTYX: Burlington, VT
+US: KGRK: Dallas / Ft. Worth, TX
+US: KPOE: Lake Charles, LA
+US: KEOX: Tallahassee, FL
+US: KHDX: El Paso, TX
+US: KDFX: San Antonio, TX
+US: KMXX: Birmingham, AL
+US: KMBX: Bismarck, ND
+US: KVAX: Jacksonville, FL
+US: KJGX: Peachtree City/atlanta, GA
+US: KVNX: Norman, OK
+US: KVBX: Vandenberg Afb: Orcutt, CA
+DE: BAW: Baden-Württemberg
+DE: BAY: Bavaria
+DE: BBB: Berlin
+DE: BBB: Brandenburg
+DE: HES: Hesse
+DE: MVP: Mecklenburg-Western Pomerania
+DE: NIB: Lower Saxony
+DE: NIB: Bremen
+DE: NRW: North Rhine-Westphalia
+DE: RPS: Rhineland-Palatinate
+DE: RPS: Saarland
+DE: SAC: Saxony
+DE: SAA: Saxony-Anhalt
+DE: SHH: Schleswig-Holstein
+DE: SHH: Hamburg
+DE: THU: Thuringia
+NL: The Netherlands
+RU: Russian Federation" | mew -i -l 50 -p "Select a radar to use as default:")"
+
+# Ensure user did not escape.
+[ -z "$chosen" ] && exit 1
+
+# Set country code and radar code.
+countrycode=${chosen%%:*}
+radarcode=${chosen#* } radarcode=${radarcode%:*}
+
+# Print codes to $radarloc file.
+ printf "%s,%s\\n" "$countrycode" "$radarcode" > "$radarloc" ;}
+
+getdoppler() {
+ country=$(cut -c -2 "$radarloc")
+ province=$(cut -c 4- "$radarloc")
+ notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $province."
+ case "$country" in
+ "US") province="$(echo "$province" | tr "[:lower:]" "[:upper:]")"
+ curl -sL "https://radar.weather.gov/ridge/standard/${province}_loop.gif" > "$doppler" ;;
+ "DE") province="$(echo "$province" | tr "[:upper:]" "[:lower:]")"
+ curl -sL "https://www.dwd.de/DWD/wetter/radar/radfilm_${province}_akt.gif" > "$doppler" ;;
+ "NL") curl -sL "https://cdn.knmi.nl/knmi/map/general/weather-map.gif" > "$doppler" ;;
+ "RU") curl -sL "https://meteoinfo.ru/hmc-output/rmap/phenomena.gif" > "$doppler" ;;
+ esac
+}
+
+showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" >/dev/null 2>&1 ;}
+
+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 RADAR location.
+After $secs seconds, new clicks will also automatically update the doppler RADAR." ;;
+ 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;;
+esac
+
+echo 🌅
diff --git a/.local/bin/sb-scripts/sb-internet b/.local/bin/sb-scripts/sb-internet
new file mode 100755
index 0000000..378cccb
--- /dev/null
+++ b/.local/bin/sb-scripts/sb-internet
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e nmtui >/dev/null 2>&1 ; pkill -RTMIN+4 waybar ;;
+ 3) notify-send " Internet module" "\- Click to connect
+󰤮 : wifi disabled
+󰤮 : no wifi connection
+󰤨 : wifi connection with quality
+ : no ethernet
+ : ethernet working
+󰑪 : vpn is active (routing)
+󰖂 : vpn is active
+ " ;;
+ 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;;
+esac
+
+# Wifi
+if [ "$(bat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
+ quality=$(awk '/^\s*w/ { print int($3 * 100 / 70) }' /proc/net/wireless)
+
+ case 1 in
+ $((quality >= 76)) ) wifiicon="󰤨" ;;
+ $((quality >= 51)) ) wifiicon="󰤥" ;;
+ $((quality >= 26)) ) wifiicon="󰤢" ;;
+ $((quality >= 1)) ) wifiicon="󰤟" ;;
+ * ) wifiicon="󰤮" ;;
+ esac
+ wifiicon="$wifiicon$quality% "
+
+elif [ "$(bat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
+ [ "$(bat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="󰤮 " || wifiicon="󰤮 "
+fi
+
+# Ethernet
+[ "$(bat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="" || ethericon=""
+
+# TUN
+[ -n "$(bat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon=" 󰖂"
+[ -n "$(bat /sys/class/net/route*/operstate 2>/dev/null)" ] && tunicon=" 󰑪"
+
+printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon"
diff --git a/.local/bin/sb-scripts/sb-mouse b/.local/bin/sb-scripts/sb-mouse
new file mode 100755
index 0000000..db458d0
--- /dev/null
+++ b/.local/bin/sb-scripts/sb-mouse
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) setsid -f solaar >/dev/null 2>&1 ;;
+ 3) notify-send "🖱️ Mouse module" "\- Shows mouse battery percentage
+- Shows ⚡ if charging
+- Click to open Solaar
+- Middle click to update battery status
+ " ;;
+ 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;;
+esac
+
+percentage=$(solaar show 2>/dev/null \
+ | awk '/Battery:/ {
+ percent=$2; status=$3;
+ gsub(",", "", percent);
+ gsub("\\.", "", status);
+ if (status == 1) {
+ print "🖱️⚡" percent;
+ } else {
+ print "🖱️" percent;
+ }
+ exit
+ }')
+
+echo "$percentage"
diff --git a/.local/bin/sb-scripts/sb-news b/.local/bin/sb-scripts/sb-news
new file mode 100755
index 0000000..a95576d
--- /dev/null
+++ b/.local/bin/sb-scripts/sb-news
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Displays number of unread news items and an loading icon if updating.
+# When clicked, brings up `newsraft`.
+
+case $BLOCK_BUTTON in
+ 1) setsid "$TERMINAL" -T newsraft -e newsraft >/dev/null 2>&1 ;;
+ 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." ;;
+ 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;;
+esac
+
+bat /tmp/newsupdate 2>/dev/null || echo "$(newsraft -e print-unread-items-count | awk '{ if($1>0) print "📰" $1}')$(bat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsraft/.update 2>/dev/null)"
diff --git a/.local/bin/sb-scripts/sb-pacpackages b/.local/bin/sb-scripts/sb-pacpackages
new file mode 100755
index 0000000..0d74b43
--- /dev/null
+++ b/.local/bin/sb-scripts/sb-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) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+pacman -Qu | rg -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g"
diff --git a/.local/bin/sb-scripts/sb-popupgrade b/.local/bin/sb-scripts/sb-popupgrade
new file mode 100755
index 0000000..94279c8
--- /dev/null
+++ b/.local/bin/sb-scripts/sb-popupgrade
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+printf "Beginning upgrade.\\n"
+
+paru
+pkill -RTMIN+8 "${STATUSBAR:-waybar}"
+
+printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
+read -r _