inc/dec brightness in smaller amounts
[~bandali/configs] / bspwm / .local / bin / panel_bar
1 #! /bin/sh
2 #
3 # Example panel for LemonBoy's bar
4
5 . panel_colors
6
7 num_mon=$(bspc query -M | wc -l)
8
9 while read -r line ; do
10 case $line in
11 S*)
12 # clock output
13 sys_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}"
14 ;;
15 T*)
16 # xtitle output
17 title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
18 ;;
19 W*)
20 # bspwm internal state
21 wm_infos=""
22 IFS=':'
23 set -- ${line#?}
24 while [ $# -gt 0 ] ; do
25 item=$1
26 name=${item#?}
27 case $item in
28 M*)
29 # active monitor
30 if [ $num_mon -gt 1 ] ; then
31 wm_infos="$wm_infos %{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG} ${name} %{B-}%{F-} "
32 fi
33 ;;
34 m*)
35 # inactive monitor
36 if [ $num_mon -gt 1 ] ; then
37 wm_infos="$wm_infos %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG} ${name} %{B-}%{F-} "
38 fi
39 ;;
40 O*)
41 # focused occupied desktop
42 wm_infos="${wm_infos}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
43 ;;
44 F*)
45 # focused free desktop
46 wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
47 ;;
48 U*)
49 # focused urgent desktop
50 wm_infos="${wm_infos}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
51 ;;
52 o*)
53 # occupied desktop
54 wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG} ${name} %{B-}%{F-}"
55 ;;
56 f*)
57 # free desktop
58 wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG} ${name} %{B-}%{F-}"
59 ;;
60 u*)
61 # urgent desktop
62 wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG} ${name} %{B-}%{F-}"
63 ;;
64 L*)
65 # layout
66 wm_infos="$wm_infos %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG} ${name} %{B-}%{F-}"
67 ;;
68 esac
69 shift
70 done
71 ;;
72 esac
73 printf "%s\n" "%{l}${wm_infos}%{c}${title}%{r}${sys_infos}"
74 done