Remove dzen2 panel example

This commit is contained in:
Bastien Dejean 2014-07-19 15:26:06 +02:00
parent aebb6713b4
commit 1e98766089
6 changed files with 35 additions and 160 deletions

View file

@ -7,29 +7,16 @@ fi
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
flavor=${1:-bar}
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"
bspc config top_padding $PANEL_HEIGHT
bspc control --subscribe > "$PANEL_FIFO" &
xtitle -sf 'T%s' > "$PANEL_FIFO" &
clock -sf 'S%a %H:%M' > "$PANEL_FIFO" &
. panel_colors-${flavor}
. panel_colors
case "$flavor" in
bar)
FONT_FAMILY='-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1'
cat "$PANEL_FIFO" | panel_bar | bar -g x$PANEL_HEIGHT -f "$FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" &
;;
dzen2)
FONT_FAMILY='DejaVu Sans'
FONT_SIZE=11
cat "$PANEL_FIFO" | panel_dzen2 -f "$FONT_FAMILY" -s "$FONT_SIZE" | dzen2 -h $PANEL_HEIGHT -dock -ta l -title-name panel -fn "${FONT_FAMILY}:pixelsize=${FONT_SIZE}" -fg "$COLOR_FOREGROUND" -bg "$COLOR_BACKGROUND" &
;;
esac
cat "$PANEL_FIFO" | panel_bar | bar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" &
wait

View file

@ -2,17 +2,19 @@
#
# Example panel for LemonBoy's bar
. panel_colors-bar
. panel_colors
num_mon=$(bspc query -M | wc -l)
while read -r line ; do
case $line in
S*)
# clock output
sys_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}"
sys_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#?}"
title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
;;
W*)
# bspwm internal state
@ -23,38 +25,50 @@ while read -r line ; 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} ${name} %{B-}%{F-} "
fi
;;
m*)
# inactive monitor
if [ $num_mon -gt 1 ] ; then
wm_infos="$wm_infos %{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG} ${name} %{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}${name}%{B-}%{-u}"
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-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}${name}%{-u}"
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-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}${name}%{-u}"
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
;;
o*)
# occupied desktop
wm_infos="$wm_infos %{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG}${name}"
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}"
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}"
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}"
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 %{c} $title %{r} $sys_infos "
printf "%s\n" "%{l}${wm_infos}%{c}${title}%{r}${sys_infos}"
done

View file

@ -1,5 +1,9 @@
COLOR_FOREGROUND='#FFA3A6AB'
COLOR_BACKGROUND='#FF34322E'
COLOR_ACTIVE_MONITOR_FG='#FF34322E'
COLOR_ACTIVE_MONITOR_BG='#FF58C5F1'
COLOR_INACTIVE_MONITOR_FG='#FF58C5F1'
COLOR_INACTIVE_MONITOR_BG='#FF34322E'
COLOR_FOCUSED_OCCUPIED_FG='#FFF6F9FF'
COLOR_FOCUSED_OCCUPIED_BG='#FF5C5955'
COLOR_FOCUSED_FREE_FG='#FFF6F9FF'

View file

@ -1,20 +0,0 @@
COLOR_FOREGROUND='#A3A6AB'
COLOR_BACKGROUND='#34322E'
COLOR_FOCUSED_OCCUPIED_FG='#F6F9FF'
COLOR_FOCUSED_OCCUPIED_BG='#5C5955'
COLOR_FOCUSED_FREE_FG='#F6F9FF'
COLOR_FOCUSED_FREE_BG='#6D561C'
COLOR_FOCUSED_URGENT_FG='#34322E'
COLOR_FOCUSED_URGENT_BG='#F9A299'
COLOR_OCCUPIED_FG='#A3A6AB'
COLOR_OCCUPIED_BG='#34322E'
COLOR_FREE_FG='#6F7277'
COLOR_FREE_BG='#34322E'
COLOR_URGENT_FG='#F9A299'
COLOR_URGENT_BG='#34322E'
COLOR_LAYOUT_FG='#A3A6AB'
COLOR_LAYOUT_BG='#34322E'
COLOR_TITLE_FG='#A3A6AB'
COLOR_TITLE_BG='#34322E'
COLOR_STATUS_FG='#A3A6AB'
COLOR_STATUS_BG='#34322E'

