To have the executables available in Ubuntu or Debian:
apt-get install suckless-tools
Keyboard shortcut command to choose from all windows:
/bin/sh -c 'wmctrl -l | while read i j k l; do echo $i $l; done | dmenu -i -l 16 | awk "{print \$1}" | while read i; do wmctrl -iR $i; done'
Keyboard shortcut command to choose from windows of the same process as currently active window:
/bin/sh -c 'wmctrl -lp | awk "(\$3 == "$(xprop -id $(xprop -root -f _NET_ACTIVE_WINDOW 0x " \$0\\n" _NET_ACTIVE_WINDOW | awk "{print \$2}") -f _NET_WM_PID 0c " \$0\\n" _NET_WM_PID | awk "{print \$2}")" && \$4 == \""$(hostname)"\") {print}" | while read i j k l m; do echo $i $m; done | dmenu -i -l 16 | awk "{print \$1}" | while read i; do wmctrl -iR $i; done'