From 4814403bbf58794da3349f21e55746e50e68eab4 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 8 Apr 2020 22:01:51 -0400 Subject: [PATCH] pgrep junk removed and minor script changes --- .local/bin/setbg | 2 +- .local/bin/statusbar/battery | 2 +- .local/bin/statusbar/clock | 6 +++--- .local/bin/statusbar/help | 2 +- .local/bin/statusbar/internet | 9 ++++++--- .local/bin/statusbar/iplocate | 1 + .local/bin/statusbar/mailbox | 4 ++-- .local/bin/statusbar/moonphase | 4 +++- .local/bin/statusbar/music | 2 +- .local/bin/statusbar/news | 3 +-- .local/bin/statusbar/pacpackages | 2 +- .local/bin/statusbar/statusbarinfo | 21 ++++++++++----------- .local/bin/statusbar/torrent | 2 +- .local/bin/statusbar/volume | 2 +- .local/bin/statusbar/weather | 2 +- 15 files changed, 34 insertions(+), 30 deletions(-) diff --git a/.local/bin/setbg b/.local/bin/setbg index 8269378..b91c87c 100755 --- a/.local/bin/setbg +++ b/.local/bin/setbg @@ -4,7 +4,7 @@ # Run by itself, set the wallpaper (at X start). # If given a file, set that as the new wallpaper. # If given a directory, choose random file in it. -# If wal is installed, also generate a colorscheme. +# If wal is installed, also generates a colorscheme. # Location of link to wallpaper link. bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg" diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery index 395ad8d..65152f7 100755 --- a/.local/bin/statusbar/battery +++ b/.local/bin/statusbar/battery @@ -4,7 +4,7 @@ # to charge status (πŸ”Œ for plugged up, πŸ”‹ for discharging on battery, etc.). case $BLOCK_BUTTON in - 3) pgrep -x dunst >/dev/null && notify-send "πŸ”‹ Battery module" "πŸ”‹: discharging + 3) notify-send "πŸ”‹ Battery module" "πŸ”‹: discharging πŸ›‘: not charging β™»: stagnant charge πŸ”Œ: charging diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock index 23e881e..9799b97 100755 --- a/.local/bin/statusbar/clock +++ b/.local/bin/statusbar/clock @@ -3,8 +3,8 @@ date '+%Y %b %d (%a) %I:%M%p' case $BLOCK_BUTTON in - 1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; - 2) $TERMINAL -e calcurse -D ${XDG_CONFIG_HOME:-$HOME/.config}/calcurse ;; - 3) pgrep -x dunst >/dev/null && 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\` + 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; + 2) $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" ;; esac diff --git a/.local/bin/statusbar/help b/.local/bin/statusbar/help index c1f1caa..70ca383 100755 --- a/.local/bin/statusbar/help +++ b/.local/bin/statusbar/help @@ -3,6 +3,6 @@ case $BLOCK_BUTTON in 1) groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - ;; 2) i3 restart ;; - 3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide. + 3) notify-send "❓ Help module" "\- Left click to open LARBS guide. - Middle click to refresh i3.";; esac; echo "❓" diff --git a/.local/bin/statusbar/internet b/.local/bin/statusbar/internet index 8063e19..82b1080 100755 --- a/.local/bin/statusbar/internet +++ b/.local/bin/statusbar/internet @@ -1,8 +1,11 @@ #!/bin/sh +# Show wifi πŸ“Ά and percent strength or πŸ“‘ if none. +# Show 🌐 if connected to ethernet or ❎ if none. + case $BLOCK_BUTTON in 1) $TERMINAL -e nmtui ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module" "\- Click to connect + 3) notify-send "🌐 Internet module" "\- Click to connect πŸ“‘: no wifi connection πŸ“Ά: wifi connection with quality ❎: no ethernet @@ -10,7 +13,7 @@ case $BLOCK_BUTTON in " ;; esac -[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="πŸ“‘" || - wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "πŸ“Ά", int($3 * 100 / 70) "%" }') +grep "down" /sys/class/net/w*/operstate && wifiicon="πŸ“‘" || + wifiicon="$(grep "^\s*w" /proc/net/wireless | awk '{ print "πŸ“Ά", int($3 * 100 / 70) "%" }')" printf "%s %s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate)" diff --git a/.local/bin/statusbar/iplocate b/.local/bin/statusbar/iplocate index 1dddb7c..8dc6290 100755 --- a/.local/bin/statusbar/iplocate +++ b/.local/bin/statusbar/iplocate @@ -4,6 +4,7 @@ # displays that information in the statusbar # # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ + ifinstalled "geoiplookup" || exit addr="$(curl ifconfig.me 2>/dev/null)" || exit grep "flag: " ${XDG_CONFIG_HOME:-$HOME/.config}/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox index 49630ad..06b622f 100755 --- a/.local/bin/statusbar/mailbox +++ b/.local/bin/statusbar/mailbox @@ -7,7 +7,7 @@ case $BLOCK_BUTTON in 1) "$TERMINAL" -e neomutt ;; 2) setsid mailsync >/dev/null & ;; - 3) pgrep -x dunst >/dev/null && notify-send "πŸ“¬ Mail module" "\- Shows unread mail + 3) notify-send "πŸ“¬ Mail module" "\- Shows unread mail - Shows πŸ”ƒ if syncing mail - Left click opens neomutt - Middle click syncs mail" ;; @@ -15,6 +15,6 @@ esac unread="$(find ${XDG_DATA_HOME:-$HOME/.local/share}/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)" -icon="$(cat "/tmp/imapsyncicon_$USER")" +icon="$(cat "/tmp/imapsyncicon_$USER")" 2>/dev/null [ "$unread" = "0" ] && [ "$icon" = "" ] || echo "πŸ“¬ $unread$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)" diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase index 09af87b..12ed90b 100755 --- a/.local/bin/statusbar/moonphase +++ b/.local/bin/statusbar/moonphase @@ -1,5 +1,7 @@ #!/bin/sh +# Shows the current moon phase. Requires `pom-perl`. + mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.') prcnt=$(pom $1 | grep -o '[[:digit:]]*%' | grep -o '[[:digit:]]*' ) case "$mnphs" in @@ -17,7 +19,7 @@ esac case $BLOCK_BUTTON in 1) $mnphs ;; 2) $mnphs ;; - 3) pgrep -x dunst >/dev/null && notify-send " 🌜$(pom)" ;; + 3) notify-send " 🌜$(pom)" ;; esac echo "$icon" "$prcnt"% diff --git a/.local/bin/statusbar/music b/.local/bin/statusbar/music index fadc15e..1412ae3 100755 --- a/.local/bin/statusbar/music +++ b/.local/bin/statusbar/music @@ -7,7 +7,7 @@ filter() { 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 && pgrep -x dunst >/dev/null && notify-send "🎡 Music module" "\- Shows mpd song playing. + 3) mpc status | filter && notify-send "🎡 Music module" "\- Shows mpd song playing. - Italic when paused. - Left click opens ncmpcpp. - Middle click pauses. diff --git a/.local/bin/statusbar/news b/.local/bin/statusbar/news index 28b2940..455f64d 100755 --- a/.local/bin/statusbar/news +++ b/.local/bin/statusbar/news @@ -1,13 +1,12 @@ #!/bin/sh -# i3blocks newsboat module. # 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 newsup >/dev/null & exit ;; - 3) pgrep -x dunst >/dev/null && notify-send "πŸ“° News module" "\- Shows unread news items + 3) notify-send "πŸ“° News module" "\- Shows unread news items - Shows πŸ”ƒ if updating with \`newsup\` - Left click opens newsboat - Middle click syncs RSS feeds diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages index 4273c86..6f439cc 100755 --- a/.local/bin/statusbar/pacpackages +++ b/.local/bin/statusbar/pacpackages @@ -20,7 +20,7 @@ case $BLOCK_BUTTON in 1) $TERMINAL -e popupgrade ;; 2) notify-send "$(/usr/bin/pacman -Qu)" ;; - 3) pgrep -x dunst >/dev/null && notify-send "Upgrade module" "πŸ“¦: number of upgradable packages + 3) notify-send "Upgrade module" "πŸ“¦: number of upgradable packages - Left click to upgrade packages - Middle click to show upgradable packages" ;; esac diff --git a/.local/bin/statusbar/statusbarinfo b/.local/bin/statusbar/statusbarinfo index ae799e9..2b3e58c 100755 --- a/.local/bin/statusbar/statusbarinfo +++ b/.local/bin/statusbar/statusbarinfo @@ -9,25 +9,24 @@ echo " This is a list of the statusbar modules. -πŸ“¦5 pacpackages: updatable packages (must have pacman -Sy run in root cronjob to check). -πŸ“° 41 news: unread RSS entries in newsboat. -β˜” 83% ❄️ 69Β° 🌞 80Β° weather: β˜” for precipitation, 🌞 and ❄ for daily high and low. -πŸ“¬ 20 mailbox: number of unread mail if mutt-wizard is active. -πŸ”‰ 62% volume: master sink volume. -πŸ”Œ83% battery: πŸ”Œ for charging, πŸ”‹ for discharging, ⚑ for full. -πŸ“Ά 80% ❎ internet: πŸ“Ά for wifi with % (πŸ“‘ if none), 🌐 for ethernet. (❎ if none). +πŸ“¦5 \033[31mpacpackages\033[0m: updatable packages (must have pacman -Sy run in root cronjob to check). +πŸ“° 41 \033[32mnews\033[0m: unread RSS entries in newsboat. +β˜” 83% ❄️ 69Β° 🌞 80Β° \033[33mweather\033[0m: β˜” for precipitation, 🌞 and ❄ for daily high and low. +πŸ“¬ 20 \033[34mmailbox\033[0m: number of unread mail if mutt-wizard is active. +πŸ”‰ 62% \033[35mvolume\033[0m: master sink volume. +πŸ”Œ83% \033[36mbattery\033[0m: πŸ”Œ for charging, πŸ”‹ for discharging, ⚑ for full. +πŸ“Ά 80% ❎ \033[37minternet\033[0m: πŸ“Ά for wifi with % (πŸ“‘ if none), 🌐 for ethernet. (❎ if none). Obviously the time and date are displayed as well. Optional script modules: -Edit ~/.local/src/dwmblocks/config.h to add these or your own if you'd like (and recompile and restart dwmblocks). +Edit \033[32m~/.local/src/dwmblocks/config.h\033[0m to add these or your own if you'd like (and recompile and restart dwmblocks). 'memory' 🧠 559Mi/3.7Gi Current used memory/total memory. 'cpu' 🌑 +46.0Β°C CPU temperature. 'disk' πŸ–₯ : 28G/30G Remaining disk space... 'disk ~' 🏠: 641G/850G ...can be given directory argument. -'moonphase' πŸŒ• 39% Phase of the moon (requires \`pom-perl\`). -'iplocate' πŸ‡ΊπŸ‡Έ United States Your own or VPN location (requires \`geoiplookup\`). - +'moonphase' πŸŒ• 39% Phase of the moon (requires \033[32m\`pom-perl\`\033[0m). +'iplocate' πŸ‡ΊπŸ‡Έ United States Your own or VPN location (requires \033[32m\`geoiplookup\`\033[0m). " | less diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent index 4b559b8..6f8fc5f 100755 --- a/.local/bin/statusbar/torrent +++ b/.local/bin/statusbar/torrent @@ -18,7 +18,7 @@ transmission-remote -l | grep % | case $BLOCK_BUTTON in 1) $TERMINAL -e transmission-remote-cli ;; - 3) pgrep -x dunst >/dev/null && notify-send "Torrent module" "πŸ›‘: paused + 3) notify-send "Torrent module" "πŸ›‘: paused ⏳: idle (seeds needed) πŸ”Ό: uploading (unfinished) πŸ”½: downloading diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume index fd59a6f..cd79de3 100755 --- a/.local/bin/statusbar/volume +++ b/.local/bin/statusbar/volume @@ -5,7 +5,7 @@ case $BLOCK_BUTTON in 2) amixer sset Master toggle ;; 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;; 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;; - 3) pgrep -x dunst >/dev/null && notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted. + 3) notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted. - Middle click to mute. - Scroll to change." esac diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/weather index 59198a0..853d262 100755 --- a/.local/bin/statusbar/weather +++ b/.local/bin/statusbar/weather @@ -20,7 +20,7 @@ sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | grep -o "m\\( case $BLOCK_BUTTON in 1) $TERMINAL -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" ;; 2) getforecast && showweather ;; - 3) pgrep -x dunst >/dev/null && notify-send "🌈 Weather module" "\- Left click for full forecast. + 3) notify-send "🌈 Weather module" "\- Left click for full forecast. - Middle click to update forecast. β˜”: Chance of rain/snow ❄: Daily low