1
0
Fork 0
forked from encrypt/random
random/window-switch/window-switcher.sh
2016-03-14 17:44:32 +01:00

19 lines
518 B
Bash
Executable file

#!/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