1

I have many figures of widthxheight (550-570)x(465-486) at the southwest logically set there by Matlab's movegui() function. I would like to open all those southwest windows of the size range in an external display or in Workspace 2. Meuh's command shows those figure dimensions width x height, their hex codes and titles where I would like to move windows of size 560 x 475 for width x height, respectively, to Workspace 2

masi@masi:~$ wmctrl -l -G
0x01c0000b  0 0    0    3840 1080 masi Desktop
0x01e00002  0 0    54   1920 1023 masi Edit - Unix & Linux Stack Exchange - Google Chrome
0x02200006  0 2088 333  1608 501  masi masi@masi: ~
0x0280003d  0 1920 78   1920 1041 masi MATLAB R2016a - academic use
0x02800ac6  0 11   113  568  465  masi Figure 1: data gray all 4
0x02800af2  0 687  113  560  475  masi Figure 2: data gray top half (1/2)
0x02800aff  0 1364 113  560  475  masi Figure 3: data gray top #1 (1/4)
0x02800b16  0 1364 621  560  475  masi Figure 4: Time domain
0x02800b2a  0 11   631  568  465  masi Figure 5: Memory/... Monitoring
0x02800b31  0 683  631  568  465  masi Figure 6: data Size(I) monitoring 
0x02800b3b  0 11   621  560  475  masi Figure 7: Histograms
0x02800b85  0 774  594  386  28   masi Press SPACEBAR to continue

Doing meuh's command gives the correct number of wmctrl commands but individual commands do not have any effect (beware different hex-codes here than above because different iteration)

masi@masi:~$ wmctrl -l -G |
> awk '$0~/^0x/{ winid=$1; width=$5; height=$6;
>                if(width>=550 && width<=570 && height>=465 && height<=485)
>                   printf "wmctrl -i -r %s -t 2\n",winid
>              }' | sh -x
+ wmctrl -i -r 0x03200120 -t 2
+ wmctrl -i -r 0x03200149 -t 2
+ wmctrl -i -r 0x0320015f -t 2
+ wmctrl -i -r 0x03200173 -t 2
+ wmctrl -i -r 0x03200188 -t 2
+ wmctrl -i -r 0x0320019f -t 2
+ wmctrl -i -r 0x032001b2 -t 2

Why the commond + wmctrl -i -r 0x03200120 -t 2 putting the window to Workspace 2? What is the symbol + there?

  • I do wmctrl -r 1 -t 2 but nothing, TODO specify somehow dimensions here.
  • How can you move windows of size 560x475 to Workspace 2?
  • How can move windows of size (550-570)x(465-485) to Workspace 2?

OS: Debian 8.5 64 bit
Linux kernel: 4.6 of backports
Matlab: 2016a
Window manager: Gnome 3.14
Hardware: Asus Zenbook UX303UA, Asus PC
Other sources: Commandlinefu search wmctrl does not bring anything relevant

  • 1
    You might be able to do what you want with wmctrl. see my answer – meuh Oct 3 '16 at 7:39
  • 1
    You can specify the window by title rather than id (which is a large hex number like 0x01e00017 and will change when your restart your application). Use wmctrl -l to list the ids and titles and use a title. – meuh Oct 3 '16 at 10:10
  • 1
    You can use wmctrl -l -G to include in the listing the x,y,width,height values for the window. – meuh Oct 3 '16 at 11:12
1

You can use a small awk script to filter out the required window ids using the width and height in space-separated columns 5 and 6:

wmctrl -l -G |
awk '$0~/^0x/{ winid=$1; width=$5; height=$6;
               if(width>=550 && width<=570 && height>=465 && height<=485)
                  printf "wmctrl -i -r %s -t 2\n",winid
             }' | sh
  • 1
    Sorry, I missed out an option. I've updated the answer. You need to add -i so that --r is interpreted as a window id, not a title. – meuh Oct 4 '16 at 6:12
  • 1
    You can replace the final sh by sh -x to see if it is issuing any commands. Did you try by hand e.g. wmctrl -v -i -r 0x02800aff -t 2 to see if it moves that window id to the other desktop? (add -v for verbose output). I don't use gnome so I cannot advise further if gnome 3 no longer works with this command, though googling seems to suggest that it used to. Note: workspace 2 may actually be -t 1 if they are numbered from 0. – meuh Oct 4 '16 at 7:59
  • Yes, it really inputs something wmctrl -i -r 0x032001b2 -t 2. I think the plus symbol just indicates that the command inserts another command. However, the former command does not seem to have any effect in my Debian 8.5 Gnome 3.14 because my Workspace 2 is empty still. - - How can you study the effect of the former command? – Léo Léopold Hertz 준영 Oct 4 '16 at 11:34
  • I don't know what else to try with wmctrl. Perhaps gnome 3 no longer respects the EWMH standard that this program uses. You might look at something completely different, like this extension that moves windows when they are created. – meuh Oct 4 '16 at 14:25
  • 1
    I tested on a very basic window manager, xfce, which you would probably find too minimalist. The man page for wmctrl mentions "EWMH/NetWM compatible window managers include ... Enlightenment, Icewm, Kwin, Sawfish, Xfce". You might see if your system provides the earlier gnome 2 as an alternative, as lots of people complained about gnome 3 when it first came out, so gnome 2 was kept alive for a while. – meuh Oct 4 '16 at 14:50
0

There is no supported working solution for Gnome 3.14 in Debian 8.5. Let's hope the next release of Gnome at Q1-Q2 2017 will help the case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.