Browse Source

add window switcher

encrypt 8 years ago
parent
commit
bf6f30a539
1 changed files with 19 additions and 0 deletions
  1. 19 0
      window-switch/window-switcher.sh

+ 19 - 0
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