guest@dotshare [~/groups/wms/monster] $ ls monsterwm/ | cat

monsterwm (scrot)

zharper Jul 21, 2013 (wms/monster)

monster-start(raw, dl)

SCROT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/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"

CLICK TO VIEW

x

monster-status(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash

icon_path="$HOME/configs/monsterwm/icons"
icon_color="#454545"
color_red="#a04363"
color_yel="#bf7a29"
color_mag="#856774"
color_wht="#bcbcaf"

cpu() {
  read cpu a b c previdle rest < /proc/stat
  prevtotal=$((a+b+c+previdle))
  sleep 0.5
  read cpu a b c idle rest < /proc/stat
  total=$((a+b+c+idle))
  cpu="$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))"
    echo -e "^fg($icon_color)^i($icon_path/cpu.xbm)^fg() ^fg($color_red)$cpu%^fg()"
}

mem() {
  mem="$(awk '/^-/ {print $3}' <(free -m))"
    echo -e "^fg($icon_color)^i($icon_path/mem.xbm)^fg() ^fg($color_yel)$mem^fg()"
}

dsk() {
  dsk="$(df -P | sort -d | awk '/^\/dev/{s=s (s?" ":"") $5} END {printf "%s", s}')"
    echo -e "^fg($icon_color)^i($icon_path/disk.xbm)^fg() ^fg($color_mag)$dsk^fg()"
}

tme() {
  tme="$(date "+%H:%M")"
    echo -e "^fg($icon_color)^i($icon_path/clock.xbm)^fg() ^fg($color_wht)$tme^fg() "
}

# print to dzen2
echo "$(cpu) $(mem) $(dsk) $(tme)"
 

x

Notes

Simple setup using bash scripts and dzen, based on c00kiemon5ter’s examples on github and jasonwryan’s configs. Icons are from stlarch_icons.