You are not logged in.
Pages: 1


This command centers the text editor Kate (which won't open in the center of the screen, even though all my other programs do):
wmctrl -r "Kate" -e 1,3225,0,1225,1400
When it works it's great, but it only works about 30% of the time. I don't see any pattern in the times it works or doesn't.
Thanks so much for any help or suggestions.
Offline


Hi begtognen,
If you search the forum with the keyword wmctl there are a few discussions about it. Perhaps one of the solutions suits your case?
Offline


Thanks for the idea - I looked before I posted and couldn't find any similar issues here.
Offline


In the settings under Window Manager Tweaks > Placement there is a way to pace a window when opened. At the center of the screen or under the mouse pointer.
May also be that Kate is a QT app rather than GTK so it's messing with things. Do you use the qt5ct or qt6ct settings?
But it's all right, when you're all in pain and you feel the rain come down
It's alright, when you find your way, then you see it disappear
It's alright....
Chris Cornell
Offline


Does this happen from the command line or in a script?
Most of the time when you are using a script it is a timing issue: the program window is not really open on the desktop yet, but Kate has already passed on the command to the windows manager, so it has "finished" .
winctrl queries the windows manager and will not find the window (that will appear shortly after on the screen).
Try putting -v behind wmctrl to see if there is an error message.
If it happening from the command line send the output with -v
Offline


Thanks so much. It happens from the command line. (I have a keyboard shortcut associated with the command as well, but running it from the terminal makes no difference.
Here it is with -v (the file that's open in Kate doesn't seem to matter - sometimes it works, sometimes it doesn't - the same file worked later in the day):
wmctrl -r "Kate" -e 1,3225,0,1225,1400 -v
envir_utf8: 1
Invalid type of WM_NAME property.
Using window: 0x05200006
grflags: 3841Does this happen from the command line or in a script?
Most of the time when you are using a script it is a timing issue: the program window is not really open on the desktop yet, but Kate has already passed on the command to the windows manager, so it has "finished" .
winctrl queries the windows manager and will not find the window (that will appear shortly after on the screen).
Try putting -v behind wmctrl to see if there is an error message.If it happening from the command line send the output with -v
Added later 02 min 55 s:
Thank you for replying. Unfortunately "under the mouse pointer" doesn't open it in the correct place.
In the settings under Window Manager Tweaks > Placement there is a way to pace a window when opened. At the center of the screen or under the mouse pointer.
May also be that Kate is a QT app rather than GTK so it's messing with things. Do you use the qt5ct or qt6ct settings?
Last edited by begtognen (2026-06-12 21:22:43)
Offline


The output is OK.
I don't have time for a few days..but in the meantime let's test this:
- is the window maximized? Can you make sure it is not, move it to a space on the screen and then run the command to put it somewhere else, inside the centre (so that we are sure there are no screen boundaries problems)
-> wmctrl cannot move maximised windows.
also check "wmctrl -lG" that the window you are moving is the correct one, match with the -v output.
"The same file worked later" ->The file content should not matter, the thing that changes is the title for different files, but "Kate" should always be there. wmctrl takes the first window that matches the partial "Kate" research.
The output is complaining that the WM_NAME is "wrong", but with "xprop" and clicking on the window you will find that this is true for Kate, but also irrelevant as wmctrl uses the NET_WM_NAME and has found a window 0x.. that it will apply it's command to and send that request/command to the Windows Manager (WM) .
grflags: 3841 has something to do with gravity flags, should not be relevant I believe (not sure about Kate yet) .That has normally to do with programs that only let you move the windows in certain quadrants of the screen, depending on the previous opened program window. On the internet I have seen references to skype, a video conferencing program and "tile Windows Managers (i3 for example)" , The idea would be something like: in a conference call, when new participants log in, your new windows will open without overlapping present ones or something similar. We are not using a tile WM ("wmctrl -m" should show "xfwm4") nor should Kate try to enforce this kind of behaviour).
Offline


wmctrl -r "Kate" -e 1,3225,0,1225,1400
I don't remember the reason I did it, but for some applications, I had to add the x option, wmctrl -rx .
EndeavourOS
Xfce+gtk3-classic (no CSD)+Picom
Offline


The window is never maximized.
wmctrl -m
Name: Xfwm4
Class: xfwm4
PID: 1584
Window manager's "showing the desktop" mode: N/ARunning it with -v worked (this time) but -rx and -IG didn't. Here's the output:
wmctrl -r "Kate" -e 1,3225,0,1225,1400 -v
envir_utf8: 1
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
Using window: 0x05a00006
grflags: 3841wmctrl -r "Kate" -e 1,3225,0,1225,1400 -v -rx
envir_utf8: 1
Using window: 0x01600003
grflags: 3841wmctrl -r "Kate" -e 1,3225,0,1225,1400 -v -IG
envir_utf8: 1
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
Invalid type of WM_NAME property.
Using window: 0x06600006Last edited by begtognen (2026-06-13 20:04:57)
Offline


Sorry, I wasn't clear: "wmctrl -lG" (l like list (L) - I can't see the difference here, so mentioning it
) is just there to check the list of open windows to the windows id (0x...) of the -v output.
===
From the man page of wmctrl:
-x
Include WM_CLASS in the window list or interpret <WIN> as the WM_CLASS name.
what that means:
I don't remember how x works excactly in the command line, but when you see those n-number of open applications on the applications bar on the top (or bottom) that is them.
The application bar looks at the WM_CLASS name of the windows and stacks them in one place on the bar. So the "5 terminals open" (terminal symbol with a small 5 somewhere) means 5 windows with the WM_CLASS="xfce4-terminal" are open.
===
Let's try the following:
Get me the following output, once when it works and once not: Open a terminal, type "xprop" and click onto the Kate window you wanted to resize and that won't work and the same for a window when it worked.
So the reason why fullscreen windows can't be resized is because in the windows manager the window is not "registered" or doesn't have the property of being resizable.
Please try this with something else that works, like a terminal, first, a dry run, on your machine to make sure it works the same:
1) resize a normal/non full screen terminal with wmctrl,
2) then put the terminal full screen and try again.
3) get the xprop output of both windows.
What should happen is that you will see a difference in this line of the xprop output:
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CLOSE, ... _NET_WM_ACTION_RESIZE,...
The _NET_WM protocol is what wmctrl uses to send it's requests to xfwm..., the full screen window terminal will not have that property.
We want to know if the un-resizable window of Kate has this property or not.
Offline


