summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/statusbar_main
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-20 12:16:15 -0700
committerDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-20 12:16:15 -0700
commit562ccc7d9514d60bcbc13072da6ed50e478b94f1 (patch)
tree79f578d1a8fbc76643bc1d76bf7ecd523369e6e9 /.local/bin/statusbar/statusbar_main
parentb8e8d75bdfb7017deb46249f2b3fb9725f2713ab (diff)
Leave this bar for good, for now
Diffstat (limited to '.local/bin/statusbar/statusbar_main')
-rwxr-xr-x.local/bin/statusbar/statusbar_main112
1 files changed, 112 insertions, 0 deletions
diff --git a/.local/bin/statusbar/statusbar_main b/.local/bin/statusbar/statusbar_main
new file mode 100755
index 0000000..7cf27db
--- /dev/null
+++ b/.local/bin/statusbar/statusbar_main
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+. statusbar_colors
+
+while read -r line ; do
+ case $line in
+ C*)
+ clock="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
+ ;;
+ T*)
+ title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
+ ;;
+ W*)
+ # bspwm's state
+ wm=
+ IFS=':'
+ set -- ${line#?}
+ while [ $# -gt 0 ] ; do
+ item=$1
+ name=${item#?}
+ case $item in
+ [mM]*)
+ case $item in
+ m*)
+ # monitor
+ FG=$COLOR_MONITOR_FG
+ BG=$COLOR_MONITOR_BG
+ on_focused_monitor=0
+ ;;
+ M*)
+ # focused monitor
+ FG=$COLOR_FOCUSED_MONITOR_FG
+ BG=$COLOR_FOCUSED_MONITOR_BG
+ on_focused_monitor=1
+ ;;
+ esac
+ [ $num_mon -lt 2 ] && shift && continue
+ wm="%{S${on_focused_monitor}}${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${name} %{A}%{B-}%{F-}"
+ ;;
+ [fFoOuU]*)
+ case $item in
+ f*)
+ # free desktop
+ FG=$COLOR_FREE_FG
+ BG=$COLOR_FREE_BG
+ UL=$BG
+ ;;
+ F*)
+ if [ "$on_focused_monitor" ] ; then
+ # focused free desktop
+ FG=$COLOR_FOCUSED_FREE_FG
+ BG=$COLOR_FOCUSED_FREE_BG
+ UL=$BG
+ else
+ # active free desktop
+ FG=$COLOR_FREE_FG
+ BG=$COLOR_FREE_BG
+ UL=$COLOR_FOCUSED_FREE_BG
+ fi
+ ;;
+ o*)
+ # occupied desktop
+ FG=$COLOR_OCCUPIED_FG
+ BG=$COLOR_OCCUPIED_BG
+ UL=$BG
+ ;;
+ O*)
+ if [ "$on_focused_monitor" ] ; then
+ # focused occupied desktop
+ FG=$COLOR_FOCUSED_OCCUPIED_FG
+ BG=$COLOR_FOCUSED_OCCUPIED_BG
+ UL=$BG
+ else
+ # active occupied desktop
+ FG=$COLOR_OCCUPIED_FG
+ BG=$COLOR_OCCUPIED_BG
+ UL=$COLOR_FOCUSED_OCCUPIED_BG
+ fi
+ ;;
+ u*)
+ # urgent desktop
+ FG=$COLOR_URGENT_FG
+ BG=$COLOR_URGENT_BG
+ UL=$BG
+ ;;
+ U*)
+ if [ "$on_focused_monitor" ] ; then
+ # focused urgent desktop
+ FG=$COLOR_FOCUSED_URGENT_FG
+ BG=$COLOR_FOCUSED_URGENT_BG
+ UL=$BG
+ else
+ # active urgent desktop
+ FG=$COLOR_URGENT_FG
+ BG=$COLOR_URGENT_BG
+ UL=$COLOR_FOCUSED_URGENT_BG
+ fi
+ ;;
+ esac
+ wm="${wm}%{F${FG}}%{B${BG}}%{U${UL}}%{+u}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}%{-u}"
+ ;;
+ [LTG]*)
+ # layout, state and flags
+ wm="${wm}%{F$COLOR_STATE_FG}%{B$COLOR_STATE_BG} ${name} %{B-}%{F-}"
+ ;;
+ esac
+ shift
+ done
+ ;;
+ esac
+ printf "%s\n" "%{l}${wm}%{c}${title}%{r}${clock}"
+done