aboutsummaryrefslogtreecommitdiff
path: root/tools/panel/panel_bar
blob: 779c5bbf5df4f242fffe54c12dbe05fb7d8303c5 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#! /bin/sh
#
# Example panel for LemonBoy's bar


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

source ./panel_colors
source ./icons
while read -r line ; do
	case $line in
		Imail) 
			mbsync -a > /dev/null
			if bspc control --get-status | grep OIX > /dev/null;then
			mail=''
			else
			mail="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_MAIL} %{B-}%{F-}"
			fi
			;;
	
		Iface)
			if bspc control --get-status | grep OX > /dev/null;then
				face=''
			else
				face="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_FACE} %{B-}%{F-}"
			fi
			;;
	
		Ipub)
			if bspc control --get-status | grep OX > /dev/null;then
				pub=''
			else
				pub="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PUB} %{B-}%{F-}"
			fi
			;;

		Ipriv)
			if bspc control --get-status | grep OX > /dev/null;then
				priv=''
			else
				priv="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PRIV} %{B-}%{F-}"
			fi
			;;
		Iclear)
			priv=""
			pub=""
			face=""
			;;
		Ixlear)
                       mail=''
	               ;;
#		C*)
#			cpu="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} C:${line#?} %{B-}%{F-}"
#			;;
#		R*)
#			ram="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} R:${line#?} %{B-}%{F-}"
#			;;
	
#		S*)
#			signal="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} S:${line#?} %{B-}%{F-}"
#			;;
	
		p*)
			# playing mpc 
			paused=''
			playing="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PLAY} ${line#?} %{B-}%{F-}"
			;;
	
		P*)
			# paused mpc
			playing=''
			paused="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PAUSE} ${line#?} %{B-}%{F-}"
			;;
		K*)
			# volume output
			musicvol="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_MUSIC} ${line#?} %{B-}%{F-}"
			;;
	
	
		B*)
			# battery output
			if [[ ${line#?} =~ Discharging ]];then
			percent=`echo ${line#?} | cut -d' ' -f2`
			battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PWR} ${percent} %{B-}%{F-}";
		        else
			percent=`echo ${line#?} | cut -d' ' -f2`
			battery="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_PLUG} ${percent} %{B-}%{F-}";
		        fi
			;;
	
	
		V*)
			# volume output
			if amixer contents | head -12 | tail -1 | grep on > /dev/null;then
			volume="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_HPHONES} ${line#?} %{B-}%{F-}"
		        else
			volume="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${ICON_VOLUME_UP} ${line#?} %{B-}%{F-}";
			fi
			;;
	
		E*)
			# essid output
                        if [ -z ${line#?} ];then 
			essid="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} E:No WiFi  %{B-}%{F-}"
                        else
			essid="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} E:${line#?} %{B-}%{F-}"
                        fi
			;;
	
		Z*)
			# clock output
			time_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}"
			;;
		T*)
			# xtitle output
			title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
			;;
		W*)
			# bspwm internal state
			wm_infos=""
			IFS=':'
			set -- ${line#?}
			while [ $# -gt 0 ] ; do
				item=$1
				name=${item#?}
				case $item in
					M*)
						# active monitor
						if [ $num_mon -gt 1 ] ; then
							wm_infos="$wm_infos %{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG} ${name} %{B-}%{F-}  "
						fi
						;;
#					m*)
#						# inactive monitor
#						if [ $num_mon -gt 1 ] ; then
#							wm_infos="$wm_infos %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG} ${name} %{B-}%{F-}  "
#						fi
#						;;
					O*)
						# focused occupied desktop
						wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG}%{U$COLOR_FOREGROUND} ${name} %{-u}%{B-}%{F-}"
						;;
					F*)
						# focused free desktop
						wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG}%{U$COLOR_FOREGROUND} ${name} %{-u}%{B-}%{F-}"
						;;
					U*)
						# focused urgent desktop
						wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FG}%{B$COLOR_FOCUSED_BG}%{U$COLOR_FOREGROUND} ${name} %{-u}%{B-}%{F-}"
						;;
#					o*)
#						# occupied desktop
#						wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG} ${name} %{B-}%{F-}"
#						;;
#					f*)
#						# free desktop
#						wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG} ${name} %{B-}%{F-}"
#						;;
#					u*)
#						# urgent desktop
#						wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG} ${name} %{B-}%{F-}"
#						;;
#					L*)
#						# layout
#						wm_infos="$wm_infos  %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG} ${name} %{B-}%{F-}"
#						;;
				esac
				shift
			done
			;;
	esac
#	printf "%s\n" "%{l}${wm_infos}${title}%{r}${playing}${paused}${cpu}${ram}${essid}${signal}${volume}${musicvol}${battery}${time_infos}             "
	printf "%s\n" "%{l}${wm_infos}${title}%{r}${face}${priv}${pub}${mail}${playing}${paused}${cpu}${ram}${volume}${musicvol}${battery}${time_infos}"
done