annotate bin/xmoveall.sh @ 922:74dc16f074be default tip

ignore ff merges
author Jeff Hammel <k0scist@gmail.com>
date Thu, 03 Oct 2024 05:36:19 -0700
parents 655a40db0977
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
306
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/bin/bash
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 # move all windows to a desktop
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 # by default, the final one (graveyard)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 # List all desktops managed by the window manager. One line is
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 # output for each desktop, with the line broken up into space sep‐
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 # arated columns. The first column contains an integer desktop
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 # number. The second column contains a '*' character for the cur‐
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 # rent desktop, otherwise it contains a '-' character. The next
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 # two columns contain the fixed string DG: and then the desktop
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 # geometry as '<width>x<height>' (e.g. '1280x1024'). The following
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 # two columns contain the fixed string VP: and then the viewport
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 # position in the format '<y>,<y>' (e.g. '0,0'). The next three
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 # columns after this contains the fixed string WA: and then two
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 # columns with the workarea geometry as 'X,Y and WxH' (e.g. '0,0
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 # 1280x998'). The rest of the line contains the name of the desktop
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 # (possibly containing multiple spaces).
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 DESKTOP=$(wmctrl -d | awk '{if ($2 == "*") {print $1}}')
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 # find the last desktop
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 if (( $# ))
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 then
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 LAST=$1
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 else
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 LAST=$(wmctrl -d | tail -n 1 | awk '{print $1}')
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 fi
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 # -l List the windows being managed by the window manager.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 wmctrl -l | awk '{if ($2 == "'${DESKTOP}'") {print $1}}' | while read line
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31 do
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
32 # -t <DESK>
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
33 # Move a window that has been specified with the -r action to the
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
34 # desktop <DESK>.
307
655a40db0977 ah, the magic switch
Jeff Hammel <jhammel@mozilla.com>
parents: 306
diff changeset
35 wmctrl -i -r ${line} -t ${LAST}
306
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
36 done
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
37