Browse Source

Modified dwm_bar.sh formatting

- Individual functions no longer contain the square brackets to act as
seperators. These are instead included in the xsetroot command within
dwm_bar.sh itself so that they can be modified much more easily if the user desires.
- Fixed dwm_battery.sh showing a space between the level and '%' symbol
when discharging.
- Added dwm_ccurse to dwm_bar.sh. Guess I forgot that.
patch-fontkeys
joestandring 5 years ago
parent
commit
3f9c43864f
15 changed files with 48 additions and 47 deletions
  1. +8
    -8
      bar-functions/dwm_alsa.sh
  2. +3
    -3
      bar-functions/dwm_battery.sh
  3. +2
    -2
      bar-functions/dwm_ccurse.sh
  4. +2
    -2
      bar-functions/dwm_cmus.sh
  5. +2
    -2
      bar-functions/dwm_countdown.sh
  6. +2
    -2
      bar-functions/dwm_date.sh
  7. +2
    -2
      bar-functions/dwm_keyboard.sh
  8. +3
    -3
      bar-functions/dwm_mail.sh
  9. +2
    -2
      bar-functions/dwm_network.sh
  10. +8
    -8
      bar-functions/dwm_pulse.sh
  11. +2
    -2
      bar-functions/dwm_resources.sh
  12. +6
    -6
      bar-functions/dwm_transmission.sh
  13. +2
    -2
      bar-functions/dwm_vpn.sh
  14. +2
    -2
      bar-functions/dwm_weather.sh
  15. +2
    -1
      dwm_bar.sh

+ 8
- 8
bar-functions/dwm_alsa.sh View File

@ -10,23 +10,23 @@ dwm_alsa () {
VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/") VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$VOL" -eq 0 ]; then if [ "$VOL" -eq 0 ]; then
printf "[🔇]\n"
printf "🔇\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[🔈 %s%%]\n" "$VOL"
printf "🔈 %s%%\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[🔉 %s%%]\n" "$VOL"
printf "🔉 %s%%\n" "$VOL"
else else
printf "[🔊 %s%%]\n" "$VOL"
printf "🔊 %s%%\n" "$VOL"
fi fi
else else
if [ "$VOL" -eq 0 ]; then if [ "$VOL" -eq 0 ]; then
printf "[MUTE]\n"
printf "MUTE\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[VOL %s%%]\n" "$VOL"
printf "VOL %s%%\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[VOL %s%%]\n" "$VOL"
printf "VOL %s%%\n" "$VOL"
else else
printf "[VOL %s%%]\n" "$VOL"
printf "VOL %s%%\n" "$VOL"
fi fi
fi fi
} }


+ 3
- 3
bar-functions/dwm_battery.sh View File

@ -11,12 +11,12 @@ dwm_battery () {
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATUS" = "Charging" ]; then if [ "$STATUS" = "Charging" ]; then
printf "[🔌 %s%% %s]\n" "$CHARGE" "$STATUS"
printf "🔌 %s%% %s\n" "$CHARGE" "$STATUS"
else else
printf "[🔋 %s %%%s]\n" "$CHARGE" "$STATUS"
printf "🔋 %s%% %s\n" "$CHARGE" "$STATUS"
fi fi
else else
printf "[BAT %s%% %s]\n" "$CHARGE" "$STATUS"
printf "BAT %s%% %s\n" "$CHARGE" "$STATUS"
fi fi
} }


+ 2
- 2
bar-functions/dwm_ccurse.sh View File

@ -10,9 +10,9 @@ dwm_ccurse () {
APPOINTMENT=$(calcurse -a | head -n 3 | tr -d '\n+>-' | awk '$1=$1' | sed 's/://') APPOINTMENT=$(calcurse -a | head -n 3 | tr -d '\n+>-' | awk '$1=$1' | sed 's/://')
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
printf "[💡 %s]\n" "$APPOINTMENT"
printf "💡 %s\n" "$APPOINTMENT"
else else
printf "[APT %s]\n" "$APPOINTMENT"
printf "APT %s\n" "$APPOINTMENT"
fi fi
} }


+ 2
- 2
bar-functions/dwm_cmus.sh View File

@ -41,10 +41,10 @@ dwm_cmus () {
fi fi
fi fi
printf "[%s %s - %s " "$STATUS" "$ARTIST" "$TRACK"
printf "%s %s - %s " "$STATUS" "$ARTIST" "$TRACK"
printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60)) printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60)) printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
printf "%s]\n" "$SHUFFLE"
printf "%s\n" "$SHUFFLE"
fi fi
} }


+ 2
- 2
bar-functions/dwm_countdown.sh View File

