#!/bin/bash # WTFPL # Require wmutils and wmctrl (hope to remove wmctrl soon) windows="" count=0 for win in $(lsw) do name=$(xprop -id $win | grep "^WM_NAME" | cut -d '=' -f 2- | grep -oP "(?<=\").*(?=\")") windows=$windows"\n$win\t($count) $name" (( count++ )) done # doing this shitty space trim because dmenu seems to cut double spaces -_- window=$(echo -e $windows | sed '/^$/d' | cut -f 2- | dmenu -l 10 | tr -d " ") wid=$(echo -e $windows | tr -d " " | grep "$window" | cut -f 1) wmctrl -ia $wid