dsyleixa123
Posts: 91
Joined: Mon Jun 11, 2018 11:22 am

Stretch: wmctrl terminal window at wrong place

Tue Jul 10, 2018 2:57 pm

hello,
I want to open a wmctrl terminal window at pos 0,520 by
system("wmctrl -r LXTerminal -e 0, 520,0, 320,320"); // LXTerminal wmctrl screen (Gravity, x,y, w,h)

The window opens, but always at 0,0 and not at 520,0.... what am I missing?

DirkS
Posts: 8526
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Stretch: wmctrl terminal window at wrong place

Tue Jul 10, 2018 3:41 pm

dsyleixa123 wrote:
Tue Jul 10, 2018 2:57 pm
system("wmctrl -r LXTerminal -e 0, 520,0, 320,320"); // LXTerminal wmctrl screen (Gravity, x,y, w,h)
Using wmctrl from the command line with your params I get an error message.
wmctrl doesn't like the spaces in the -e parameter:

Code: Select all

wmctrl -r :ACTIVE: -e 0, 520,0, 320,320
The -e option expects a list of comma separated integers: "gravity,X,Y,width,height"
If I remove the spaces the window moves to the correct location

BTW: I don't think you can use wmctrl to open a new window, which is what you seem to do.
The -r parameter needs to specify an existing window name (the value I used manipulates the active window).
Your command opens a terminal window because of the 'system' call and the default position is probably top left.

dsyleixa123
Posts: 91
Joined: Mon Jun 11, 2018 11:22 am

Re: Stretch: wmctrl terminal window at wrong place

Tue Jul 10, 2018 4:11 pm

hello,
thanks for your reply.
About the spaces you are correct, I deleted them. Nevertheless I always get a new terminal window (just as before on Jessie) but now still always at the wrong place.
On Jessie it always worked fine, but on Stretch no longer.
I use a 1920x1080 screen.
I even checked an old backup version of my program which ran on Jessie correctly, but it had the same wmctrl params (no spaces though), and so the same effect now:
either it appears at 0,0 at the upper left TFT corner or randomly at the lower left TFT corner (probably 0,560), but never aligned to the upper border quite in the middle (520,0) as it should and formerly actually did.
So what is wrong with my command line or with g++ or wmctrl?
Last edited by dsyleixa123 on Tue Jul 10, 2018 4:16 pm, edited 1 time in total.

DirkS
Posts: 8526
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Stretch: wmctrl terminal window at wrong place

Tue Jul 10, 2018 4:15 pm

dsyleixa123 wrote:
Tue Jul 10, 2018 4:11 pm
Nevertheless I always get a new terminal window (just as before on Jessie) but now still always at the wrong place.
On Jessie it always worked fine, but on Stretch no longer.
So do you open an LXTerminal window *before* the system call or do you open it implicitly?

If it's the latter then try this:

Code: Select all

system("wmctrl -r :ACTIVE: -e 0,520,0,320,320");   // LXTerminal wmctrl screen (Gravity, x,y, w,h) 

dsyleixa123
Posts: 91
Joined: Mon Jun 11, 2018 11:22 am

Re: Stretch: wmctrl terminal window at wrong place

Tue Jul 10, 2018 4:17 pm

there are sometimes other terminal open, sometimes not, but always the same result:
a new window with the correct size opens, but at the wrong place.

dsyleixa123
Posts: 91
Joined: Mon Jun 11, 2018 11:22 am

Re: Stretch: wmctrl terminal window at wrong place

Tue Jul 10, 2018 4:22 pm

Update!
aahhh...
I was missing your last correction because I didn't realize the differences:
system("wmctrl -r :ACTIVE: -e 0,520,0,320,320");

YES!
Now it works again, thank you very much!

DirkS
Posts: 8526
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Stretch: wmctrl terminal window at wrong place

Tue Jul 10, 2018 4:26 pm

My pleasure!

dsyleixa123
Posts: 91
Joined: Mon Jun 11, 2018 11:22 am

Re: Stretch: wmctrl terminal window at wrong place

Sat Jul 21, 2018 8:21 pm

now I encounterd an issue nonetheless: By
system("wmctrl -r :ACTIVE: -e 0,520,0,320,320");
it works, as long there is not already another terminal window open (as far as I observed)

BUT:
If there is already another terminal window opened, then the command resizes another XWindow (e.g., from Geany) and the new opened wmctrl window again appears at the wrong place and by a wrong size.
How can I fix that for either already opened windows?
Just the new one by my program has to be appear accordingly, nothing existing must be changed!

Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 9 guests