@ -10,9 +10,9 @@ dwm_countdown () {
for f in /tmp/countdown.*; do for f in /tmp/countdown.*; do
if [ -e "$f" ]; then if [ -e "$f" ]; then
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
printf "[⏳ %s]\n" "$(tail -1 /tmp/countdown.*)"
printf "⏳ %s\n" "$(tail -1 /tmp/countdown.*)"
else else
printf "[CDN %s]\n" "$(tail -1 /tmp/countdown.*)"
printf "CDN %s\n" "$(tail -1 /tmp/countdown.*)"
fi fi
break break


+ 2
- 2
bar-functions/dwm_date.sh View File

@ -7,9 +7,9 @@
# Date is formatted like like this: "[Mon 01-01-00 00:00:00]" # Date is formatted like like this: "[Mon 01-01-00 00:00:00]"
dwm_date () { dwm_date () {
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
printf "[📆 %s]\n" "$(date "+%a %d-%m-%y %T")"
printf "📆 %s\n" "$(date "+%a %d-%m-%y %T")"
else else
printf "[DAT %s]\n" "$(date "+%a %d-%m-%y %T")"
printf "DAT %s\n" "$(date "+%a %d-%m-%y %T")"
fi fi
} }


+ 2
- 2
bar-functions/dwm_keyboard.sh View File

@ -8,9 +8,9 @@
dwm_keyboard () { dwm_keyboard () {
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
printf "[⌨ %s]\n" "$(setxkbmap -query | awk '/layout/{print $2}')"
printf "⌨ %s\n" "$(setxkbmap -query | awk '/layout/{print $2}')"
else else
printf "[KEY %s]\n" "$(setxkbmap -query | awk '/layout/{print $2}')"
printf "KEY %s\n" "$(setxkbmap -query | awk '/layout/{print $2}')"
fi fi
} }


+ 3
- 3
bar-functions/dwm_mail.sh View File

@ -11,12 +11,12 @@ dwm_mail () {
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$MAILBOX" -eq 0 ]; then if [ "$MAILBOX" -eq 0 ]; then
printf "[📪 %s]\n" "$MAILBOX"
printf "📪 %s\n" "$MAILBOX"
else else
printf "[📫 %s]\n" "$MAILBOX"
printf "📫 %s\n" "$MAILBOX"
fi fi
else else
printf "[MAI %s]\n" "$MAILBOX"
printf "MAI %s\n" "$MAILBOX"
fi fi
} }


+ 2
- 2
bar-functions/dwm_network.sh View File

@ -16,9 +16,9 @@ dwm_network () {
PUBLIC=$(curl -s https://ipinfo.io/ip) PUBLIC=$(curl -s https://ipinfo.io/ip)
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
printf "[🌐 %s %s | %s]\n" "$CONNAME" "$PRIVATE" "$PUBLIC"
printf "🌐 %s %s | %s\n" "$CONNAME" "$PRIVATE" "$PUBLIC"
else else
printf "[NET %s %s | %s]\n" "$CONNAME" "$PRIVATE" "$PUBLIC"
printf "NET %s %s | %s\n" "$CONNAME" "$PRIVATE" "$PUBLIC"
fi fi
} }


+ 8
- 8
bar-functions/dwm_pulse.sh View File

@ -10,23 +10,23 @@ dwm_pulse () {
VOL=$(pamixer --get-volume-human | tr -d '%') VOL=$(pamixer --get-volume-human | tr -d '%')
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$VOL" = "muted" ] || [ "$VOL" -eq 0 ]; then if [ "$VOL" = "muted" ] || [ "$VOL" -eq 0 ]; then
printf "[🔇]\n"
printf "🔇\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[🔈 %s%%]\n" "$VOL"
printf "🔈 %s%%\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[🔉 %s%%]\n" "$VOL"
printf "🔉 %s%%\n" "$VOL"
else else
printf "[🔊 %s%%]\n" "$VOL"
printf "🔊 %s%%\n" "$VOL"
fi fi
else else
if [ "$VOL" = "muted" ] || [ "$VOL" -eq 0 ]; then if [ "$VOL" = "muted" ] || [ "$VOL" -eq 0 ]; then
printf "[MUTE]\n"
printf "MUTE\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[VOL %s%%]\n" "$VOL"
printf "VOL %s%%\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[VOL %s%%]\n" "$VOL"
printf "VOL %s%%\n" "$VOL"
else else
printf "[VOL %s%%]\n" "$VOL"
printf "VOL %s%%\n" "$VOL"
fi fi
fi fi
} }


+ 2
- 2
bar-functions/dwm_resources.sh View File

@ -16,9 +16,9 @@ dwm_resources () {
STOPER=$(df -h | grep '/home$' | awk '{print $5}') STOPER=$(df -h | grep '/home$' | awk '{print $5}')
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
printf "[💻 MEM %s/%s CPU %s STO %s/%s: %s]\n" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
printf "💻 MEM %s/%s CPU %s STO %s/%s: %s\n" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
else else
printf "[STA | MEM %s/%s CPU %s STO %s/%s: %s]\n" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
printf "STA | MEM %s/%s CPU %s STO %s/%s: %s\n" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
fi fi
} }


