diff --git a/window-switch/window-switcher.sh b/window-switch/window-switcher.sh new file mode 100644 index 0000000..4eeeb9f --- /dev/null +++ b/window-switch/window-switcher.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# 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