summaryrefslogtreecommitdiff
path: root/scripts/x-window-select
diff options
context:
space:
mode:
authorPatrick <devnull@mailinator.com>2017-07-08 10:20:40 +0800
committerPatrick <devnull@mailinator.com>2017-07-08 10:20:40 +0800
commit47120bb34192786a461270de437b9704d725f492 (patch)
treeabb68aeaa16acf595a89300485ee0189a2ae10d8 /scripts/x-window-select
parent3ed6cf128fd478ce087faa7d07dfd5726ef1815e (diff)
add MRU and select-window for alt-tab
Diffstat (limited to 'scripts/x-window-select')
-rwxr-xr-xscripts/x-window-select17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/x-window-select b/scripts/x-window-select
new file mode 100755
index 0000000..41d8c15
--- /dev/null
+++ b/scripts/x-window-select
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+wids() { x-window-list | sed 1d | awk '$2 == "M" { print $0 }'; }
+cnt=$( wids | wc -l )
+case "$cnt" in
+ 0)
+ echo "no windows?!?, exiting..." | dmenu
+ exit 0;;
+ 1)
+ w_id=$( wids | awk '{ print $1 }' );;
+ *)
+ [[ "$cnt" -gt 5 ]] && cnt=5
+ w_id=$( wids | dmenu -l $cnt | awk '{print $1}' );;
+esac
+
+xdotool windowraise $w_id
+xdotool windowfocus $w_id