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