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/")
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$VOL" -eq 0 ]; then
printf "[🔇]\n"
printf "🔇\n"
elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then
printf "[🔈 %s%%]\n" "$VOL"
printf "🔈 %s%%\n" "$VOL"
elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then
printf "[🔉 %s%%]\n" "$VOL"
printf "🔉 %s%%\n" "$VOL"
else
printf "[🔊 %s%%]\n" "$VOL"
printf "🔊 %s%%\n" "$VOL"
fi
else
if [ "$VOL" -eq 0 ]; then
printf "[MUTE]\n"
printf "MUTE\n"
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
printf "[VOL %s%%]\n" "$VOL"
printf "VOL %s%%\n" "$VOL"
else
printf "[VOL %s%%]\n" "$VOL"
printf "VOL %s%%\n" "$VOL"
fi
fi
}


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

@ -11,12 +11,12 @@ dwm_battery () {
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$STATUS" = "Charging" ]; then
printf "[🔌 %s%% %s]\n" "$CHARGE" "$STATUS"
printf "🔌 %s%% %s\n" "$CHARGE" "$STATUS"
else
printf "[🔋 %s %%%s]\n" "$CHARGE" "$STATUS"
printf "🔋 %s%% %s\n" "$CHARGE" "$STATUS"
fi
else
printf "[BAT %s%% %s]\n" "$CHARGE" "$STATUS"
printf "BAT %s%% %s\n" "$CHARGE" "$STATUS"
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/://')
if [ "$IDENTIFIER" = "unicode" ]; then
printf "[💡 %s]\n" "$APPOINTMENT"
printf "💡 %s\n" "$APPOINTMENT"
else
printf "[APT %s]\n" "$APPOINTMENT"
printf "APT %s\n" "$APPOINTMENT"
fi
}


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

@ -41,10 +41,10 @@ dwm_cmus () {
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" $((DURATION%3600/60)) $((DURATION%60))
printf "%s]\n" "$SHUFFLE"
printf "%s\n" "$SHUFFLE"
fi
}


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

@ -10,9 +10,9 @@ dwm_countdown () {
for f in /tmp/countdown.*; do
if [ -e "$f" ]; then
if [ "$IDENTIFIER" = "unicode" ]; then
printf "[⏳ %s]\n" "$(tail -1 /tmp/countdown.*)"
printf "⏳ %s\n" "$(tail -1 /tmp/countdown.*)"
else
printf "[CDN %s]\n" "$(tail -1 /tmp/countdown.*)"
printf "CDN %s\n" "$(tail -1 /tmp/countdown.*)"
fi
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]"
dwm_date () {
if [ "$IDENTIFIER" = "unicode" ]; then
printf "[📆 %s]\n" "$(date "+%a %d-%m-%y %T")"
printf "📆 %s\n" "$(date "+%a %d-%m-%y %T")"
else
printf "[DAT %s]\n" "$(date "+%a %d-%m-%y %T")"
printf "DAT %s\n" "$(date "+%a %d-%m-%y %T")"
fi
}


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

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


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

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


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

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


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

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


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

@ -20,25 +20,25 @@ dwm_transmission () {
if [ "$IDENTIFIER" = "unicode" ]; then
case "$STATUS" in
"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")
printf "[🌱 %s | ⬆%s ⬇%s]\n" "$NAME" "$UP" "$DOWN"
printf "🌱 %s | ⬆%s ⬇%s\n" "$NAME" "$UP" "$DOWN"
;;
"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
else
case "$STATUS" in
"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")
printf "[SEEDING %s | ⬆%s ⬇%s]\n" "$NAME" "$UP" "$DOWN"
printf "SEEDING %s | ⬆%s ⬇%s\n" "$NAME" "$UP" "$DOWN"
;;
"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
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')
if [ "$IDENTIFIER" = "unicode" ]; then
if [ "$VPN" != "" ]; then
printf "[🔒 %s]\n" "$VPN"
printf "🔒 %s\n" "$VPN"
fi
else
if [ "$VPN" != "" ]; then
printf "[VPN %s]\n" "$VPN"
printf "VPN %s\n" "$VPN"
fi
fi
}


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

@ -10,9 +10,9 @@
dwm_weather() {
LOCATION=city
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
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
}


+ 2
- 1
dwm_bar.sh View File

@ -30,11 +30,12 @@ export IDENTIFIER="unicode"
. "$DIR/bar-functions/dwm_vpn.sh"
. "$DIR/bar-functions/dwm_network.sh"
. "$DIR/bar-functions/dwm_keyboard.sh"
. "$DIR/bar-functions/dwm_ccurse.sh"
. "$DIR/bar-functions/dwm_date.sh"
# Update dwm status bar every second
while true
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
done

Loading…
Cancel
Save