3 # Example panel for dzen2
5 font_family='sans-serif'
11 screen_width=$(sres -W)
16 while getopts 'af:s:' opt ; do
32 while read -r line ; do
36 sys_infos="^fg($COLOR_STATUS_FG)^bg($COLOR_STATUS_BG)^ca(1, bspc toggle_visibility)${PADDING}${line#?}${PADDING}^ca()^fg()^bg()${PADDING}"
39 # focused window title
40 title="^fg($COLOR_TITLE_FG)^bg($COLOR_TITLE_BG)^ca(1, bspc toggle_floating)^ca(2, bspc toggle_locked)^ca(3, bspc close)${PADDING}${line#?}${PADDING}^ca()^ca()^ca()"
43 # window manager informations
47 while [ $# -gt 0 ] ; do
55 # urgent (inactive) desktop
75 wm_infos="${wm_infos}^fg(${FG})^bg(${BG})^ca(1, bspc use ${name})^ca(2, bspc send_to ${name})^ca(3, bspc send_to ${name} --follow)${PADDING}${name}${PADDING}^ca()^ca()^ca()"
79 layout=$(printf "%s" "${item#?}" | sed 's/^\(.\).*/\U\1/')
80 wm_infos="${wm_infos}^fg()^bg()${PADDING}${PADDING}^fg($COLOR_LAYOUT_FG)^bg($COLOR_LAYOUT_BG)^ca(1, bspc cycle_layout)^ca(2, bspc balance)${PADDING}$layout${PADDING}^ca()^ca()"
88 set - $(printf '%s\0%s\0%s' "$wm_infos" "$title" "$sys_infos" | sed 's/\^[a-z]\+([^)]*)//g' | xargs -0 textwidth -f "$font_family" -s "$font_size")
93 right_indent=$((screen_width - right_width))
94 available_center=$((screen_width - (left_width + right_width)))
95 if [ $available_center -lt $center_width ] ; then
96 center_indent=$((left_indent + left_width))
98 if [ $adaptive_centering -eq 1 ] ; then
99 center_indent=$((left_width + (available_center - center_width) / 2))
101 center_indent=$(( (screen_width - center_width) / 2 ))
104 printf "%s\n" "^pa($center_indent)$title^pa($left_indent)$wm_infos^pa($right_indent)$sys_infos"