View file

@ -1,112 +0,0 @@
#! /bin/sh
#
# Example panel for dzen2
font_family='sans-serif'
font_size=11
. panel_colors-dzen2
screen_width=$(sres -W)
NORMIFS=$IFS
FIELDIFS=':'
PADDING=' '
while getopts 'f:s:' opt ; do
case "$opt" in
f)
font_family=$OPTARG
;;
s)
font_size=$OPTARG
;;
esac
done
shift $((OPTIND - 1))
while read -r line ; do
case $line in
S*)
# clock output
sys_infos="^fg($COLOR_STATUS_FG)^bg($COLOR_STATUS_BG)${PADDING}${line#?}${PADDING}^fg()^bg()${PADDING}"
;;
T*)
# xtitle output
title="^fg($COLOR_TITLE_FG)^bg($COLOR_TITLE_BG)${PADDING}${line#?}${PADDING}^fg()^bg()"
;;
W*)
# bspwm internal state
wm_infos="$PADDING"
IFS=$FIELDIFS
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
case $item in
[OoFfUu]*)
# desktops
name=${item#?}
case $item in
O*)
# focused occupied desktop
FG=$COLOR_FOCUSED_OCCUPIED_FG
BG=$COLOR_FOCUSED_OCCUPIED_BG
;;
F*)
# focused free desktop
FG=$COLOR_FOCUSED_FREE_FG
BG=$COLOR_FOCUSED_FREE_BG
;;
U*)
# focused urgent desktop
FG=$COLOR_FOCUSED_URGENT_FG
BG=$COLOR_FOCUSED_URGENT_BG
;;
o*)
# occupied desktop
FG=$COLOR_OCCUPIED_FG
BG=$COLOR_OCCUPIED_BG
;;
f*)
# free desktop
FG=$COLOR_FREE_FG
BG=$COLOR_FREE_BG
;;
u*)
# urgent desktop
FG=$COLOR_URGENT_FG
BG=$COLOR_URGENT_BG
;;
esac
wm_infos="${wm_infos}^fg(${FG})^bg(${BG})^ca(1, bspc desktop -f ${name})^ca(2, bspc window -d ${name})${PADDING}${name}${PADDING}^ca()^ca()"
;;
L*)
# layout
wm_infos="${wm_infos}^fg()^bg()${PADDING}${PADDING}^fg($COLOR_LAYOUT_FG)^bg($COLOR_LAYOUT_BG)^ca(1, bspc desktop -l next)${PADDING}${item#?}${PADDING}^ca()"
;;
esac
shift
done
IFS=$NORMIFS
;;
esac
set -- $(printf '%s\0%s\0%s' "$wm_infos" "$title" "$sys_infos" | sed 's/\^[a-z]\+([^)]*)//g' | xargs -0 txtw -f "$font_family" -s "$font_size")
left_width=$1
center_width=$2
right_width=$3
left_indent=0
right_indent=$((screen_width - right_width))
available_center=$((screen_width - (left_width + right_width)))
if [ $available_center -lt $center_width ] ; then
center_indent=$left_width
else
max_left_right_width=$left_width
[ $left_width -lt $right_width ] && max_left_right_width=$right_width
if [ $((2 * max_left_right_width + center_width)) -gt $screen_width ] ; then
center_indent=$((left_width + (available_center - center_width) / 2))
else
center_indent=$(((screen_width - center_width) / 2))
fi
fi
printf "%s\n" "^pa($center_indent)$title^pa($left_indent)$wm_infos^pa($right_indent)$sys_infos"
done

View file

@ -1,2 +1,4 @@
export PANEL_FIFO=/tmp/panel-fifo
export PANEL_HEIGHT=24
PANEL_FIFO=/tmp/panel-fifo
PANEL_HEIGHT=24
PANEL_FONT_FAMILY="-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1"
export PANEL_FIFO PANEL_HEIGHT PANEL_FONT_FAMILY