+ 6
- 6
bar-functions/dwm_transmission.sh View File

@ -20,25 +20,25 @@ dwm_transmission () {
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
case "$STATUS" in case "$STATUS" in
"Idle") "Idle")
printf "[🛑 %s | %s %s ⬆%s ⬇%s]\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
printf "🛑 %s | %s %s ⬆%s ⬇%s\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;; ;;
"Seeding") "Seeding")
printf "[🌱 %s | ⬆%s ⬇%s]\n" "$NAME" "$UP" "$DOWN"
printf "🌱 %s | ⬆%s ⬇%s\n" "$NAME" "$UP" "$DOWN"
;; ;;
"Downloading") "Downloading")
printf "[⏬ %s | %s %s ⬆%s ⬇%s]\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
printf "⏬ %s | %s %s ⬆%s ⬇%s\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;; ;;
esac esac
else else
case "$STATUS" in case "$STATUS" in
"Idle") "Idle")
printf "[IDLE %s | %s %s ⬆%s ⬇%s]\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
printf "IDLE %s | %s %s ⬆%s ⬇%s\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;; ;;
"Seeding") "Seeding")
printf "[SEEDING %s | ⬆%s ⬇%s]\n" "$NAME" "$UP" "$DOWN"
printf "SEEDING %s | ⬆%s ⬇%s\n" "$NAME" "$UP" "$DOWN"
;; ;;
"Downloading") "Downloading")
printf "[DOWNLOADING %s | %s %s ⬆%s ⬇%s]\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
printf "DOWNLOADING %s | %s %s ⬆%s ⬇%s\n" "$NAME" "$DONE" "$ETA" "$UP" "$DOWN"
;; ;;
esac esac
fi fi


+ 2
- 2
bar-functions/dwm_vpn.sh View File

@ -10,11 +10,11 @@ dwm_vpn () {
VPN=$(nmcli -a | grep 'VPN connection' | sed -e 's/\( VPN connection\)*$//g') VPN=$(nmcli -a | grep 'VPN connection' | sed -e 's/\( VPN connection\)*$//g')
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$VPN" != "" ]; then if [ "$VPN" != "" ]; then
printf "[🔒 %s]\n" "$VPN"
printf "🔒 %s\n" "$VPN"
fi fi
else else
if [ "$VPN" != "" ]; then if [ "$VPN" != "" ]; then
printf "[VPN %s]\n" "$VPN"
printf "VPN %s\n" "$VPN"
fi fi
fi fi
} }


+ 2
- 2
bar-functions/dwm_weather.sh View File

@ -10,9 +10,9 @@
dwm_weather() { dwm_weather() {
LOCATION=city LOCATION=city
if [ "$IDENTIFIER" = "unicode" ]; then if [ "$IDENTIFIER" = "unicode" ]; then
printf "[%s]\n" "$(curl -s wttr.in/$LOCATION?format=1)"
printf "%s\n" "$(curl -s wttr.in/$LOCATION?format=1)"
else else
printf "[WEA %s]\n" "$(curl -s wttr.in/$LOCATION?format=1 | grep -o "[0-9].*")"
printf "WEA %s\n" "$(curl -s wttr.in/$LOCATION?format=1 | grep -o "[0-9].*")"
fi fi
} }


+ 2
- 1
dwm_bar.sh View File

@ -30,11 +30,12 @@ export IDENTIFIER="unicode"
. "$DIR/bar-functions/dwm_vpn.sh" . "$DIR/bar-functions/dwm_vpn.sh"
. "$DIR/bar-functions/dwm_network.sh" . "$DIR/bar-functions/dwm_network.sh"
. "$DIR/bar-functions/dwm_keyboard.sh" . "$DIR/bar-functions/dwm_keyboard.sh"
. "$DIR/bar-functions/dwm_ccurse.sh"
. "$DIR/bar-functions/dwm_date.sh" . "$DIR/bar-functions/dwm_date.sh"
# Update dwm status bar every second # Update dwm status bar every second
while true while true
do do
xsetroot -name "$(dwm_countdown)$(dwm_transmission)$(dwm_cmus)$(dwm_resources)$(dwm_battery)$(dwm_mail)$(dwm_alsa)$(dwm_weather)$(dwm_vpn)$(dwm_network)$(dwm_keyboard)$(dwm_date)"
xsetroot -name "[$(dwm_countdown)][$(dwm_transmission)][$(dwm_cmus)][$(dwm_resources)][$(dwm_battery)][$(dwm_mail)][$(dwm_alsa)][$(dwm_weather)][$(dwm_vpn)][$(dwm_network)][$(dwm_keyboard)][$(dwm_date)]"
sleep 1 sleep 1
done done

Loading…
Cancel
Save