lingtjien/Grid-Tiling-Kwin

GUI sizing issues and Ignored list disappeared

Closed this issue ยท 15 comments

I've noticed the sizing issue in GUI... check the "Gap, Bound, Size, Delay" labels below:

enIc3wF

Also, my "Ignored list" from the previous version just disappeared right after the newest update, so my data is lost. I tried to recover some of it from my backup and I wonder is it possible to avoid similar issues with future updates?

I have a Window title named Media viewer which I would like to ignore and previously it worked fine, but now the new version doesn't seem to ignore it. My entire ignore list:

kwin_wayland|ksmserver|krunner|latte-dock|[Pp]lasma|plugin-container|wine|yakuake|overwatch|kcalc|audacious|deadbeef|atom|eclipse|code|deja-dup|vlc|gwenview|xsane|xsane-gimp|kodi|kodi-standalone|steam|anydesk|konsole|mpv|libreoffice-math|Trace Bitmap (Shift+Alt+B)|Document Properties (Shift+Ctrl+D)|Media viewer|Utility Window|soffice.bin|ksmserver-logout-greeter

That looks like a very unresponsive UI design lol. In CSS I would normally solve that by adding wrapping but I'll have to check the QML documentation if they have something equivalent.

I'm afraid not, when I'm changing config variable names (because I think it makes more sense in the design, or I just did it not in the best way initially). The old ones will be dropped and the new ones will be applied using the default values (empty in this case). Having said that, from a users perspective it's not really ideal, so I guess a warning somewhere would be a good idea. Maybe there is a way to get them back from a config somewhere, but I'm not familiar enough yet with the internal kcfg file and where it is stored.

On a side note, this is all on the dev branch, if you plan on running the dev branch then I would recommend keeping a backup of your settings in a text file somewhere else regardless.

Also, a lot of things in your ignore list were from earlier versions which are no longer needed to be explicitly added to the ignore list. I would recommend starting with an empty ignore list and then adding things step by step.

Regarding the Media viewer, you can find the exact client name of a window by using the global shortcut Windows Operations Menu and then going to the section of adding a window rule and there you will find the Window class (application) property. What value does it list there?

a lot of things in your ignore list were from earlier versions which are no longer needed to be explicitly added to the ignore list

Could you be more specific, please? If there's a list of the previous default somewhere, it would spare some time from manually checking something that could be done by comparing my string with the previous default (that is currently unneeded). Thanks. :)

What value does it list there?

0856j6X

The thing is there's the main window with a different title ("Telegram"), but has the same class names as the one with the title "Media viewer". I'd like the main window to stay tiled and the Media viewer to open in full screen (ignored by this script).

Could you be more specific, please? If there's a list of the previous default somewhere, it would spare some time from manually checking something that could be done by comparing my string with the previous default (that is currently unneeded). Thanks. :)

From the top of my head, everything before kcalc is from the old config I believe and everything after libreoffice-math seems to be the captions that you could previously ignore so if you remove all that you would end up with this short list. ksmserver-logout-greeter|kcalc|audacious|deadbeef|atom|eclipse|code|deja-dup|vlc|gwenview|xsane|xsane-gimp|kodi|kodi-standalone|steam|anydesk|konsole|mpv|libreoffice-math

Also just discovered that both wayland and X11 need to ignore ksmserver-logout-greeter, so added that to the front too.