Thanks for working with me on this, I appreciate your time.
I never horizontally maximize any of my windows. (They're always vertically maximized, I don't know if that matters.)
Weirdly, wmctrl did work for Geany with a normal window and with a horizontally maximized window.
Xprop for normal Geany (both outputs had a lot of ascii icon info that I cut out):
xprop
_NET_WM_ICON_GEOMETRY(CARDINAL) = 3591, 1486, 200, 32
WM_STATE(WM_STATE):
window state: Normal
icon window: 0xa6b03000
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_STICK
_NET_FRAME_EXTENTS(CARDINAL) = 6, 6, 29, 6
_NET_WM_DESKTOP(CARDINAL) = 3
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x560002b
bitmap id # of mask for icon: 0x5600036
window id # of group leader: 0x5600001
_GTK_THEME_VARIANT(UTF8_STRING) =
XdndAware(ATOM) = BITMAP
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 90177577, 90177578
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x5600028
WM_CLIENT_LEADER(WINDOW): window id # 0x5600001
_NET_WM_PID(CARDINAL) = 4034
WM_LOCALE_NAME(STRING) = "en_CA.UTF-8"
WM_CLIENT_MACHINE(STRING) = "Desktop"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
program specified location: 0, 0
program specified minimum size: 455 by 64
program specified base size: 0 by 0
window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "geany", "Geany"
WM_ICON_NAME(STRING) = "untitled - Geany"
_NET_WM_ICON_NAME(UTF8_STRING) = "untitled - Geany"
WM_NAME(STRING) = "untitled - Geany"
_NET_WM_NAME(UTF8_STRING) = "untitled - Geany"And this is xprop for horizontally maximized Geany:
xprop
_NET_WM_ICON_GEOMETRY(CARDINAL) = 3591, 1486, 200, 32
WM_STATE(WM_STATE):
window state: Normal
icon window: 0xa6b03000
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_STICK
_NET_FRAME_EXTENTS(CARDINAL) = 6, 6, 29, 6
_NET_WM_DESKTOP(CARDINAL) = 3
_NET_WM_STATE(ATOM) =
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x560002b
bitmap id # of mask for icon: 0x5600036
window id # of group leader: 0x5600001
_GTK_THEME_VARIANT(UTF8_STRING) =
XdndAware(ATOM) = BITMAP
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 90177577, 90177578
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x5600028
WM_CLIENT_LEADER(WINDOW): window id # 0x5600001
_NET_WM_PID(CARDINAL) = 4034
WM_LOCALE_NAME(STRING) = "en_CA.UTF-8"
WM_CLIENT_MACHINE(STRING) = "Desktop"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
program specified location: 0, 0
program specified minimum size: 455 by 64
program specified base size: 0 by 0
window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "geany", "Geany"
WM_ICON_NAME(STRING) = "*untitled - Geany"
_NET_WM_ICON_NAME(UTF8_STRING) = "*untitled - Geany"
WM_NAME(STRING) = "*untitled - Geany"
_NET_WM_NAME(UTF8_STRING) = "*untitled - Geany"Last edited by begtognen (2026-06-14 10:10:26)
Offline


