Skip to content
Browse files

update status bar

  • Loading branch information...
1 parent ba5c0bf commit d95ce8c54e4b6a7953e473d197c07ff243ddd538 @c00kiemon5ter committed
Showing with 24 additions and 13 deletions.
  1. +18 −8 statusbar
  2. +6 −5 wmrun
View
26 statusbar
@@ -1,19 +1,29 @@
#!/usr/bin/env bash
+separator="\u19"
+
+# volume
mute="$(amixer get Master | sed -nr '$ s:.*\[(.+)]$:\1:p')"
vol="$(amixer get PCM | sed -nr '$ s:.*\[(.+%)].*:\1:p')"
-{ [[ ${mute} == "off" ]] && vstat="ë"; } || \
-{ (( ${vol%\%} <= 25 )) && vstat="ì"; } || vstat="í"
+{ [[ ${mute} == "off" ]] && vstat="\uEB"; } || \
+{ (( ${vol%\%} <= 20 )) && vstat="\uEC"; } || vstat="\uED"
-wifi="$(wireless_status)" wstat="¤"
+wifi="$(wireless_status)" wstat="\uA4"
-music="$(mpc current)"
-{ [[ -z "${music}" ]] && mstat="å"; } || \
+# now playing music
+music="$(mpc current | sed 's/\([^-]\+\) - \(.*\)/\2 \&8by\&3 \1/')"
+{ [[ -z "${music}" ]] && music="[stopped]" mstat="\uE5"; } || \
{ mstat="$(mpc | sed -rn '2s/\[([[:alpha:]]+)].*/\1/p')"
- [[ "${mstat}" == "paused" ]] && mstat="ç" || mstat="ê"
+ [[ "${mstat}" == "paused" ]] && mstat="\uE7" || mstat="\uEA"
}
-date="$(date +"%a %d/%m %R")" dstat="¾"
+# date and time
+date="$(date +"%a %d/%m %R")" dstat="\uC9"
-printf "&3%s &5| &3%s &5| &3%s &5| &3%s \n" "${music:-[stopped]}" "${wifi}" "${vol}" "${date}"
+# print it colored and formatted
+printf "&8%b &4%b &3%s " \
+ "${separator}" "${mstat}" "${music}" \
+ "${separator}" "${wstat}" "${wifi}" \
+ "${separator}" "${vstat}" "${vol}" \
+ "${separator}" "${dstat}" "${date}"
View
11 wmrun
@@ -11,15 +11,16 @@ some_sorta_bar &
while read -t 60 -r wmout || true; do
if [[ $wmout =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then
- read -ra desktops <<< "$wmout" && unset r
- for desktop in "${desktops[@]}"; do
- IFS=':' read -r d w m c u <<< "$desktop"
+ read -ra desks <<< "$wmout" && unset out
+ for desk in "${desks[@]}"; do
+ IFS=':' read -r d w m c u <<< "$desk"
((c)) && fg="&4" i="${ms[$m]}" || fg="&3"
((u)) && w+='&5!'
- r+="$fg${ds[$d]} ${w/#0/&8-} "
+ printf -v o "${fg}%s %s &8%b " "${ds[$d]}" "${w/0/-}" "\u19"
+ out+=("$o")
done
fi
- xsetroot -name "&L$r&5[&3$i&5] &R$(statusbar)"
+ xsetroot -name "&L${out[@]}&5[&3$i&5] &R$(statusbar)"
done < "$ff" &
$wm | tee -a "$ff"

0 comments on commit d95ce8c

Please sign in to comment.
Something went wrong with that request. Please try again.