Then you have a few duplicates, kodi and kodi-standalone, the second already being ignored because it contains the first one (same for xsane and xsane-gimp. You also have at least 3 different text editors atom, eclipse and code, do you still use them all, otherwise remove the unused ones, etc...

The thing is there's the main window with a different title ("Telegram"), but has the same class names as the one with the title "Media viewer". I'd like the main window to stay tiled and the Media viewer to open in full screen (ignored by this script).

Oh that's annoying, if both the parent and the child have the exact same class name and window types then with this new setup you can't ignore only one of them (I wanted to get rid of the ignore by caption because min space only allows for names as well, so to keep it consistent and I assumed it was no longer needed since I added type matching and a bunch of other things). Could you make the same screenshot of the main telegram application and the media viewer one and provide me with a side by side screenshot. Maybe there is a difference that we can use to ignore one of them.

Could you make the same screenshot of the main telegram application and the media viewer one and provide me with a side by side screenshot. Maybe there is a difference that we can use to ignore one of them.

RjPGdUz

Here's the same thing by using xprop:

_NET_WM_USER_TIME(CARDINAL) = 10066133
_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_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
_NET_WM_DESKTOP(CARDINAL) = 5
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_SKIP_TASKBAR
_KDE_NET_WM_DESKTOP_FILE(UTF8_STRING) = "telegramdesktop"
_GTK_APPLICATION_ID(UTF8_STRING) = "telegramdesktop"
_GTK_FRAME_EXTENTS(CARDINAL) = 9, 9, 8, 10
_NET_WM_ICON_NAME(UTF8_STRING) = 
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "Telegram"
_NET_WM_NAME(UTF8_STRING) = "Telegram"
_KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 79064
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x1, 0x0, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x3c00008
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
                window id # of group leader: 0x3c00008
_NET_WM_PID(CARDINAL) = 1985
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 62914567
WM_CLASS(STRING) = "telegram-desktop", "TelegramDesktop"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified location: -4, 25
                user specified size: 1928 by 1060
                program specified minimum size: 470 by 522
                window gravity: Static

_KDE_NET_WM_FRAME_STRUT(CARDINAL) = 0, 0, 0, 0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 0, 0
_NET_WM_DESKTOP(CARDINAL) = 5
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
_NET_WM_USER_TIME(CARDINAL) = 10066205
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_SKIP_TASKBAR
_NET_WM_ICON_NAME(UTF8_STRING) =
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "Media viewer"
_NET_WM_NAME(UTF8_STRING) = "Media viewer"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x3c00008
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
                window id # of group leader: 0x3c00008
_NET_WM_PID(CARDINAL) = 1985
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 62914590
WM_CLASS(STRING) = "telegram-desktop", "TelegramDesktop"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified location: 0, 0
                user specified size: 1920 by 1080
                window gravity: Static

I had a better idea, since both have the same PID, I am going to make the assumption that if I already tiled a client with a certain PID that the next time you want to try to tile a client again with the same PID that it's a child window and that we don't tile those. So you can now remove the Media viewer from the ignore list and it should automatically be ignored. Give the dev branch a try

the next time you want to try to tile a client again with the same PID that it's a child window and that we don't tile those

I think it's a solid strategy that may reduce listing numerous of items in Ignore list just with that single addition. Good job!

So you can now remove the Media viewer from the ignore list and it should automatically be ignored. Give the dev branch a try

I tried it without the Media viewer in my Ignore list and now it works like a charm with the most recent version of dev. :)

To avoid opening a new issue, since this one is related - I've just noticed DejaDup's access credentials window is also tiled and I'm sure many other small windows could be automatically ignored like you did above. Here's the xprop output:

$ xprop
_NET_WM_ICON_GEOMETRY(CARDINAL) = 1428, 1016, 60, 64
_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_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP
_NET_WM_DESKTOP(CARDINAL) = 2
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
_NET_WM_STATE(ATOM) = 
_GTK_THEME_VARIANT(UTF8_STRING) = "dark"
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
                bitmap id # to use for icon: 0x500000a
                bitmap id # of mask for icon: 0x5000015
                window id # of group leader: 0x5000002
_GTK_FRAME_EXTENTS(CARDINAL) = 61, 61, 55, 67
_NET_WM_ICON(CARDINAL) =        Icon (48 x 48):
        Icon (128 x 128):
        (not shown)
_GTK_APPLICATION_OBJECT_PATH(UTF8_STRING) = "/org/gnome/DejaDup"
_GTK_UNIQUE_BUS_NAME(UTF8_STRING) = ":1.86"
_GTK_APPLICATION_ID(UTF8_STRING) = "org.gnome.DejaDup"
_NET_WM_OPAQUE_REGION(CARDINAL) = 73, 55, 1886, 12, 61, 67, 1910, 1018, 73, 1085, 1886, 12
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x21, 0x0, 0x0, 0x0
XdndAware(ATOM) = BITMAP
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 83886086, 83886087
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x5000005
WM_CLIENT_LEADER(WINDOW): window id # 0x5000002
_NET_WM_PID(CARDINAL) = 3190
WM_LOCALE_NAME(STRING) = "C"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                program specified minimum size: 387 by 419
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
_KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 141392
WM_CLASS(STRING) = "org.gnome.DejaDup", "org.gnome.DejaDup"
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
WM_ICON_NAME(STRING) = "Back Up"
_NET_WM_ICON_NAME(UTF8_STRING) = "Back Up"
WM_NAME(STRING) = "Back Up"
_NET_WM_NAME(UTF8_STRING) = "Back Up"

How about to monitor this part: program specified minimum size: 387 by 419

If both dimensions are less than 500, it has to be a popup and therefore ignored from tiling?

I think ignored purely based on size of a window is a bad idea, maybe someone has a small display causing all windows to be of small size, then everything would be ignored. If this window is a dialog the application developer should have given it the appropriate window type instead of setting it as a normal window.

But since they didn't, the most appropriate solution would be for you to add it to the ignore list.

In an ideal world I wouldn't even have to implement an ignore list, and application developers would just conform to the window type specification (that's why specifications exist) and everything would work out of the box, the whole ignore list is already a hack to deal with the failures of application developers to set the proper window type.

I think ignored purely based on size of a window is a bad idea, maybe someone has a small display causing all windows to be of small size, then everything would be ignored.

