summaryrefslogtreecommitdiff
path: root/scripts/x-window-select
blob: 41d8c151edaf538713c9a7058775e4dbfcec27f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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