summaryrefslogtreecommitdiff
path: root/scripts/x-banish
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/x-banish')
-rwxr-xr-xscripts/x-banish31
1 files changed, 15 insertions, 16 deletions
diff --git a/scripts/x-banish b/scripts/x-banish
index df9f939..469adda 100755
--- a/scripts/x-banish
+++ b/scripts/x-banish
@@ -1,5 +1,4 @@
#!/bin/bash
-dir="${HOME}/.wm-banished"
programs_to_stop='(surf|acroread|firefox)'
pid() {
@@ -13,29 +12,29 @@ pid() {
esac
}
-[[ ! -d $dir ]] && mkdir -p $dir
-
-[[ "$1" = "clean" ]] && {
- for i in $dir/*; do
- [[ -f "$i" ]] && rm "$i"
- done
- exit 0
-}
-
[[ "$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
- touch "${dir}/${w_id}"
exit 0
}
-w_id=$( ls -tr $dir | tail -1)
-[[ "$w_id" = "" ]] && {
- 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
-rm -f "${dir}/${w_id}"