forked from encrypt/random
add window switcher
This commit is contained in:
parent
458578b4ad
commit
bf6f30a539
1 changed files with 19 additions and 0 deletions
19
window-switch/window-switcher.sh
Normal file
19
window-switch/window-switcher.sh
Normal file
|
@ -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
|
Loading…
Reference in a new issue