aboutsummaryrefslogtreecommitdiff
path: root/assets/panel_bar
blob: c51dfd8aa3b8033b0a3aa7921fba1f4b64a3dd95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
#
#

. panel_colors

num_mon=$(bspc query -M | wc -l)
PADDING="  "

while read -r line ; do
	case $line in
		D*)
			# date output
			date="%{A1:dzen_cal:}$PADDING${line#?}$PADDING%{A}"
			;;
		R*)
			# music info
			music="$PADDING%{B$COLOR_FOCUSED_OCCUPIED_BG}%{F$COLOR_FOCUSED_OCCUPIED_FG}$PADDING${line#?}$PADDING%{F-}%{B-}"
			;;
		C*)
			# clock output
			clock="%{A1:dzen_cal:}$PADDING${line#?}$PADDING%{A}"
			;;
		T*)
			# xtitle output
			title="$PADDING$PADDING${line#?}$PADDING$PADDING$PADDING$PADDING"
			;;

		V*)
			# alsa volume
			volume="$PADDING${line#?}$PADDING"
			;;
		P*)
			# power
			power="%{A1:sudo pm-suspend:}%{A2:sudo poweroff:}%{A3:sudo reboot:}$PADDING${line#?}$PADDING%{A}%{A}%{A}"
			;;

		W*)
			# bspwm internal state
			wm_infos=""
			IFS=':'
			set -- ${line#?}
			while [ $# -gt 0 ] ; do
				item=$1
				name=${item#?}
				case $item in
					
					O*)
						# focused occupied desktop
						wm_infos="${wm_infos}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}$PADDING$PADDING%{B-}%{F-}"
						;;
					F*)
						# focused free desktop
						wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}$PADDING$PADDING%{B-}%{F-}"
						;;
					U*)
						# focused urgent desktop
						wm_infos="${wm_infos}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}$PADDING$PADDING%{B-}%{F-}"
						;;
					o*)
						# occupied desktop
						wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG}%{A:bspc desktop -f ${name}:}$PADDING$PADDING%{A}%{B-}%{F-}"
						;;
					f*)
						# free desktop
						wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG}%{A:bspc desktop -f ${name}:}$PADDING$PADDING%{A}%{B-}%{F-}"
						;;
					u*)
						# urgent desktop
						wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG}%{A:bspc desktop -f ${name}:}$PADDING$PADDING%{A}%{B-}%{F-}"
						;;
				esac
				shift
			done
			;;
	esac
	printf "%s\n" "%{l}${power}${title}%{c}${wm_infos}%{r}${volume}${clock}  "
done