guest@dotshare [~/groups/wms/bspwm] $ ls blackflag/ | cat

black_flag (scrot) (+2 likes)

szorfein Nov 20, 2016 (wms/bspwm)

bspwmrc(raw, dl)

SCROT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#! /bin/sh

source $(dirname $0)/config

sxhkd &

bspc config border_width            2
bspc config window_gap              7

bspc config split_ratio             0.5
bspc config borderless_monocle      true
bspc config gapless_monocle         true
bspc config focus_by_distance       true
bspc config history_aware_focus     true
bspc config focus_follows_pointer   true
bspc config presel_feedback_color   ${BG}

bspc monitor -d i ii iii iv vi vii

$(dirname $0)/panel &

CLICK TO VIEW

x

config(raw, dl)

 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
#! /bin/sh

HEIGHT=24
FONT="-*-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
FONT_ICON="-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1"
WM_NAME="Bspwm"

# icons
GENTOO="\ue0a0"
ARCH="\ue00e"
CSTART="\ue00d"
CSOUND="\ue04d"
CVOLUME="\ue204"
CMAIL="\ue070"
CRAM="\ue19a"
CCPU="\ue021"
CNET="\ue04b"
CWIFI="\ue222"
# Time
CTIME="\ue018"
CPACK="\ue1b7"
CCLOCK="\ue016"
# panel center
CNONE="\ue001"
CFULL="\ue000"
# icons panel music
CPREV="\ue055"
CNEXT="\ue05b"
CPLAY="\ue058"
CPAUS="\ue059"
# icon volume
VPLUS="\ue06c"
VMINUS="\ue06d"
# battery or AC
BAT100="\ue254"
BAT70="\ue252"
BAT50="\ue250"
BAT30="\ue24f"
BAT15="\ue24e"
BAT7="\ue24c"
CAC="\ue215"

# $(pAction ${fg} ${bg} ${command} ${whatprint})
pAction() {
    echo "%{F$1}%{B$2}%{A:$3:}$(printf '%b' $4)%{A}%{B-}%{F-}"
}

# $(pIcon ${color} ${icon})
pIcon() {
    echo "%{F$1}$(printf '%b' $2)%{F-}"
}

# $(pText ${color} ${text})
pText() {
    echo "%{F$1}$2%{F-}"
}

getXresColor() {
   echo "$( xrdb -query | grep $1: | grep -oE '#[a-zA-Z0-9]{6}' | cut -c 1- )"
}

# colors
BLACK="$(getXresColor color0)"
BLACK2="$(getXresColor color8)"
RED="$(getXresColor color1)"
RED2="$(getXresColor color9)"
GREEN="$(getXresColor color2)"
GREEN2="$(getXresColor color10)"
YELLOW="$(getXresColor color3)"
YELLOW2="$(getXresColor color11)"
BLUE="$(getXresColor color4)"
BLUE2="$(getXresColor color12)"
MAGENTA="$(getXresColor color5)"
MAGENTA2="$(getXresColor color13)"
CYAN="$(getXresColor color6)"
CYAN2="$(getXresColor color14)" 
WHITE="$(getXresColor color7)"
WHITE2="$(getXresColor color15)"

BG="$(getXresColor background)"
FG="$(getXresColor foreground)"

SEP=" "
 

x

panel(raw, dl)

  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
175
176
177
178
179
180
181
182
183
#! /bin/sh

source $(dirname $0)/config
    
if xdo id -a "$WM_NAME" > /dev/null ; then
    printf "%s\n" "The panel is already running." >&2
    exit 1
fi

trap 'trap - TERM; kill 0' INT TERM QUIT EXIT

