# HG changeset patch # User Jeff Hammel # Date 1368654365 25200 # Node ID 1166c65328f738b353b7c5a9835afaec51d00f26 # Parent fac01a1bcedfdcea4fa2962c0243c78ab9d58b00 stub diff -r fac01a1bcedf -r 1166c65328f7 bin/xmoveall.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/xmoveall.sh Wed May 15 14:46:05 2013 -0700 @@ -0,0 +1,37 @@ +#!/bin/bash + +# move all windows to a desktop +# by default, the final one (graveyard) + +# List all desktops managed by the window manager. One line is +# output for each desktop, with the line broken up into space sep‐ +# arated columns. The first column contains an integer desktop +# number. The second column contains a '*' character for the cur‐ +# rent desktop, otherwise it contains a '-' character. The next +# two columns contain the fixed string DG: and then the desktop +# geometry as 'x' (e.g. '1280x1024'). The following +# two columns contain the fixed string VP: and then the viewport +# position in the format ',' (e.g. '0,0'). The next three +# columns after this contains the fixed string WA: and then two +# columns with the workarea geometry as 'X,Y and WxH' (e.g. '0,0 +# 1280x998'). The rest of the line contains the name of the desktop +# (possibly containing multiple spaces). +DESKTOP=$(wmctrl -d | awk '{if ($2 == "*") {print $1}}') + +# find the last desktop +if (( $# )) +then +LAST=$1 +else +LAST=$(wmctrl -d | tail -n 1 | awk '{print $1}') +fi + +# -l List the windows being managed by the window manager. +wmctrl -l | awk '{if ($2 == "'${DESKTOP}'") {print $1}}' | while read line +do +# -t +# Move a window that has been specified with the -r action to the +# desktop . +echo "wmctrl -r ${line} -t ${LAST}" +done +