wmctrl -r "Kate" -e 1,3225,0,1225,1400 -v -rx envir_utf8: 1 Using window: 0x01600003 grflags: 3841
-rx means -r -x, I checked, I don't need it for geany :
wmctrl -r "geany" -e 0,10,40,980,910but I use it for Firefox and Ghostty.
Last edited by gogogadget (2026-06-14 22:33:30)
EndeavourOS
Xfce+gtk3-classic (no CSD)+Picom
Offline


Hi gogogadget,
At this stage I would suggest trying devilspie2 instead of wmctrl. One is not better than the other, wmctrl is "easier" and has less options, so if it works I use it.
However wmctrl does not work, so please try to use devilspie2:
Devilspie2 is a deamon that you can run from the command line of course, but it's strengh is that you can start it up with systemd and it will constantly monitor new windows and window changes.
Here a few links to get you started: (some may be redundant/double):
https://github.com/dsalt/devilspie2/blo … /README.md
https://github.com/thiagoa/dotfiles/blo … config.lua
https://gusnan.se/scite/devilspie2/manual.php/
https://www.nongnu.org/devilspie2/
Advantages of devilspie2 overy wmctrl:
- Although you will see examples for devilspie2 like:
if (get_window_name()=="Adobe Reader"...
in the above example you would need a complete match. You can use the lua string.match() with regular expressions, like:
if (string.match(get_application_name(), "Google Chrome"))
instead. The Lua "string.match() is a simple match function, so string.match(get_window_name(),"Kate"), should work for you and it will return true and the block should be executed, but more complex matches are possible, especially for dynamic window titles.
- It is easy to use either the program name of the program that opens the window (application name) or the windows name:
get_application_name() vs. get_window_name()
You can give a try if that changes anything.
- The "--debug" option when executing devilspie2 let's you print out the values of the variables for the current window:
debug_print("Application: " .. get_application_name())
debug_print("Window: " .. get_window_name());
will execute the get_application_name() and print the output with your comments/text on the screen, so that you know at every stage what the value is that this function returned. (there are tons of "get_"...functions, listed in the documentation.. btw: you will have to write those lines yourself, for every information you are curious about for the current window)
=> Honestly in your case wmctrl should have been successful in getting this information, as shown by the fact that you got back the id in wmctrl -v that matched the wmctrl -l, but in devilspie2 you can print more return information (see get_..list) . It is like wmctrl and xprop in one program and takes away any doubt about the windows values. (using 2 programs I always have the doubt: well xprop saw this, but did wmctrl?)
- Also it has a number of functions setting the size of the window. Try at least 2:
set_window_geometry()
set_window_geometry2()
As the programmer explains: although similar, they use two different libraries to send information to xfwm and can produce different results.
========
Personally I only use devilspie2 to minimize programs that take a long time to start (for example: when I start my browser it takes 30+ seconds to start, so I start it minimized while I continue to do what I want..and will maximize it when I think it is ready, rather than waiting for the browser to slowly start/complete occupying my screen
, a poor use of a great program.
But I think this yt-video has a pretty cool idea:
https://www.youtube.com/watch?v=liYv7iPHUU0
- opeing all browsers on the second workspace..
or
https://www.justingedge.com/linux/devil … placement/
- opening 4 independant email accounts and putting them on the second workspace without overlapping, to have a constant overview of incoming emails in one spot.
Offline


Thanks so much for taking the time to reply, I appreciate your time.
I was re-jigging some keyboard shortcuts and ended up changing the keyboard shortcut for the wmctrl Kate command. It's worked perfectly ever since, so it's probable that I had a keyboard shortcut conflict of some kind that was mucking everything up. I'll post again if it stops working properly, but I'm hopeful that was the solution.
Offline
Pages: 1
[ Generated in 0.017 seconds, 7 queries executed - Memory usage: 607.04 KiB (Peak: 640.02 KiB) ]