summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-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