[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"

bspc config top_padding $HEIGHT
bspc subscribe |\
    grep -oE "[Mm][^TM]*[TML]" --line-buffered |\
    while read line; do echo W$line; done > "$PANEL_FIFO" &

# Top left
{
    getName() {
        local ic=$(pIcon ${YELLOW2} ${GENTOO})
        local cmd=$(uname -n)
        local clr=$(pText ${WHITE} "${cmd}")
        echo " ${ic} ${clr}"
    }

    panelMusic() {
        local prev=$(pAction $BG $FG "mpc prev &>/dev/null" ${CPREV})
        local pause=$(pAction $BG $FG "mpc pause &>/dev/null" ${CPAUS})
        local play=$(pAction $BG $FG "mpc play &>/dev/null" ${CPLAY})
        local next=$(pAction $BG $FG "mpc next &>/dev/null" ${CNEXT})
        echo "${prev}${pause}${play}${next}"
    }

    music() {
        local icon=$(pIcon ${RED2} ${CSOUND})
        local status=$(mpc current)
        if [ "$status" ] ; then
            local artist=$(mpc -f %artist% current)
            local musicname=$(mpc -f %title% current)
            local clr1=$(pText ${FG} "${artist:0:20}")
            local clr2=$(pText ${FG} "${musicname:0:20}")
            echo "${icon} ${clr1} ${clr2}"
        else
            echo "${icon} %{F${RED}}No Sound%{F-}"
        fi
    }

    volume() {
        local icon=$(pIcon ${CYAN2} ${CVOLUME})
        local cmd=$(mpc volume | awk '{print $2}' | cut -d '%' -f 1)
        local cmd+=" %"
        local clr=$(pText ${MAGENTA2} "${cmd}")
        local plus=$(pAction $BG $FG "mpc volume +4 &>/dev/null" ${VPLUS})
        local minus=$(pAction $BG $FG "mpc volume -3 &>/dev/null" ${VMINUS})
        echo "${icon} ${clr} ${plus}${minus}"
    }

    while :; do
        echo "T$(getName) $(panelMusic) $(music) $(volume)"
        sleep 5
    done

} > "$PANEL_FIFO" &

# Top Right
{
    getDay() {
        local icon=$(pIcon ${GREEN} ${CTIME})
        local cmd=$(date '+%A %d %b')
        local clr=$(pText ${MAGENTA} "${cmd}")
        echo "${icon} ${clr}"
    }

    clock() {
        local icon=$(pIcon ${GREEN2} ${CCLOCK})
        local cmd=$(date +%H:%M)
        local clr=$(pText ${FG} "${cmd}")
        echo "${icon} ${clr}"
    }

    mail() {
        local gmaildir=/home/izsha/.mails/Gmail-Szorfein/\[Gmail\].All\ Mail/new
        local prog=$(pAction $BG $FG "urxvtc -e mutt" ${CMAIL})
        local icon=$(pIcon ${CYAN} ${CMAIL})
        local count=0
        if [[ ! -n $(ls "${gmaildir}") ]]; then
            count=0
        else
            count=$(ls -1 "${gmaildir}" | wc -l)
        fi
        echo "${prog} ${count}"
    }

    net() {
        local _GETIWL=$(/sbin/iwgetid -r)
        local _GETETH=$(ip a | grep "state UP" | awk '{ORS=""}{print $2}' | cut -d ':' -f 1)
        local _status=${_GETIWL:-$_GETETH}
        local _status2=${_status:-Down}
        local icon=$(pIcon ${CYAN2} ${CNET})

        echo "${icon} $(pText ${FG} ${_status2})"
    } 

    energy() {
        local ac=/sys/class/power_supply/AC/online
        local bat=/sys/class/power_supply/BAT0/present
        local icon=""
        local batCap=""
        if [[ -e $bat ]] && [[ $(cat $ac) -lt 1 ]]; then
            batCap="$(cat ${bat%/*}/capacity)"
            [ $batCap -gt 90 ] && icon=$BAT100
            [ $batCap -gt 70 ] && [ $batCap -lt 90 ] && icon=$BAT70
            [ $batCap -gt 50 ] && [ $batCap -lt 70 ] && icon=$BAT50
            [ $batCap -gt 30 ] && [ $batCap -lt 50 ] && icon=$BAT30
            [ $batCap -gt 15 ] && [ $batCap -lt 30 ] && icon=$BAT15
            [ $batCap -lt 7 ] && icon=$BAT7
        elif [[ -n $(cat $ac) ]]; then
            batCap="AC"
            icon=$CAC
        else
            batCap="wttf"
        fi
        echo "$(pIcon ${CYAN2} $icon) $(pText ${MAGENTA} ${batCap})"
    }

    ram() {
        local icon=$(pIcon ${CYAN} ${CRAM})
        local cmd=$(free -m | grep Mem | awk '{print $3}')
        cmd+=" Mb"
        local clr=$(pText ${FG} "${cmd}")
        echo "${icon} ${clr}"
    }

    # Cpu List Load, number of Process and actual MHz frequency.
    cpu() {
        local icon=$(pIcon ${GREEN2} ${CCPU})
        local cmd="$(cat /proc/loadavg | awk '{print $1}')"
        local cmd+=" $(cat /proc/loadavg | awk '{print $4}')"
        local cmd+=" $(cat /proc/cpuinfo| grep MHz | awk '{ORS=" "}{print $4}' | sed -e 's/.000//g' | cut -f 1)"

        local clr=$(pText ${MAGENTA2} "${cmd}")
        echo "${icon} ${clr}"
    }

    # On archlinux, change cmd=$(pacman -Ql | wc -l), or remove it complety.
    package() {
        local icon=$(pIcon ${GREEN} ${CPACK})
        local cmd=$(equery list "*" | wc -l)
        local clr=$(pText ${MAGENTA} "${cmd}")
        echo "${icon} ${clr}"
    }

    while :; do
        echo "S$(package) $(cpu) $(ram) $(energy) $(net) $(mail) $(clock) $(getDay)"
        sleep 5
    done

} > "$PANEL_FIFO" &

$(dirname $0)/panel_bar < "$PANEL_FIFO" | lemonbar \
    -a 32 \
    -n "$WM_NAME" \
    -g x$HEIGHT \
    -f "$FONT" \
    -f "$FONT_ICON" \
    -F "$FG" \
    -B "$BG" | sh | while read line; do eval "$line"; done &

wid=$(xdo id -a "$WM_NAME")
tries_left=20

while [ -z "$wid" -a "$tries_left" -gt 0 ] ; do
	sleep 0.05
	wid=$(xdo id -a "$WM_NAME")
	tries_left=$((tries_left - 1))
done

[ -n "$wid" ] && xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"

wait
 

x

panel_bar(raw, dl)

 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
#! /bin/sh

source $(dirname $0)/config

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

while read -r line ; do
    case $line in
        S*)
            # clock output
            sysR="${line#?}"
            ;;
		T*)
			# xtitle output
            sysL="${line#?}"
			;;
		W*)
			# bspwm's state
			wm=""
			IFS=':'
			set -- ${line#?}
			while [ $# -gt 0 ] ; do
				item=$1
				name=${item#?}
				case $item in
					[mM]*)
						[ $num_mon -lt 2 ] && shift && continue
						case $item in
							m*)
								# monitor
                                FG=${FG}
                                BG=${BG}
								;;
							M*)
								# focused monitor
                                FG=${FG}
                                BG=${BG}
								;;
						esac
                        wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${name} %{A}%{B-}%{F-}"
						;;
					[fFoOuU]*)
						case $item in
							f*)
								# free desktop
                                FG=${MAGENTA}
                                IC=${CNONE}
                                BG=${BG}
								;;
							F*)
								# focused free desktop
                                FG="#ac8e8e"
                                IC=${CNONE}
                                BG=${BG}
								;;
							o*)
								# occupied desktop
                                FG=${GREEN}
                                IC=${CFULL}
                                BG=${BG}
								;;
							O*)
								# focused occupied desktop
                                FG="#ac8e8e"
                                IC=${CFULL}
                                BG=${BG}
								;;
							u*)
								# urgent desktop
                                FG=${GREEN2}
                                IC=${CNONE}
                                BG=${BG}
								;;
							U*)
								# focused urgent desktop
                                FG=${RED2}
                                IC=${CFULL}
                                BG=${BG}
								;;
						esac
                        wm="${wm}%{F${FG}}%{B${BLACK}}%{A:bspc desktop -f ${name}:} $(printf '%b' $IC) %{A}%{B-}%{F-}"
						;;
					[LTG]*)
						# layout, state and flags
                        wm="${wm}%{F${FG}}%{B${BG}} ${name} %{B-}%{F-}"
						;;
				esac
				shift
			done
			;;
	esac
	printf "%s\n" "%{l}${sysL}%{c}${wm}%{r}${sysR}"
done
 

x

Notes

all config file are on https://github.com/szorfein/dotfiles
the wallpaper here http://i.imgur.com/oLaWogQ.jpg

Font: Monoid
Terminal: termite