From 33e329c8cb44679c37054d1823ef487c2569fcdc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 7 May 2020 17:31:42 -0400 Subject: [PATCH] statusbar scripts now open when shift-clicked weather module "fixed" other minor statusbar script tweaks --- .local/bin/statusbar/battery | 3 ++- .local/bin/statusbar/clock | 1 + .local/bin/statusbar/cpu | 1 + .local/bin/statusbar/crypto | 1 + .local/bin/statusbar/disk | 1 + .local/bin/statusbar/help-icon | 9 +++++---- .local/bin/statusbar/internet | 1 + .local/bin/statusbar/mailbox | 1 + .local/bin/statusbar/memory | 1 + .local/bin/statusbar/moonphase | 9 +++++---- .local/bin/statusbar/music | 13 +++++++------ .local/bin/statusbar/nettraf | 1 + .local/bin/statusbar/news | 1 + .local/bin/statusbar/pacpackages | 1 + .local/bin/statusbar/torrent | 14 ++++++++++---- .local/bin/statusbar/volume | 3 ++- .local/bin/statusbar/weather | 8 ++++---- 17 files changed, 45 insertions(+), 24 deletions(-) diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery index d348279..a6fb62d 100755 --- a/.local/bin/statusbar/battery +++ b/.local/bin/statusbar/battery @@ -4,12 +4,13 @@ # to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.). case $BLOCK_BUTTON in - 3) notify-send "🔋 Battery module" "🔋: discharging + 3) notify-send "🔋 Battery module" "🔋: discharging 🛑: not charging ♻: stagnant charge 🔌: charging ⚡: charged ❗: battery very low!" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac # acpi alternative diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock index 2441226..49cdc0b 100755 --- a/.local/bin/statusbar/clock +++ b/.local/bin/statusbar/clock @@ -23,6 +23,7 @@ case $BLOCK_BUTTON in 2) setsid "$TERMINAL" -e calcurse -D ~/.config/calcurse & ;; 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` - Middle click opens calcurse if installed" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac printf '%s %s%s\n' "$(date '+%Y %b %d (%a)')" "$icon" "$(date '+%I:%M%p')" diff --git a/.local/bin/statusbar/cpu b/.local/bin/statusbar/cpu index bd0c77a..b26f9d9 100755 --- a/.local/bin/statusbar/cpu +++ b/.local/bin/statusbar/cpu @@ -6,6 +6,7 @@ case $BLOCK_BUTTON in 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/crypto b/.local/bin/statusbar/crypto index 31e88b3..153e2fe 100755 --- a/.local/bin/statusbar/crypto +++ b/.local/bin/statusbar/crypto @@ -48,6 +48,7 @@ case $BLOCK_BUTTON in - Middle click to update. - Shows 🔃 if updating prices. - Manually add/remove currencies to list in the script." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac printprices diff --git a/.local/bin/statusbar/disk b/.local/bin/statusbar/disk index 3e3f2e3..e947509 100755 --- a/.local/bin/statusbar/disk +++ b/.local/bin/statusbar/disk @@ -11,6 +11,7 @@ case $BLOCK_BUTTON in 1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;; 3) notify-send "💽 Disk module" "\- Shows used hard drive space. - Click to show all disk info." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac case "$location" in diff --git a/.local/bin/statusbar/help-icon b/.local/bin/statusbar/help-icon index 4d8e3c2..9c90964 100755 --- a/.local/bin/statusbar/help-icon +++ b/.local/bin/statusbar/help-icon @@ -9,8 +9,9 @@ ps ax | grep -q "\sdwm$" && 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.";; + 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/.local/bin/statusbar/internet b/.local/bin/statusbar/internet index 6fcd291..94eb47f 100755 --- a/.local/bin/statusbar/internet +++ b/.local/bin/statusbar/internet @@ -11,6 +11,7 @@ case $BLOCK_BUTTON in ❎: no ethernet 🌐: ethernet working " ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox index ff7d522..9560388 100755 --- a/.local/bin/statusbar/mailbox +++ b/.local/bin/statusbar/mailbox @@ -10,6 +10,7 @@ case $BLOCK_BUTTON in - 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)" diff --git a/.local/bin/statusbar/memory b/.local/bin/statusbar/memory index dce5268..66fcd8b 100755 --- a/.local/bin/statusbar/memory +++ b/.local/bin/statusbar/memory @@ -6,6 +6,7 @@ case $BLOCK_BUTTON in 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. - Click to show memory hogs. - Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac free -h | sed -n '2{p;q}' | awk '{print "🧠", $3 "/" $2}' diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase index 739b8a8..2d9f91f 100755 --- a/.local/bin/statusbar/moonphase +++ b/.local/bin/statusbar/moonphase @@ -15,10 +15,11 @@ case "$mnphs" in "Waning Crescent") icon="🌘" ;; esac -case ${BUTTON:-$BLOCK_BUTTON} in - 1) $mnphs ;; - 2) $mnphs ;; - 3) notify-send " 🌜$(pom)" ;; +case $BLOCK_BUTTON in + 1) $mnphs ;; + 2) $mnphs ;; + 3) notify-send " 🌜$(pom)" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac echo "${icon:?}" "$prcnt"% diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music index 0cb9730..6d22467 100755 --- a/.local/bin/statusbar/music +++ b/.local/bin/statusbar/music @@ -3,14 +3,15 @@ filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | tr '\n' ' ' | sed 's/ $//' ;} case $BLOCK_BUTTON in - 1) mpc status | filter && setsid "$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. + 1) mpc status | filter ; setsid "$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. - Italic 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 - *) mpc status | filter ;; + 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/.local/bin/statusbar/nettraf b/.local/bin/statusbar/nettraf index 64b239f..bac22d8 100755 --- a/.local/bin/statusbar/nettraf +++ b/.local/bin/statusbar/nettraf @@ -7,6 +7,7 @@ case "$BLOCK_BUTTON" in 3) notify-send "🌐 Network traffic module" "🔻: Traffic received 🔺: Traffic transmitted" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac rxfile="${XDG_CACHE_HOME:-$HOME/.cache}/rxlog" diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news index 65ae7fd..ffaadfb 100755 --- a/.local/bin/statusbar/news +++ b/.local/bin/statusbar/news @@ -11,6 +11,7 @@ case $BLOCK_BUTTON in - Left click opens newsboat - Middle click syncs RSS feeds Note: 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 '{ print "📰 " $1}' | sed 's/^📰 0$//g')$(cat ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages index 5a8d6f3..e61660c 100755 --- a/.local/bin/statusbar/pacpackages +++ b/.local/bin/statusbar/pacpackages @@ -23,6 +23,7 @@ case $BLOCK_BUTTON in 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/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent index 5095cd6..99ed5c8 100755 --- a/.local/bin/statusbar/torrent +++ b/.local/bin/statusbar/torrent @@ -10,18 +10,24 @@ transmission-remote -l | grep % | s/.*%.*/M/g" | sort -h | uniq -c | sed " # Now we replace the standin letters with icons. s/A/🛑/g; - s/B/⌛️/g; + s/B/🕰/g; s/L/🔼/g; s/M/🔽/g; s/N/✅/g; s/Z/🌱/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed 's/ $//' case $BLOCK_BUTTON in - 1) $TERMINAL -e tremc ;; - 3) notify-send "Torrent module" "🛑: paused -⏳: idle (seeds needed) + 1) setsid "$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 diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume index 7580f20..8df98c8 100755 --- a/.local/bin/statusbar/volume +++ b/.local/bin/statusbar/volume @@ -14,7 +14,8 @@ case $BLOCK_BUTTON in 5) pamixer --allow-boost -d 1 ;; 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. - Middle click to mute. -- Scroll to change." +- Scroll to change." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac volstat="$(pactl list sinks)" diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather index 68d30a3..76a84d9 100755 --- a/.local/bin/statusbar/weather +++ b/.local/bin/statusbar/weather @@ -15,15 +15,15 @@ showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:-$HOME/.local/share} grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔ /g;1q" | tr -d '\n')" sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶",$1 "°","🌞",$2 "°"}' ;} -# The BLOCK_BUTTON bloat for clicking in i3. case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e less -Sf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" & ;; - 2) getforecast && showweather ;; - 3) notify-send "🌈 Weather module" "\- Left click for full forecast. + 1) setsid "$TERMINAL" -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/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