blob: 469addab0ba2d36f1d2af44b5a1555ceba5d5a36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/bin/bash
programs_to_stop='(surf|acroread|firefox)'
pid() {
action=$1
wid=$2
pid=$( xdotool getwindowpid $wid )
ps h -p $pid | grep -qsE "$programs_to_stop" || return 0
case $action in
stop) kill -STOP $pid;;
cont) kill -CONT $pid;;
esac
}
[[ "$1" = "push" ]] && {
w_id=$( xdotool search --maxdepth 1 --onlyvisible . 2>/dev/null | tail -1 )
xdotool windowunmap $w_id
pid "stop" $w_id
#echo "banished $(xdotool getwindowname $w_id)" | dmenu #~/bin/dmenu.sh
exit 0
}
wids=$( x-window-list all | awk '$2 == "U" { print $1 }' )
cnt=$( echo "$wids" | wc -w )
case "$cnt" in
0)
echo "nothing banished?!?, exiting..."
exit 0;;
1)
w_id="$wids"
break;;
*)
[[ "$cnt" -gt 5 ]] && cnt=5
w_id=$(echo $wids | dmenu -l $cnt );;
esac
pid "cont" $w_id
xdotool windowmap $w_id windowraise
xdotool windowraise $w_id
|