Created
August 10, 2015 05:45
-
-
Save pinguinson/ff8e37bba6574f4b7593 to your computer and use it in GitHub Desktop.
panel_bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
. panel_colors | |
num_mon=$(bspc query -M | wc -l) | |
PADDING=" " | |
while read -r line ; do | |
case $line in | |
N*) | |
# wifi output | |
wifi="$PADDING${line#?}$PADDING" | |
;; | |
B*) | |
# battery output | |
battery="$PADDING${line#?}$PADDING" | |
;; | |
D*) | |
# date output | |
date="$PADDING${line#?}$PADDING" | |
;; | |
C*) | |
# clock output | |
clock="$PADDING${line#?}$PADDING" | |
;; | |
V*) | |
# alsa volume | |
volume="$PADDING${line#?}$PADDING" | |
;; | |
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_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG}$PADDING${name}$PADDING%{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}$PADDING${name}$PADDING%{B-}%{F-} " | |
fi | |
;; | |
O*) | |
# focused occupied desktop | |
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}" | |
;; | |
F*) | |
# focused free desktop | |
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}" | |
;; | |
U*) | |
# focused urgent desktop | |
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}" | |
;; | |
o*) | |
# occupied desktop | |
wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG}%{A:bspc desktop -f ${name}:}$PADDING${name}$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${name}$PADDING%{A}%{B-}%{F-}" | |
;; | |
u*) | |
# urgent desktop | |
wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG}$PADDING${name}$PADDING%{B-}%{F-}" | |
;; | |
esac | |
shift | |
done | |
;; | |
esac | |
printf "%s\n" "%{l}${wm_infos}%{r}${title}${wifi}${volume}${battery}${date}${clock}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment