switch - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       switch (625B)
       ---
            1 windows=$(wmctrl -xl | tr -s '[:blank:]' | cut -d ' ' -f 3-3,5- | sed 's/^[a-zA-Z0-9-]*\.//' | sort | uniq)
            2 
            3 # Add spaces to align the WM_NAMEs of the windows
            4 max=$(echo "$windows" | awk '{cur=length($1); max=(cur>max?cur:max)} END{print max}')
            5 
            6 windows=$(echo "$windows" | \
            7               awk -v max="$max" \
            8                   '{cur=length($1); printf $1; \
            9                     for(i=0; i < max - cur + 1; i++) printf " "; \
           10                     $1 = ""; printf "%s\n", $0}')
           11 
           12 
           13 target=$(echo "$windows" | dmenu -l 10 -i -p switch: | tr -s '[:blank:]' | cut -d ' ' -f 2-)
           14 
           15 if [[ -n $target ]]; then
           16     wmctrl -a "$target"
           17 fi