blob: 38f2eab0bfa9b70b8d934ad9977e011e7522f7e9 (
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
|
#!/bin/bash
programs_to_stop='(surf|acroread|firefox)'
pid() {
action=$1; shift
wid=$1; shift
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 getwindowfocus )
xdotool windowunmap $w_id
pid "stop" $w_id
xdotool windowfocus $( x-window-list | awk '{print $1; exit }' )
exit 0
}
wids() { x-window-list all | awk '$2 == "U" { print $0 }'; }
cnt=$( wids | wc -l )
case "$cnt" in
0)
echo "nothing banished?!?, 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
pid "cont" $w_id
xdotool windowmap $w_id
xdotool windowraise $w_id
xdotool windowfocus $w_id
|