#!/usr/bin/env bash wm="monsterwm" ff="/tmp/monsterwm.fifo" tags=('code' 'www' 'read' 'media' 'video' 'mail') layouts=('[]=' '[ ]' 'T=' '[#]') conky -c $HOME/.conkyrc | dzen2 -bg '#111111' -h 18 -x 320 -ta r -e -p -fn "-*-droid sans mono-medium-*-*-*-11-*-*-*-*-*-*-*" & # Check if it's a pipe, otherwise create it [[ -p $ff ]] || mkfifo -m 600 "$ff" while read -t 60 -r wmout || true; do desktops=( $(cut -d"|" -f1 <<< "$wmout") ) title="$(cut -d"|" -f2- <<< "$wmout")" if [[ "${desktops[@]}" =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]]; then unset tmp for desktop in "${desktops[@]}"; do IFS=':' read -r d w m c u <<< "$desktop" # Tags labels label="${tags[$d]}" # Is this the current desktop ? save the layout ((c)) && fg="#f0f13c" bg="#425916" && layout="${layouts[$m]}" || fg="#aaaaaa" bg="#111111" # Has windows ? ((w)) && fg="#ffffff" # Urgent windows ? ((u)) && fg="#ef2929" tmp+="^fg($fg)^bg($bg) $label ^bg()^fg()" done fi # Merge the clients indications, the tile and the info echo "$tmp $layout $title" done < "$ff" | dzen2 -bg '#111111' -w 320 -h 18 -ta l -e -p -fn "-*-droid sans mono-medium-*-*-*-11-*-*-*-*-*-*-*" & while :; do "$wm" || break; done | tee -a "$ff"