Panel: differentiate focused and active desktops

This commit is contained in:
Bastien Dejean 2017-10-11 14:29:01 +02:00
parent 7b33567f8f
commit 06c539a1dd
2 changed files with 42 additions and 13 deletions

View file

@ -16,7 +16,7 @@ bspc subscribe report > "$PANEL_FIFO" &
. panel_colors . panel_colors
panel_bar < "$PANEL_FIFO" | lemonbar -a 32 -n "$PANEL_WM_NAME" -g x$PANEL_HEIGHT -f "$PANEL_FONT" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" | sh & panel_bar < "$PANEL_FIFO" | lemonbar -a 32 -u 2 -n "$PANEL_WM_NAME" -g x$PANEL_HEIGHT -f "$PANEL_FONT" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" | sh &
wid=$(xdo id -m -a "$PANEL_WM_NAME") wid=$(xdo id -m -a "$PANEL_WM_NAME")
xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid" xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"

View file

@ -18,7 +18,7 @@ while read -r line ; do
;; ;;
W*) W*)
# bspwm's state # bspwm's state
wm="" wm=
IFS=':' IFS=':'
set -- ${line#?} set -- ${line#?}
while [ $# -gt 0 ] ; do while [ $# -gt 0 ] ; do
@ -26,19 +26,21 @@ while read -r line ; do
name=${item#?} name=${item#?}
case $item in case $item in
[mM]*) [mM]*)
[ $num_mon -lt 2 ] && shift && continue
case $item in case $item in
m*) m*)
# monitor # monitor
FG=$COLOR_MONITOR_FG FG=$COLOR_MONITOR_FG
BG=$COLOR_MONITOR_BG BG=$COLOR_MONITOR_BG
on_focused_monitor=
;; ;;
M*) M*)
# focused monitor # focused monitor
FG=$COLOR_FOCUSED_MONITOR_FG FG=$COLOR_FOCUSED_MONITOR_FG
BG=$COLOR_FOCUSED_MONITOR_BG BG=$COLOR_FOCUSED_MONITOR_BG
on_focused_monitor=1
;; ;;
esac esac
[ $num_mon -lt 2 ] && shift && continue
wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${name} %{A}%{B-}%{F-}" wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${name} %{A}%{B-}%{F-}"
;; ;;
[fFoOuU]*) [fFoOuU]*)
@ -47,34 +49,61 @@ while read -r line ; do
# free desktop # free desktop
FG=$COLOR_FREE_FG FG=$COLOR_FREE_FG
BG=$COLOR_FREE_BG BG=$COLOR_FREE_BG
UL=$BG
;; ;;
F*) F*)
# focused free desktop if [ "$on_focused_monitor" ] ; then
FG=$COLOR_FOCUSED_FREE_FG # focused free desktop
BG=$COLOR_FOCUSED_FREE_BG 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*) o*)
# occupied desktop # occupied desktop
FG=$COLOR_OCCUPIED_FG FG=$COLOR_OCCUPIED_FG
BG=$COLOR_OCCUPIED_BG BG=$COLOR_OCCUPIED_BG
UL=$BG
;; ;;
O*) O*)
# focused occupied desktop if [ "$on_focused_monitor" ] ; then
FG=$COLOR_FOCUSED_OCCUPIED_FG # focused occupied desktop
BG=$COLOR_FOCUSED_OCCUPIED_BG 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*) u*)
# urgent desktop # urgent desktop
FG=$COLOR_URGENT_FG FG=$COLOR_URGENT_FG
BG=$COLOR_URGENT_BG BG=$COLOR_URGENT_BG
UL=$BG
;; ;;
U*) U*)
# focused urgent desktop if [ "$on_focused_monitor" ] ; then
FG=$COLOR_FOCUSED_URGENT_FG # focused urgent desktop
BG=$COLOR_FOCUSED_URGENT_BG 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 esac
wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}" wm="${wm}%{F${FG}}%{B${BG}}%{U${UL}}%{+u}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}%{-u}"
;; ;;
[LTG]*) [LTG]*)
# layout, state and flags # layout, state and flags