#!/bin/zsh # xmobar_with_ws_numbers - takes output from xmonad intended for # xmobar. Changes the workspaces portion, adding workspace numbers. # Then, pipes the output to xmobar. # # Assumes there are only alphanumeric characters [a-zA-Z0-9] in # workspace names, and it will likely choke on anything that's not # ASCII. Thus you can't have spaces or symbols in workspace names. # Given a workspace number on $1 and the entire workspace text on # $2, echoes the workspace text with a workspace number added. # Takes into account the format of xmobar input, which has xml-like # tags to indicate colors. addNumber() { if echo $2 | grep -q '<'; then echo -n $2 | sed -r 's/>([a-zA-Z0-9]*)'$1':\1