PANEL: Tronify and minify

Tronify some of the colors of the panel and minimize it. The panel is
now 1px high and shows only tags and if any of my mailboxes have mail
in them.
This commit is contained in:
Tom Willemsen 2012-01-06 11:09:03 +01:00
parent 60f95d2e60
commit f4d2df3865

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
monitor=${1:-0} monitor=${1:-0}
monitor2=1
geometry=( $(herbstclient monitor_rect "$monitor") ) geometry=( $(herbstclient monitor_rect "$monitor") )
if [ -z "$geometry" ] ;then if [ -z "$geometry" ] ;then
echo "Invalid monitor $monitor" echo "Invalid monitor $monitor"
@ -10,70 +11,75 @@ fi
x=${geometry[0]} x=${geometry[0]}
y=${geometry[1]} y=${geometry[1]}
width=${geometry[2]} width=${geometry[2]}
height=16 height=1
tag_width=40
font="-misc-tamsyn-medium-r-normal-*-14-*-*-*-*-*-iso8859-*" font="-misc-tamsyn-medium-r-normal-*-14-*-*-*-*-*-iso8859-*"
fgcolor='#eeeeec'
bgcolor='#252a2b' selcolor='#24c6e0'
hintcolor="#0c191c" locolor='#15abc3'
bgcolor='#000000'
hicolor="#808080"
urcolor="#e0c625"
function uniq_linebuffered() { function uniq_linebuffered() {
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
} }
herbstclient pad $monitor $height herbstclient pad $monitor $(expr $height - 4) -5 -5 -5
herbstclient pad $monitor2 -5 -5 -5 -5
{ {
# events:
#mpc idleloop player &
while true ; do
date +'date ^fg($fgcolor)%H:%M^fg(#909090), %Y-%m-^fg($fgcolor)%d'
sleep 1 || break
done > >(uniq_linebuffered) &
childpid=$! childpid=$!
herbstclient --idle herbstclient --idle
kill $childpid kill $childpid
} 2> /dev/null | { } 2> /dev/null | {
TAGS=( $(herbstclient tag_status $monitor) ) TAGS=( $(herbstclient tag_status $monitor) )
date="" TAGS2=( $(herbstclient tag_status $monitor2) )
while true ; do while true ; do
bordercolor="#26221C" separator="^fg($bgcolor)^ro(1x$height)^fg()"
separator="^fg(#141414)^ro(1x$height)^fg()"
# draw tags # draw tags
echo -n "$separator" echo -n "$separator"
for i in "${TAGS[@]}" ; do for i in "${TAGS[@]}" ; do
if [[ "${TAGS2[@]}" == *"#${i:1}"* ]]; then
echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()"
elif [[ "${TAGS2[@]}" == *"+${i:1}"* ]]; then
echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()"
else
case ${i:0:1} in case ${i:0:1} in
'#') '#')
echo -n "^bg(#0c191c)^fg(#eeeeec)" echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()"
;; ;;
'+') '+')
echo -n "^bg(#2e3436)^fg(#555753)" echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()"
;; ;;
':') ':')
echo -n "^bg(#2e3436)^fg($fgcolor)" echo -n "^fg($hicolor)^ro(${tag_width}x$height)^fg()"
;; ;;
'!') '!')
echo -n "^bg(#a40000)^fg(#edd400)" echo -n "^fg($urcolor)^ro(${tag_width}x$height)^fg()"
;; ;;
*) *)
echo -n "^bg()^fg()" echo -n "^bg()^fg($bgcolor)^ro(${tag_width}x$height)^fg()"
;; ;;
esac esac
echo -n " ${i:1} " fi
echo -n "$separator" echo -n "$separator"
done done
echo -n "^bg()^p(_CENTER)"
# small adjustments mailboxes=(ninthfloor gmail arch aethon ryuslash.org)
nfmail=`ls ~/documents/mail/ninthfloor/INBOX/new/ | wc -l` echo -n "^p(_RIGHT)^p(-$(expr $tag_width \* ${#mailboxes[@]} + 5))"
gmail=`ls ~/documents/mail/gmail/INBOX/new/ | wc -l` for j in "${mailboxes[@]}"; do
archmail=`ls ~/documents/mail/arch/INBOX/new/ | wc -l` mailfile="$HOME/documents/mail/$j/INBOX/new/"
aethonmail=`ls ~/documents/mail/aethon/INBOX/new/ | wc -l` mailcnt=$(ls $mailfile | wc -l)
todoline=`cat ~/.config/herbstluftwm/todo`
todoline_sha1=`echo $todoline | sha1sum` if [ $mailcnt -gt 0 ]; then
todoline_color=${todoline_sha1:0:6} mailsha1=$(echo $j | sha1sum)
right="^fg(#$todoline_color)$todoline^fg() $separator 9f: $nfmail $separator gmail: $gmail $separator arch: $archmail $separator aethon: $aethonmail $separator^bg($hintcolor) $date $separator" mailcolor="#${mailsha1:0:6}"
right_text_only=$(echo -n "$right"|sed 's.\^[^(]*([^)]*)..g') else
# get width of right aligned text.. and add some space.. mailcolor=$bgcolor
width=$(textwidth "$font" "$right_text_only ") fi
echo -n "^p(_RIGHT)^p(-$width)$right"
echo -n "^fg($mailcolor)^ro(${tag_width}x$height)^fg()$separator"
done
echo echo
# wait for next event # wait for next event
read line || break read line || break
@ -83,17 +89,12 @@ herbstclient pad $monitor $height
tag*) tag*)
#echo "reseting tags" >&2 #echo "reseting tags" >&2
TAGS=( $(herbstclient tag_status $monitor) ) TAGS=( $(herbstclient tag_status $monitor) )
;; TAGS2=( $(herbstclient tag_status $monitor2) )
date)
#echo "reseting date" >&2
date="${cmd[@]:1}"
;; ;;
quit_panel) quit_panel)
exit exit
;; ;;
#player)
# ;;
esac esac
done done
} 2> /dev/null | dzen2 -w $width -x $x -y $y -fn "$font" -h $height \ } 2> /dev/null | dzen2 -w $width -x $x -y $y -fn "$font" -h $height \
-ta l -bg "$bgcolor" -fg "$fgcolor" -ta l -bg "$bgcolor"