PANEL: Change it all again
This commit is contained in:
parent
9f48c01515
commit
f2604da835
1 changed files with 94 additions and 44 deletions
|
@ -10,7 +10,7 @@ fi
|
||||||
# geometry has the format: WxH+X+Y
|
# geometry has the format: WxH+X+Y
|
||||||
x=${geometry[0]}
|
x=${geometry[0]}
|
||||||
width=${geometry[2]}
|
width=${geometry[2]}
|
||||||
height=1
|
height=12
|
||||||
y=$(expr ${geometry[3]} - $height)
|
y=$(expr ${geometry[3]} - $height)
|
||||||
tag_width=40
|
tag_width=40
|
||||||
font="-misc-tamsyn-medium-r-normal-*-14-*-*-*-*-*-iso8859-*"
|
font="-misc-tamsyn-medium-r-normal-*-14-*-*-*-*-*-iso8859-*"
|
||||||
|
@ -25,48 +25,47 @@ function uniq_linebuffered() {
|
||||||
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
|
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
herbstclient pad $monitor -5 -5 $(expr -5 + $height) -5
|
function print_tags() {
|
||||||
herbstclient pad $monitor2 -5 -5 -5 -5
|
|
||||||
{
|
|
||||||
childpid=$!
|
|
||||||
herbstclient --idle
|
|
||||||
kill $childpid
|
|
||||||
} 2> /dev/null | {
|
|
||||||
TAGS=( $(herbstclient tag_status $monitor) )
|
|
||||||
TAGS2=( $(herbstclient tag_status $monitor2) )
|
|
||||||
while true ; do
|
|
||||||
separator="^fg($bgcolor)^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
|
if [[ "${TAGS2[@]}" == *"#${i:1}"* ]]; then
|
||||||
echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()"
|
echo -n "^bg($selcolor)^fg(#000000) ${i:1} ^fg()^bg()"
|
||||||
|
# echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()"
|
||||||
elif [[ "${TAGS2[@]}" == *"+${i:1}"* ]]; then
|
elif [[ "${TAGS2[@]}" == *"+${i:1}"* ]]; then
|
||||||
echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()"
|
echo -n "^bg($locolor)^fg(#000000) ${i:1} ^fg()^bg()"
|
||||||
|
# echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()"
|
||||||
else
|
else
|
||||||
case ${i:0:1} in
|
case ${i:0:1} in
|
||||||
'#')
|
'#')
|
||||||
echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()"
|
echo -n "^bg($selcolor)^fg(#000000) ${i:1} ^fg()^bg()"
|
||||||
|
# echo -n "^fg($selcolor)^ro(${tag_width}x$height)^fg()"
|
||||||
;;
|
;;
|
||||||
'+')
|
'+')
|
||||||
echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()"
|
echo -n "^bg($locolor)^fg(#000000) ${i:1} ^fg()^bg()"
|
||||||
|
# echo -n "^fg($locolor)^ro(${tag_width}x$height)^fg()"
|
||||||
;;
|
;;
|
||||||
':')
|
':')
|
||||||
echo -n "^fg($hicolor)^ro(${tag_width}x$height)^fg()"
|
echo -n "^bg($hicolor)^fg(#000000) ${i:1} ^fg()^bg()"
|
||||||
|
# echo -n "^fg($hicolor)^ro(${tag_width}x$height)^fg()"
|
||||||
;;
|
;;
|
||||||
'!')
|
'!')
|
||||||
echo -n "^fg($urcolor)^ro(${tag_width}x$height)^fg()"
|
echo -n "^bg($urcolor)^fg(#000000) ${i:1} ^fg()^bg()"
|
||||||
|
# echo -n "^fg($urcolor)^ro(${tag_width}x$height)^fg()"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -n "^bg()^fg($bgcolor)^ro(${tag_width}x$height)^fg()"
|
echo -n "^bg($bgcolor)^fg(#ffffff) ${i:1} ^fg()^bg()"
|
||||||
|
# echo -n "^bg()^fg($bgcolor)^ro(${tag_width}x$height)^fg()"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
echo -n "$separator"
|
echo -n "$separator"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_mailboxes() {
|
||||||
mailboxes=(ninthfloor gmail arch aethon ryuslash.org)
|
mailboxes=(ninthfloor gmail arch aethon ryuslash.org)
|
||||||
echo -n "^p(_RIGHT)^p(-$(expr $tag_width \* ${#mailboxes[@]} + 5))"
|
mailtxt=""
|
||||||
for j in "${mailboxes[@]}"; do
|
for j in "${mailboxes[@]}"; do
|
||||||
mailfile="$HOME/documents/mail/$j/INBOX/new/"
|
mailfile="$HOME/documents/mail/$j/INBOX/new/"
|
||||||
mailcnt=$(ls $mailfile | wc -l)
|
mailcnt=$(ls $mailfile | wc -l)
|
||||||
|
@ -78,8 +77,59 @@ herbstclient pad $monitor2 -5 -5 -5 -5
|
||||||
mailcolor=$bgcolor
|
mailcolor=$bgcolor
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "^fg($mailcolor)^ro(${tag_width}x$height)^fg()$separator"
|
mailtxt="$mailtxt${separator}^bg($mailcolor)^fg(#ffffff) $j ^fg()^bg()"
|
||||||
|
# echo -n "^fg($mailcolor)^ro(${tag_width}x$height)^fg()$separator"
|
||||||
done
|
done
|
||||||
|
mailtxt_only=$(echo -n "$mailtxt" | sed 's.\^[^(]*([^)]*)..g')
|
||||||
|
let mailtxt_width=$(textwidth "$font" "$mailtxt_only")+20
|
||||||
|
echo -n "^p(_RIGHT)^p(-$mailtxt_width)$mailtxt"
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_services() {
|
||||||
|
services=(emacs httpd mysqld dunst xbindkeys mpdscribble sshd mpd)
|
||||||
|
servicetxt=""
|
||||||
|
for j in "${services[@]}"; do
|
||||||
|
servicetxt="$servicetxt$separator$(status $j)"
|
||||||
|
done
|
||||||
|
servicetxt_only=$(echo -n "$servicetxt" | sed 's.\^[^(]*([^)]*)..g')
|
||||||
|
let servicetxt_width=$(textwidth "$font" "$servicetxt_only")/2
|
||||||
|
|
||||||
|
echo -n "^p(_CENTER)^p(-$servicetxt_width)$servicetxt"
|
||||||
|
}
|
||||||
|
|
||||||
|
function status()
|
||||||
|
{
|
||||||
|
running=$(${1}_running 2>/dev/null || pidof $1)
|
||||||
|
|
||||||
|
if [ -n "$running" ]; then
|
||||||
|
color="darkgreen"
|
||||||
|
else
|
||||||
|
color="darkred"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "^bg($color)^fg(#ffffff) $1 ^fg()^bg()"
|
||||||
|
}
|
||||||
|
|
||||||
|
function emacs_running()
|
||||||
|
{
|
||||||
|
ps ax | awk '{ print $5 " " $6 }' | grep -E "^emacs --daemon"
|
||||||
|
}
|
||||||
|
|
||||||
|
herbstclient pad $monitor -5 -5 $(expr -5 + $height) -5
|
||||||
|
herbstclient pad $monitor2 -5 -5 -5 -5
|
||||||
|
{
|
||||||
|
childpid=$!
|
||||||
|
herbstclient --idle
|
||||||
|
kill $childpid
|
||||||
|
} 2> /dev/null | {
|
||||||
|
TAGS=( $(herbstclient tag_status $monitor) )
|
||||||
|
TAGS2=( $(herbstclient tag_status $monitor2) )
|
||||||
|
while true ; do
|
||||||
|
separator="^fg($bgcolor)^ro(1x$height)^fg()"
|
||||||
|
print_tags
|
||||||
|
print_services
|
||||||
|
print_mailboxes
|
||||||
|
|
||||||
echo
|
echo
|
||||||
# wait for next event
|
# wait for next event
|
||||||
read line || break
|
read line || break
|
||||||
|
|
Loading…
Reference in a new issue