summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmbrose <me@librelife.org>2026-01-10 04:21:05 +0000
committerAmbrose <me@librelife.org>2026-01-10 04:21:05 +0000
commitdafdb92473a03cd545601cc57e279466137e42a7 (patch)
treeeb4b1ff7cad74918782ba173a5a54e5dfbf80226
parent291aedd33b650def5dbf9832aaa686fd53311c15 (diff)
Copied scripts from his dots
-rwxr-xr-xscripts/sb-battery25
-rwxr-xr-xscripts/sb-cputemp20
-rwxr-xr-xscripts/sb-cpuusage30
-rwxr-xr-xscripts/sb-dmenurecord123
-rwxr-xr-xscripts/sb-doppler261
-rwxr-xr-xscripts/sb-forecast4
-rwxr-xr-xscripts/sb-liisten38
-rwxr-xr-xscripts/sb-memory29
-rwxr-xr-xscripts/sb-network8
-rwxr-xr-xscripts/sb-packages27
-rwxr-xr-xscripts/sb-title2
-rwxr-xr-xscripts/sb-volume14
12 files changed, 581 insertions, 0 deletions
diff --git a/scripts/sb-battery b/scripts/sb-battery
new file mode 100755
index 0000000..1cdd3ed
--- /dev/null
+++ b/scripts/sb-battery
@@ -0,0 +1,25 @@
+#!/bin/sh
+#Prints battery percentage
+
+_bsd() {
+ PERCENT="$(apm | grep -o '[0-9].*%' | head -n 1)"
+ [ "$PERCENT" = "" ] && printf "None" && exit
+ echo "$PERCENT"
+}
+
+_linux() {
+ if ! [ -d /sys/class/power_supply/BAT* ]; then
+ printf "None\n"
+ exit 1
+ fi
+ for battery in /sys/class/power_supply/BAT?*; do
+ [ -n "${capacity+x}" ] && printf " "
+ capacity="$(cat "$battery/capacity" 2>&1)"
+ printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
+done && printf "\\n"
+}
+
+case $(uname) in
+ Linux) _linux ;;
+ *BSD) _bsd ;;
+esac
diff --git a/scripts/sb-cputemp b/scripts/sb-cputemp
new file mode 100755
index 0000000..5cbe975
--- /dev/null
+++ b/scripts/sb-cputemp
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+_linux() {
+ sensors $1 | awk '/^temp1/ {print $2}' | sed 's/+//'
+}
+
+_openbsd() {
+ [ "$1" = "-f" ] && printf "$(expr $(sysctl | grep hw.sensors.cpu0.temp0 | sed 's/\.00.*//' | sed 's/.*=//') \* 9 / 5 + 32 2> /dev/null)°F" || sysctl | grep hw.sensors.cpu0.temp0 | sed 's/.*=//' | sed 's/\.00//' | sed 's/ deg/°/'
+}
+
+_freebsd() {
+ C_TEMP=$(sysctl hw.acpi.thermal.tz0.temperature | sed 's/^.* //' )
+ [ "$1" = "-f" ] && printf "$(expr $(printf $C_TEMP | sed 's/\..C//') \* 9 / 5 + 32)°F" || printf "$C_TEMP" | sed 's/C/°C/'
+}
+
+case $(uname) in
+ Linux) _linux "$@" ;;
+ OpenBSD) _openbsd "$@" ;;
+ FreeBSD) _freebsd "$@" ;;
+esac
diff --git a/scripts/sb-cpuusage b/scripts/sb-cpuusage
new file mode 100755
index 0000000..ebfcceb
--- /dev/null
+++ b/scripts/sb-cpuusage
@@ -0,0 +1,30 @@
+#!/bin/sh
+#Display CPU usage percentage
+
+_openbsd() {
+ CPUS=$(sysctl | grep 'hw.ncpuonline' | sed 's/^.*=//')
+ TOTALUSAGE=$(ps aux | awk '{print $3}' | sed '1d' | sort | paste -s -d+ - | bc)
+ USAGE=$(printf "$TOTALUSAGE / $CPUS\n" | bc -l)
+ printf "$USAGE" | grep "^\.[0-9]" > /dev/null && printf "0$(printf $USAGE | cut -c1-3)%%" || printf "$(printf "$USAGE" | cut -c1-4)%%\n"
+}
+
+_freebsd() {
+ CPUS="$(sysctl hw.ncpu | sed 's/^.*: //')"
+ FREE=$(ps -o %cpu -p $(pgrep -S idle) | tail -n 1)
+ TPP=$(expr $CPUS \* 100)
+ TOTALUSAGE=$(printf "$TPP - $FREE" | bc -l)
+ USAGE=$(printf "$TOTALUSAGE / $CPUS" | bc -l | cut -c -4)
+ printf "$USAGE" | egrep "\.[0-9]{3}" > /dev/null && printf "0$(printf $USAGE | cut -c -3)%%\n" || printf -- "$USAGE%%\n"
+}
+
+_linux() {
+ TOTALUSAGE="$(ps axch -o cmd,%cpu --sort=-%cpu | sed 's/ //' | egrep -o " [0-9].*" | sed 's/ //' | paste -s -d+ - | bc)"
+ USAGE="$(printf "$(printf "$TOTALUSAGE / $(nproc)\n" | bc -l | cut -c1-4)%%\n")"
+ printf -- "$USAGE%" | grep "^\.[0-9]" > /dev/null && printf -- "0$(printf -- $USAGE% | cut -c1-3)%%" || printf -- "$(printf -- "$USAGE%" | cut -c1-4)%%\n"
+}
+
+case $(uname) in
+ Linux) _linux ;;
+ OpenBSD) _openbsd ;;
+ FreeBSD) _freebsd ;;
+esac
diff --git a/scripts/sb-dmenurecord b/scripts/sb-dmenurecord
new file mode 100755
index 0000000..6f357b9
--- /dev/null
+++ b/scripts/sb-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/videos/screencasts/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/videos/screencasts/video-$(date '+%y%m%d-%H%M-%S').mkv" &
+ echo $! > /tmp/recordingpid
+ updateicon "⏺️"
+ }
+
+webcamhidef() { ffmpeg \
+ -f v4l2 \
+ -i /dev/video0 \
+ -video_size 1920x1080 \
+ "$HOME/videos/screencasts/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
+ echo $! > /tmp/recordingpid
+ updateicon "🎥"
+ }
+
+webcam() { ffmpeg \
+ -f v4l2 \
+ -i /dev/video0 \
+ -video_size 640x480 \
+ "$HOME/videos/screencasts/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
+ echo $! > /tmp/recordingpid
+ updateicon "🎥"
+ }
+
+
+audio() { \
+ ffmpeg \
+ -f alsa -i default \
+ -c:a flac \
+ "$HOME/videos/screencasts/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/videos/screencasts/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/scripts/sb-doppler b/scripts/sb-doppler
new file mode 100755
index 0000000..8f2659a
--- /dev/null
+++ b/scripts/sb-doppler
@@ -0,0 +1,261 @@
+#!/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: 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, IA
+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
+EU: Europe
+EU: GB: Great Brittain
+EU: SCAN: Scandinavia
+EU: ALPS: The Alps
+EU: NL: The Netherlands
+EU: DE: Germany
+EU: SP: Spain
+EU: FR: France
+EU: IT: Italy
+EU: PL: Poland
+EU: GR: Greece
+EU: TU: Turkey
+EU: RU: Russia
+EU: BA: Bahrain
+EU: BC: Botswana
+EU: SE: Republic of Seychelles
+EU: HU: Hungary
+EU: UK: Ukraine
+AF: AF: Africa
+AF: WA: West Africa
+AF: ZA: South Africa
+AF: DZ: Algeria
+AF: CE: Canary Islands
+AF: NG: Nigeria
+AF: TD: Chad
+AF: CG: Democratic Republic of Congo
+AF: EG: Egypt
+AF: ET: Ethiopia
+AF: CM: Cameroon
+AF: IS: Israel
+AF: LY: Libya
+AF: MG: Madagascar
+AF: MO: Morocco
+AF: BW: Namibia
+AF: SA: Saudi Arabia
+AF: SO: Somalia
+AF: SD: Sudan
+AF: TZ: Tanzania
+AF: TN: Tunisia
+AF: ZM: Zambia
+AF: KE: Kenya
+AF: AO: Angola" | dmenu -r -i -l 50 -p "Select a radar to use as default:" | tr "[:lower:]" "[:upper:]")"
+
+# Set continent code and radar code.
+continentcode=$(echo "$chosen" | sed "s/:.*//")
+radarcode=$(echo "$chosen" | sed "s/..: // ; s/:.*//")
+
+# Sanity check of selection and ensure user did not escape.
+echo "$radarcode" | grep -q "^[A-Z]\+$" && printf "%s,%s\\n" "$continentcode" "$radarcode" > "$radarloc" ;}
+
+getdoppler() {
+ cont="$(sed "s/,.*//" "$radarloc")"
+ loc="$(cut -c 4- "$radarloc")"
+ notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc."
+ if [ "$cont" = "US" ] ; then
+ curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;
+ elif [ "$cont" = "EU" ] ; then
+ curl -sL "https://api.sat24.com/animated/${loc}/rainTMC/2/" > "$doppler" ;
+ elif [ "$cont" = "AF" ] ; then
+ curl -sL "https://api.sat24.com/animated/${loc}/rain/2/" > "$doppler" ;
+ fi
+}
+
+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 RADAR location.
+After $secs seconds, new clicks will also automatically update the doppler RADAR." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+#echo weather🗺️weather
+echo Weather
diff --git a/scripts/sb-forecast b/scripts/sb-forecast
new file mode 100755
index 0000000..fe8e8f0
--- /dev/null
+++ b/scripts/sb-forecast
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+curl wttr.in -o "$HOME/.local/share/weatherreport"
+less -Srf "$HOME/.local/share/weatherreport"
diff --git a/scripts/sb-liisten b/scripts/sb-liisten
new file mode 100755
index 0000000..ff9b420
--- /dev/null
+++ b/scripts/sb-liisten
@@ -0,0 +1,38 @@
+#!/bin/sh
+#Liisten for the status bar
+
+#options
+LOOPCOUNT=1 #however many times you want the song to play minus one (for technical reasons)
+SONGDIR="$HOME/music/brstm"
+cd "$SONGDIR"
+
+MODE=$(printf "Random\nForever" | dmenu -i)
+
+playsong () {
+ vgmstream-cli -m "$SONG" > /tmp/brstminfo.txt
+ STARTLOOP="$(grep "seconds" /tmp/brstminfo.txt | head -n 1 | sed 's/.*(//' | sed 's/ seconds)//')"
+ ENDLOOP="$(grep "seconds" /tmp/brstminfo.txt | tail -n 1 | sed 's/.*(//' | sed 's/ seconds)//')"
+ echo "Now playing: \"$(echo $SONG | sed 's/\.brstm//')\""
+ mpv --ab-loop-a="$STARTLOOP" --ab-loop-b="$ENDLOOP" --ab-loop-count="$LOOPCOUNT" "$SONG"
+}
+
+forever () {
+ SONG="$(command ls -1 | dmenu -i)"
+ vgmstream-cli -m "$SONG" > /tmp/brstminfo.txt
+ STARTLOOP="$(grep "seconds" /tmp/brstminfo.txt | head -n 1 | sed 's/.*(//' | sed 's/ seconds)//')"
+ ENDLOOP="$(grep "seconds" /tmp/brstminfo.txt | tail -n 1 | sed 's/.*(//' | sed 's/ seconds)//')"
+ mpv --ab-loop-a="$STARTLOOP" --ab-loop-b="$ENDLOOP" --loop-file=inf "$SONG"
+}
+
+random () {
+ while true; do
+ RANDNUM=$(shuf -i 1-$(ls -1 | wc -l) -n 1)
+ SONG="$(command ls | head -n $RANDNUM | tail -n 1)"
+ playsong
+ done
+}
+
+case "$MODE" in
+ Forever) forever ;;
+ Random) random ;;
+esac
diff --git a/scripts/sb-memory b/scripts/sb-memory
new file mode 100755
index 0000000..8dc613e
--- /dev/null
+++ b/scripts/sb-memory
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+_openbsd() {
+ TOTAL="$(free | awk '/^Mem:/ {print $2}')"
+ MUSED="$(top -b -n 1 | grep -o 'Real.*' | sed 's/Real: //' | sed 's/\/.*//')"
+ printf "$MUSED" | egrep "[0-9]{4}" > /dev/null && FUSED="$(printf "$MUSED" | cut -c -2 | sed 's/./.&/2')G" || FUSED=$MUSED
+ printf "$FUSED/$TOTAL\n"
+}
+
+_freebsd() {
+ TOTAL="$(freecolor -om | awk '/^Mem:/ {print $2}')"
+ MUSED="$(freecolor -om | awk '/^Mem:/ {print $3}')"
+ printf "$MUSED" | egrep "[0-9]{4}" > /dev/null && FUSED="$(printf "$MUSED" | cut -c -2 | sed 's/./.&/2')G" || FUSED=""$MUSED"M"
+ printf "$TOTAL" | egrep "[0-9]{4}" > /dev/null && TOTAL="$(printf "$TOTAL" | cut -c -2 | sed 's/./.&/2')G" || FUSED=$TOTAL
+ printf "$FUSED/$TOTAL\n"
+}
+
+_linux() {
+ TOTAL="$(free -h | awk '/^Mem:/ {print $2}')"
+ MUSED="$(free -h | awk '/^Mem:/ {print $3}')"
+ printf "$MUSED" | egrep "[0-9]{4}" > /dev/null && FUSED="$(printf "$MUSED" | cut -c -2 | sed 's/./.&/2')G" || FUSED=$MUSED
+ printf "$FUSED/$TOTAL\n" | sed 's/Gi/GB/g' | sed 's/Mi/MB/g'
+}
+
+case $(uname) in
+ Linux) _linux ;;
+ OpenBSD) _openbsd ;;
+ FreeBSD) _freebsd ;;
+esac
diff --git a/scripts/sb-network b/scripts/sb-network
new file mode 100755
index 0000000..0937126
--- /dev/null
+++ b/scripts/sb-network
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Show local IP and transfer if connected to the internet. Opens $NETWORKMANAGER on click
+NETWORKMANAGER=connman-gtk
+ifconfig | grep ".*inet.*netmask" | tail -n 1 | sed 's/inet //g' | sed 's/ netmask.*//g' | sed 's/ //g' | sed 's/ //g'
+
+case $BLOCK_BUTTON in
+ 1) $NETWORKMANAGER ;;
+esac
diff --git a/scripts/sb-packages b/scripts/sb-packages
new file mode 100755
index 0000000..e2f16ef
--- /dev/null
+++ b/scripts/sb-packages
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+aptupgrade () {
+ st -e sudo apt update
+ st -e sudo apt upgrade
+}
+
+upgrade () {
+ [ "$PM" = "apt" ] && aptupgrade
+ [ "$PM" = "pacman" ] && st -e $ARCHPM -Su
+}
+
+[ -f /usr/bin/pacman ] && PM=pacman
+[ -f /usr/bin/apt ] && PM=apt
+
+[ -f /usr/bin/paru ] && ARCHPM=paru
+[ -f /usr/bin/yay ] && ARCHPM=yay
+[ -z $ARCHPM ] && ARCHPM=pacman
+
+case $PM in
+ pacman) echo "📦$($ARCHPM -Syup | sed 's/.*Synchr.*//' | sed 's/.*downloading.*//g' | sed '/^$/d' | wc -l)" ;;
+ apt) printf "📦$(apt list --upgradable 2> /dev/null | wc -l)" ;;
+esac
+
+case $BLOCK_BUTTON in
+ 1) upgrade ;;
+esac
diff --git a/scripts/sb-title b/scripts/sb-title
new file mode 100755
index 0000000..a026bd5
--- /dev/null
+++ b/scripts/sb-title
@@ -0,0 +1,2 @@
+#!/bin/sh
+xtitle -s
diff --git a/scripts/sb-volume b/scripts/sb-volume
new file mode 100755
index 0000000..0736259
--- /dev/null
+++ b/scripts/sb-volume
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+_bsd() {
+ sndioctl -n output.level | sed 's/0\.//' | sed 's/.$/%/' | sed 's/\.//'
+}
+
+_linux() {
+ printf "$(pamixer --get-volume)%%\n"
+}
+
+case $(uname) in
+ Linux) _linux ;;
+ *BSD) _bsd ;;
+esac