pgrep junk removed and minor script changes

This commit is contained in:
Luke Smith 2020-04-08 22:01:51 -04:00
parent 3e8f5c1647
commit 4814403bbf
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252
15 changed files with 34 additions and 30 deletions

View file

@ -4,7 +4,7 @@
# Run by itself, set the wallpaper (at X start). # Run by itself, set the wallpaper (at X start).
# If given a file, set that as the new wallpaper. # If given a file, set that as the new wallpaper.
# If given a directory, choose random file in it. # 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. # Location of link to wallpaper link.
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg" bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"

View file

@ -4,7 +4,7 @@
# to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.). # to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.).
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
3) pgrep -x dunst >/dev/null && notify-send "🔋 Battery module" "🔋: discharging 3) notify-send "🔋 Battery module" "🔋: discharging
🛑: not charging 🛑: not charging
♻: stagnant charge ♻: stagnant charge
🔌: charging 🔌: charging

View file

@ -3,8 +3,8 @@
date '+%Y %b %d (%a) %I:%M%p' date '+%Y %b %d (%a) %I:%M%p'
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) pgrep -x dunst >/dev/null && notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;;
2) $TERMINAL -e calcurse -D ${XDG_CONFIG_HOME:-$HOME/.config}/calcurse ;; 2) $TERMINAL -e calcurse -D ~/.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\` 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" ;; - Middle click opens calcurse if installed" ;;
esac esac

View file

@ -3,6 +3,6 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - ;; 1) groff -mom ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom -Tpdf | zathura - ;;
2) i3 restart ;; 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.";; - Middle click to refresh i3.";;
esac; echo "❓" esac; echo "❓"

View file

@ -1,8 +1,11 @@
#!/bin/sh #!/bin/sh
# Show wifi 📶 and percent strength or 📡 if none.
# Show 🌐 if connected to ethernet or ❎ if none.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) $TERMINAL -e nmtui ;; 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 📡: no wifi connection
📶: wifi connection with quality 📶: wifi connection with quality
❎: no ethernet ❎: no ethernet
@ -10,7 +13,7 @@ case $BLOCK_BUTTON in
" ;; " ;;
esac esac
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡" || grep "down" /sys/class/net/w*/operstate && wifiicon="📡" ||
wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }') 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)" printf "%s %s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate)"

View file

@ -4,6 +4,7 @@
# displays that information in the statusbar # displays that information in the statusbar
# #
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ # https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
ifinstalled "geoiplookup" || exit ifinstalled "geoiplookup" || exit
addr="$(curl ifconfig.me 2>/dev/null)" || 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/;.*//" grep "flag: " ${XDG_CONFIG_HOME:-$HOME/.config}/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"

View file

@ -7,7 +7,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) "$TERMINAL" -e neomutt ;; 1) "$TERMINAL" -e neomutt ;;
2) setsid mailsync >/dev/null & ;; 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 - Shows 🔃 if syncing mail
- Left click opens neomutt - Left click opens neomutt
- Middle click syncs mail" ;; - 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)" 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)" [ "$unread" = "0" ] && [ "$icon" = "" ] || echo "📬 $unread$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)"

View file

@ -1,5 +1,7 @@
#!/bin/sh #!/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 '.') 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:]]*' ) prcnt=$(pom $1 | grep -o '[[:digit:]]*%' | grep -o '[[:digit:]]*' )
case "$mnphs" in case "$mnphs" in
@ -17,7 +19,7 @@ esac
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) $mnphs ;; 1) $mnphs ;;
2) $mnphs ;; 2) $mnphs ;;
3) pgrep -x dunst >/dev/null && notify-send " 🌜$(pom)" ;; 3) notify-send " 🌜$(pom)" ;;
esac esac
echo "$icon" "$prcnt"% echo "$icon" "$prcnt"%

View file

@ -7,7 +7,7 @@ filter() {
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause 1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause
2) mpc toggle | filter ;; # 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. - Italic when paused.
- Left click opens ncmpcpp. - Left click opens ncmpcpp.
- Middle click pauses. - Middle click pauses.

View file

@ -1,13 +1,12 @@
#!/bin/sh #!/bin/sh
# i3blocks newsboat module.
# Displays number of unread news items and an loading icon if updating. # Displays number of unread news items and an loading icon if updating.
# When clicked, brings up `newsboat`. # When clicked, brings up `newsboat`.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e newsboat ;; 1) setsid "$TERMINAL" -e newsboat ;;
2) setsid newsup >/dev/null & exit ;; 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\` - Shows 🔃 if updating with \`newsup\`
- Left click opens newsboat - Left click opens newsboat
- Middle click syncs RSS feeds - Middle click syncs RSS feeds

View file

@ -20,7 +20,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) $TERMINAL -e popupgrade ;; 1) $TERMINAL -e popupgrade ;;
2) notify-send "$(/usr/bin/pacman -Qu)" ;; 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 - Left click to upgrade packages
- Middle click to show upgradable packages" ;; - Middle click to show upgradable packages" ;;
esac esac

View file

@ -9,25 +9,24 @@ echo "
This is a list of the statusbar modules. This is a list of the statusbar modules.
📦5 pacpackages: updatable packages (must have pacman -Sy run in root cronjob to check). 📦5 \033[31mpacpackages\033[0m: updatable packages (must have pacman -Sy run in root cronjob to check).
📰 41 news: unread RSS entries in newsboat. 📰 41 \033[32mnews\033[0m: unread RSS entries in newsboat.
☔ 83% ❄️ 69° 🌞 80° weather: ☔ for precipitation, 🌞 and ❄ for daily high and low. ☔ 83% ❄️ 69° 🌞 80° \033[33mweather\033[0m: ☔ for precipitation, 🌞 and ❄ for daily high and low.
📬 20 mailbox: number of unread mail if mutt-wizard is active. 📬 20 \033[34mmailbox\033[0m: number of unread mail if mutt-wizard is active.
🔉 62% volume: master sink volume. 🔉 62% \033[35mvolume\033[0m: master sink volume.
🔌83% battery: 🔌 for charging, 🔋 for discharging, ⚡ for full. 🔌83% \033[36mbattery\033[0m: 🔌 for charging, 🔋 for discharging, ⚡ for full.
📶 80% ❎ internet: 📶 for wifi with % (📡 if none), 🌐 for ethernet. (❎ if none). 📶 80% ❎ \033[37minternet\033[0m: 📶 for wifi with % (📡 if none), 🌐 for ethernet. (❎ if none).
Obviously the time and date are displayed as well. Obviously the time and date are displayed as well.
Optional script modules: 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. 'memory' 🧠 559Mi/3.7Gi Current used memory/total memory.
'cpu' 🌡 +46.0°C CPU temperature. 'cpu' 🌡 +46.0°C CPU temperature.
'disk' 🖥 : 28G/30G Remaining disk space... 'disk' 🖥 : 28G/30G Remaining disk space...
'disk ~' 🏠: 641G/850G ...can be given directory argument. 'disk ~' 🏠: 641G/850G ...can be given directory argument.
'moonphase' 🌕 39% Phase of the moon (requires \`pom-perl\`). 'moonphase' 🌕 39% Phase of the moon (requires \033[32m\`pom-perl\`\033[0m).
'iplocate' 🇺🇸 United States Your own or VPN location (requires \`geoiplookup\`). 'iplocate' 🇺🇸 United States Your own or VPN location (requires \033[32m\`geoiplookup\`\033[0m).
" | less " | less

View file

@ -18,7 +18,7 @@ transmission-remote -l | grep % |
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) $TERMINAL -e transmission-remote-cli ;; 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) ⏳: idle (seeds needed)
🔼: uploading (unfinished) 🔼: uploading (unfinished)
🔽: downloading 🔽: downloading

View file

@ -5,7 +5,7 @@ case $BLOCK_BUTTON in
2) amixer sset Master toggle ;; 2) amixer sset Master toggle ;;
4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;; 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;;
5) 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. - Middle click to mute.
- Scroll to change." - Scroll to change."
esac esac

View file

@ -20,7 +20,7 @@ sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | grep -o "m\\(
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) $TERMINAL -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" ;; 1) $TERMINAL -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" ;;
2) getforecast && showweather ;; 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. - Middle click to update forecast.
☔: Chance of rain/snow ☔: Chance of rain/snow
❄: Daily low ❄: Daily low