#!/usr/bin/env bash font="-*-ohsnap-medium-r-*-*-14-*-*-*-*-*-*-*" backg="#161616" foreg="#404040" active="#747474" urgent="#a04363" icon_path="$HOME/configs/monsterwm/icons" icon_color="#454545" # set desktop wallpaper feh --bg-scale $HOME/Dropbox/Wallpaper/mwm-1280.png & # create a fifo to send output : "${wm:=monsterwm}" : "${ff:="/tmp/${wm}.fifo"}" # status bar while sleep 1; do $HOME/configs/monsterwm/scripts/monster-status done | dzen2 -h 18 -w 1920 -x 260 -ta r -fn "$font" -bg "$backg" -fg "$foreg" -p & [[ -p $ff ]] || mkfifo -m 600 "$ff" while read -r; do [[ $REPLY =~ ^(([[:digit:]]+:)+[[:digit:]]+ ?)+$ ]] && read -ra desktops <<< "$REPLY" || continue for desktop in "${desktops[@]}"; do IFS=':' read -r d w m c u <<< "$desktop" # name each desktop case $d in #0) d="term" s="" ;; #1) d="web" s="" ;; #2) d="file" s="" ;; #3) d="foo" s="" ;; # use icons for desktops 0) d="^i($icon_path/dice1.xbm)" s="" ;; 1) d="^i($icon_path/dice2.xbm)" s="" ;; 2) d="^i($icon_path/dice3.xbm)" s="" ;; 3) d="^i($icon_path/dice4.xbm)" s="" ;; esac # the active/current desktop color should be $active # also display the active/current desktop's tiling layout/mode ((c)) && f="$active" && case $m in 0) i=" ^fg($icon_color)^i($icon_path/tile.xbm)^fg()" ;; 1) i=" ^fg($icon_color)^i($icon_path/monocle.xbm)^fg()" ;; 2) i=" ^fg($icon_color)^i($icon_path/bstack.xbm)^fg()" ;; 3) i=" ^fg($icon_color)^i($icon_path/grid.xbm)^fg()" ;; 4) i=" ^fg($icon_color)^i($icon_path/float.xbm)^fg()" ;; esac || f="$foreg" # if the desktop has an urgent hint its color should be $urgent (red) ((u)) && f="$urgent" # if the desktop has windows print that number next to the desktop name # else just print the desktop name ((w)) && r+="$s ^fg($f)$d°^fg()" || r+="$s ^fg($f)$d ^fg()" done # read from fifo and output to dzen2 printf "%s%s\n" "$r" "$i" && unset r done < "$ff" | dzen2 -h 18 -w 260 -ta l -fn "$font" -bg "$backg" -fg "$foreg" -p & # pass output to fifo while :; do "$wm" || break; done | tee -a "$ff"