I have been playing around with custom window rules, and I have created a rule I like which forces all new window that I open to be of size 800x600 and open under my mouse. I only have it applied to the “Normal Window” window type as I only want it to affect my standard programs. This seems to exclude all of the programs I want it to, except for the widgets on my bottom panel. The picture below gives an idea of what is happening.
The exact window Rules I applied are as follows:
Window Type = Normal Window
Size = Apply Initially, 800,600
Maximized Horizontally = Apply Initially, no
Maximized vertically = Apply Initially, no
Initial placement = Force, Centered
These are all of the Widgets it affects that I do not want it to affect:
-Application Launcher
-A couple of system tray widgets
i. klipper
ii. battery Monitor
iii. network manager
iv. device notifier
-Calendar widget (as seen in the aformention picture)
I tried using a regex string to exclude some of these programs from my window rule, but It does not affect them. I assume this is either a faulty regex string (I used ^(.(?!string))*$) or I do not know the proper identfying string for these programs. I assume its the latter, but I don’t know how to find out what their identifying strings are.
I was wondering if their is a way to discover the identifying string of any window, or if there is a better way to exclude widgets from the window rules.
Run “xprop” and click on the corresponding window to get all properties.
KDE’s window rules editor has a similar function I think, cannot check at the moment.
And AFAIK, those widget popups should have a different window type altogether (they are not normal windows). So maybe try to restrict that to normal windows instead of filtering by name.
But again, I cannot check at the moment, I’m not inside a KDE session.
Thanks, I ran xprop on my kalendar widget and got the following:
window state: Normal
icon window: 0x0
_NET_WM_DESKTOP(CARDINAL) = 4294967295
_KDE_NET_WM_ACTIVITIES(STRING) = "00000000-0000-0000-0000-000000000000"
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 38500175
_NET_WM_USER_TIME(CARDINAL) = 38817830
_NET_STARTUP_ID(UTF8_STRING) = "0"
_KDE_SLIDE(_KDE_SLIDE) = 0xffffffff, 0x3
_KDE_NET_WM_BLUR_BEHIND_REGION(CARDINAL) = 0, 0, 800, 600
_KDE_NET_WM_SHADOW(CARDINAL) = 37749344, 37749404, 37749410, 37749400, 37749412, 37749402, 37749386, 37749393, 12, 1, 1, 12
_NET_WM_STATE(ATOM) = _NET_WM_STATE_ABOVE, _NET_WM_STATE_STAYS_ON_TOP, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_SKIP_PAGER
XdndAware(ATOM) = BITMAP
_MOTIF_DRAG_RECEIVER_INFO(_MOTIF_DRAG_RECEIVER_INFO) = 0x6c, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0
WM_CLIENT_LEADER(WINDOW): window id # 0x2400004
_NET_WM_PID(CARDINAL) = 3174
_NET_WM_WINDOW_TYPE(ATOM) = _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _NET_WM_WINDOW_TYPE_NORMAL
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x3, 0x0, 0x0, 0x0
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NAME(STRING) = "plasma-desktop"
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLASS(STRING) = "plasma-desktop", "Plasma-desktop"
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
window id # of group leader: 0x2400004
WM_NORMAL_HINTS(WM_SIZE_HINTS):
user specified location: 2486, 445
program specified location: 2486, 445
user specified size: 800 by 600
program specified size: 800 by 600
program specified minimum size: 406 by 206
program specified maximum size: 1366 by 733
window gravity: NorthWest
WM_CLIENT_MACHINE(STRING) = "Orion.site"
WM_COMMAND(STRING) = { "/usr/bin/plasma-desktop" }
The only peice of information that I could use as a window name is plasma-desktop, and that did not work in my regex command. I’m pretty sure that I only have the normal window selected, and I think that
window state: Normal
in the above code implies that it is being registered as a normal window. I’m guessing that all widgets are registered as plasma-desktop to xorg, so I’m currently looking for a kde program that would let me inspect individual plasmoids.
Why? And what do you mean with inspect? You get the properties of that particular window with “xprop”.
Wouldn’t it be sufficient to just exclude windows with the name “plasma-desktop” then in your rule?
What was your exact regexp that didn’t work?
Although I think what you want to achieve would be better done by a kwin script than a window rule.
In earlier versions you could have used the tiling options I suppose, but they have been removed in favor of doing such things via scripts.
Just click on “Get new script” in “Configure Desktop”->“Window Behavior”->KWin Scripts, the “Tiling” script might just do what you want.
That’s just a suggestion though.
For more informations how to create a kwin script (or maybe adapt an existing one), see here: https://techbase.kde.org/Development/Tutorials/KWin/Scripting
You might also consider to ask your specific questions over at the KDE forums. The KWin developers should definitely know how to do that in the best way.
It seems that when I apply my changes, it doesn’t update the widgets until they are restarted. Nevertheless, I am still having the same issue, but I now suspect that it is with the regex string that I am using. I will probably look into the KWin scripting though, as thats probably the best way to do it like you said.
I would also be interested how to exclude a class of windows, say plasma-desktop from a rule applying to all windows. Regular expressions are not the right tool for this. (One could try to use negative look-behind to create a regular expression that matches all strings not containing, say plasma-desktop but this is a hack.)
I’ve been using this in 13.1 and 13.2 64bit, only the other way around, i.e., setting special window rules for each program I want to open in a certain way. In KDE4, right-click the application window title bar, choose More Actions and Special Window Configuration.
Since these usually amount to 3 or 6 applications only, and is only done once per application, I find it faster/simpler than developing general window rules. You may want to try that as a workaround, if/while you don’t fix your rule issue, unless of course you routinely open dozens or more different applications.
The other, improper, approach is to use the regular expression ^(?!plasma-desktop$)$ to exclude all plasma-desktop windows from resizing. Then use the or operator | to exclude other window classes.