I thought the program specified minimum size: 387 by 419 was defined by the application as a minimum, not the current dimension of the window, no?

I had a better idea, since both have the same PID, I am going to make the assumption that if I already tiled a client with a certain PID that the next time you want to try to tile a client again with the same PID that it's a child window and that we don't tile those.

Unfortunately, I just found an unwanted side-effect of this approach: when I try to drag tabs of my browser, to re-arrange them - many times my mouse releases the left-button click by accident and I end up with a separate tab browser window that is not tiled. Also, when I want to do this intentionally (as a parallel browsing), my child window suppose to always get tiled, but unfortunately now it doesn't.

Besides, I also found a new issue with Virtual Box:

  1. open Virtual Box
  2. start a Virtual Client of your choice
  3. You end up with two tiled windows (left + right)
  4. now minimize the main Virtual Box window and the other one will stretch to fill your screen
  5. Virtual Client (in my case Mint MATE) is loaded in the center of the stretched window, but the loaded dimensions are only 800x600px
  6. open terminal in your Virtual Client and run sudo VBoxClient --vmsvga which should stretch your Virtual Client to the max. size of your window
  7. the Virtual Client window will render centered - covering only 50% of entire width and 100% of height

Explanation: somehow, even if it stretched correctly to cover the entire screen, the stretched window in Step 4 did not update its new dimensions, but seems like the old one was kept from the previous step. Before the recent updates in dev, this worked perfectly well: the stretched Virtual Client window in Step 7 covered 100% of width and 100% of height.

In an ideal world I wouldn't even have to implement an ignore list, and application developers would just conform to the window type specification (that's why specifications exist) and everything would work out of the box, the whole ignore list is already a hack to deal with the failures of application developers to set the proper window type.

I hear you and it just crossed my mind: sadly, but there are probably many projects like yours with their own developers noticing how developers on some other projects are not following certain rules/guidelines. This is the main reason why many Open Source projects feel unpolished, only half done. Would be great if GitHub would add a new feature ie. apply obligatory tagging of each GitHub project, then implementing a "ShoutBox", where similar to infamous Twitter, any developer that has something to say to the others could select the audience for their "Shout" by choosing certain tags combined with simple boolean expressions in between and then post anything up to 280 characters long. Without such feature, your words are not visible to many that should read this and correct their rookie mistakes.

Unfortunately, I just found an unwanted side-effect of this approach: when I try to drag tabs of my browser, to re-arrange them

I had the same problem, so I added a whitelist and renamed the ignored list to blacklist. I still think ignoring clients with the same PID is a good strategy but some applications use a manager process to spin up multiple processes that allow sharing of their resources, browsers are a good example of that. Which is an optimization at their end. So I think having a whitelist should do the trick

I thought the program specified minimum size: 387 by 419 was defined by the application as a minimum, not the current dimension of the window, no?

I don't think using the minimum size as a qualifier is the best either, maybe some normal applications just allow for a very small minimum size

I don't follow along with your steps describing a workflow using virtualbox, what do you even mean by virtual client?

I hear you and it just crossed my mind: sadly, but there are probably many projects like yours with their own developers noticing how developers on some other projects are not following certain rules/guidelines. This is the main reason why many Open Source projects feel unpolished, only half done. Would be great if GitHub would add a new feature ie. apply obligatory tagging of each GitHub project, then implementing a "ShoutBox", where similar to infamous Twitter, any developer that has something to say to the others could select the audience for their "Shout" by choosing certain tags combined with simple boolean expressions in between and then post anything up to 280 characters long. Without such feature, your words are not visible to many that should read this and correct their rookie mistakes.

This is open source, the solution is to file a bug (or pull request) with the application developer to change the window type to the correct one. If nobody files a bug report the application developer won't know.

So I think having a whitelist should do the trick

Sounds right. :)

maybe some normal applications just allow for a very small minimum size

Maybe, but maybe not. Meh... :-\

what do you even mean by virtual client?

Each VirtualBox runs client OS inside. Ie. here you can see 7 virtual clients ready:

virtualbox-main

Is it clear now, or do you need a screencast?

This is open source, the solution is to file a bug (or pull request) with the application developer to change the window type to the correct one. If nobody files a bug report the application developer won't know.

It is the Open Source indeed, but tools for managing open source projects evolve day-by-day. If each project would still only need an individual bug report/pull request to get things going, issues like you spotted earlier would probably never be fixed properly, since nobody would create so many identical bug reports for so many projects out there. I think the idea might be solid.

Is it clear now, or do you need a screencast?

Maybe that will help, but I don't understand what you are seeing and what you are expecting to happen.

Maybe that will help, but I don't understand what you are seeing and what you are expecting to happen.

You may ignore that issue, since I already figured out that it was not due to your Kwin script, but the issue was caused by outdated Guest Additions in VirtualBox. Now that I updated it to the most recent version, it works as expected again.