bspwm/examples/panel/panel_bar

75 lines
2 KiB
Text
Raw Normal View History

2012-12-27 22:37:16 +01:00
#! /bin/sh
2012-12-19 15:50:42 +01:00
#
2013-10-22 09:42:34 +02:00
# Example panel for LemonBoy's bar
2012-12-19 15:50:42 +01:00
2014-07-19 15:26:06 +02:00
. panel_colors
num_mon=$(bspc query -M | wc -l)
2012-12-19 15:50:42 +01:00
while read -r line ; do
2014-01-21 20:48:49 +01:00
case $line in
S*)
# clock output
2014-07-19 15:26:06 +02:00
sys_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
T*)
# xtitle output
2014-07-19 15:26:06 +02:00
title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
W*)
# bspwm internal state
wm_infos=""
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
name=${item#?}
case $item in
2014-07-19 15:26:06 +02:00
M*)
# active monitor
if [ $num_mon -gt 1 ] ; then
wm_infos="$wm_infos %{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG} ${name} %{B-}%{F-} "
fi
;;
m*)
# inactive monitor
if [ $num_mon -gt 1 ] ; then
2014-07-19 20:40:05 +02:00
wm_infos="$wm_infos %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG} ${name} %{B-}%{F-} "
2014-07-19 15:26:06 +02:00
fi
;;
2014-01-21 20:48:49 +01:00
O*)
# focused occupied desktop
2014-07-19 15:26:06 +02:00
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
F*)
# focused free desktop
2014-07-19 15:26:06 +02:00
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
U*)
# focused urgent desktop
2014-07-19 15:26:06 +02:00
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
o*)
# occupied desktop
2014-07-19 15:26:06 +02:00
wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG} ${name} %{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
f*)
# free desktop
2014-07-19 15:26:06 +02:00
wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG} ${name} %{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
u*)
# urgent desktop
2014-07-19 15:26:06 +02:00
wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG} ${name} %{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
L*)
# layout
2014-07-19 15:26:06 +02:00
wm_infos="$wm_infos %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG} ${name} %{B-}%{F-}"
2014-01-21 20:48:49 +01:00
;;
esac
shift
done
;;
esac
2014-07-19 15:26:06 +02:00
printf "%s\n" "%{l}${wm_infos}%{c}${title}%{r}${sys_infos}"
2012-12-19 15:50:42 +01:00
done