lingtjien / Grid-Tiling-Kwin

A kwin script that automatically tiles windows
GNU General Public License v3.0
884 stars 43 forks source link

Inconsistency with the new version #92

Closed jazz-it closed 3 years ago

jazz-it commented 3 years ago

The same bug appears every here and there: when I open the System Settings window, sometimes it's in float mode, with the titlebar, but when I restart, it appears in tiling mode without the border, which is expected behavior.

My terminal (konsole) is always tiled, even I put it in Client Ignored by name.

My rambox and telegramdesktop apps are still always tiled, even though I put them in Client Min Space (2). With the older version of your script I was able to get them tiled. Now it seems to be impossible. :(

lingtjien commented 3 years ago

A lot of things have changed, including the ignoring, which is now done by Regex. So your old settings will most likely not work with this version. I'm assuming you're using your old settings which had ignored names separated by a , but now it's regex (so |, and the whole list is included in the settings)

Easiest is copying your settings to a text file and then put the settings to default (bottom left button in the UI) and then change those settings to what you had previously but according to the new format. Could you try that and report back?

jazz-it commented 3 years ago

Ok, I just tried it (after restarting Manjaro) and something has been fixed, but something's still off:

My current settings:

Rows: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Columns: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2

Client Min Space
Name: texstudio, inkscape, krita, gimp, designer, creator, kdenlive, kdevelop, chromium, kate, spotify, rambox, telegramdesktop
Space: 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2

Client Ignored
Name: 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
Caption: Trace Bitmap (Shift+Alt+B)|Document Properties (Shift+Ctrl+D)|Media viewer|Utility Window|soffice.bin

Not sure about the Caption part, since resetting it to the default displays this field empty - do you expect comma separated values, or pipe-separated values. Should it be regex-ready, or I may put the Caption as displayed on screen?

A proper warning message would be pretty helpful here, after validation.

jazz-it commented 3 years ago

BTW, I've noticed another weird issue that I haven's seen before: if I'm in a full screen and when I press Volume Up/Down keys on my keyboard, the application goes from full screen to tiled!

lingtjien commented 3 years ago

BTW, I've noticed another weird issue that I haven's seen before: if I'm in a full screen and when I press Volume Up/Down keys on my keyboard, the application goes from full screen to tiled!

Oh yeah, a bit too easy on the render calls on my part, try the latest dev branch

Not sure about the Caption part, since resetting it to the default displays this field empty - do you expect comma separated values, or pipe-separated values. Should it be regex-ready, or I may put the Caption as displayed on screen?

TLDR: Both captions and names are now Regex, so separate them by | instead of ,

The only difference between the two is that captions always get surrounded by ^ before and $ after, which in Regex land means to match the beginning of the word and the end of the word.

So captions have to fully match the whole caption, whereas names do not. It's the same Regex matcher as the regular JS one. So if you want to test, you can open any browser and hit F12 and type RegExp('insert your setting string here').test('A client caption that is very long to test') and if it returns true then it means that the client caption that you inserted is ignored using the regex that you supplied. (So the only difference between client names and captions is that for captions it is always with the extra beginning ^ and end match $, so that would be RegExp('^insert your setting string here$').test('A client caption that is very long to test')

I always use this site to build my regexes https://regexr.com/ and that one is also JS based, I believe so should work exactly the same

But you can probably remove the ignored captions that you previously used, because the new way (which also works with wayland) is to ignore based on transient and those captions that I previously ignored are transient clients anyways, so they're already ignored by default now anyways. (Like the Trace Bitmap (Shift+Alt+B) was a dialog window of inkscape that didn't properly set itself as a dialog type, so I needed a caption ignore to not tile that client, but since it's a child of the inkscape window it is transient so that means it's ignored now by default, so you don't need that caption ignore any longer)

jazz-it commented 3 years ago

Oh yeah, a bit too easy on the render calls on my part, try the latest dev branch

That did the trick. The issue is gone now, thanks.

TLDR: Both captions and names are now Regex, so separate them by | instead of ,

How about Names for Client Min Space? Resetting the settings to defaults still holds commas over there, making the whole configuration procedure a bit inconsistent.

The only difference between the two is that captions always get surrounded by ^ before and $ after, which in Regex land means to match the beginning of the word and the end of the word.

So captions have to fully match the whole caption, whereas names do not. It's the same Regex matcher as the regular JS one. So if you want to test, you can open any browser and hit F12 and type RegExp('insert your setting string here').test('A client caption that is very long to test') and if it returns true then it means that the client caption that you inserted is ignored using the regex that you supplied. (So the only difference between client names and captions is that for captions it is always with the extra beginning ^ and end match $, so that would be RegExp('^insert your setting string here$').test('A client caption that is very long to test')

I always use this site to build my regexes https://regexr.com/ and that one is also JS based, I believe so should work exactly the same

Regexr and Developer Tool in Firefox (Shift+F12) giving me different results as per double escaping the special characters, e.g.:

RegExp('^Trace Bitmap \\(Shift\\+Alt\\+B\\)$').test('Trace Bitmap (Shift+Alt+B)')
> true

The same RegEx will be /^Trace Bitmap \(Shift\+Alt\+B\)$/ in Regexr. Should I really take care of escaping the special chars? Seems like an overkill for an average user.

But you can probably remove the ignored captions that you previously used, because the new way (which also works with wayland) is to ignore based on transient and those captions that I previously ignored are transient clients anyways, so they're already ignored by default now anyways. (Like the Trace Bitmap (Shift+Alt+B) was a dialog window of inkscape that didn't properly set itself as a dialog type, so I needed a caption ignore to not tile that client, but since it's a child of the inkscape window it is transient so that means it's ignored now by default, so you don't need that caption ignore any longer)

Ok, I will try to remove the Caption part altogether as per your recommendation and will report back if I find anything funky again.

UPDATE:

lingtjien commented 3 years ago

How about Names for Client Min Space? Resetting the settings to defaults still holds commas over there, making the whole configuration procedure a bit inconsistent.

I want to do that based on Regex as well, but I'm still debating on how to do it, because you need a regex for every min space. so you need to give the user the ability to input multiple regexes. But yeah for now that one is the same as before and uses a comma separated list

The same RegEx will be /^Trace Bitmap (Shift+Alt+B)$/ in Regexr. Should I really take care of escaping the special chars? Seems like an overkill for an average user.

The console in the browser should give the same result as the ignore method. Since I use the exact same JS to ignore clients, but I'll have to verify to be sure.

True, I agree that creating regexes is a bit of a steep learning curve for an average user, but I don't think an average user now really needs the ignore caption feature anyways, since the feature was made to fix a problem that has now been solved.

I think an average user would only have to expand the ignored client names list, and client names usually don't contain special characters so then all they have to do is create a list of names separated by |. Also, they can also not put the special characters in the regex, since the names don't have to be a full match from front to back. But this way a power user gets access to a more flexible way to ignore clients, whereas before that wasn't possible.

With the new Dev version my System settings window is always tiled, no matter how many times do I open it [status: fixed].

The system settings application likes to set its own geometry at startup... which results in it now showing up as tiled a Grid-Tiling: Refresh should fix that. Btw, KDE now also offers a setting to not let applications remember their geometry, see the bottom of the README.md

My rambox and telegramdesktop are still not tiled [status: unchanged]. Any thoughts on this?

Are they not tiled correctly at startup or are they ignored completely and unable to tile, even after a Grid-Tiling: Refresh?

jazz-it commented 3 years ago

True, I agree that creating regexes is a bit of a steep learning curve for an average user, but I don't think an average user now really needs the ignore caption feature anyways, since the feature was made to fix a problem that has now been solved.

Ok, since you already did lots of work to automatically ignore certain sub-windows, maybe you may display this in a more intuitive fashion, i.e. separating Basic from Advanced settings with Toggle hide/show, similar to Settings within the Chromium browser (currently by putting only Ignore Caption in Advanced settings area)?

The system settings application likes to set its own geometry at startup... which results in it now showing up as tiled a Grid-Tiling: Refresh should fix that. Btw, KDE now also offers a setting to not let applications remember their geometry, see the bottom of the README.md

I just unchecked Allow KDE apps to remember the positions of their own windows, but it didn't help: telegramdesktop and rambox windows are still in floating mode and pressing Meta+R doesn't change anything.

Are they not tiled correctly at startup or are they ignored completely and unable to tile, even after a Grid-Tiling: Refresh?

Those two apps are completely ignored and unable to tile on startup, even after Grid-Tiling: Refresh.

lingtjien commented 3 years ago

separating Basic from Advanced settings with Toggle hide/show

I'm refactoring the whole UI anyways and because I wanted to add per desktop grid sizing (setting a grid size per virtual desktop), which is now in dev, but I don't think the ignore caption settings is unintuitive, now that every name matcher is done by regex (also minSpace).

Those two apps are completely ignored and unable to tile on startup

Hmm, weird, sounds like they're ignored. I just installed telegram-desktop and it works perfectly fine for me, tiles correctly. Could you please try with the default settings and see if it tiles? (So we can conclude if it's due to your specific settings or something else)

jazz-it commented 3 years ago

Hmm, weird, sounds like they're ignored. I just installed telegram-desktop and it works perfectly fine for me, tiles correctly. Could you please try with the default settings and see if it tiles? (So we can conclude if it's due to your specific settings or something else)

I did reset the settings to its default, restarted my OS and opened my apps again: same behavior, nothing has changed. Those two apps are opened in floating mode and can't get them back to grid.

Not sure if the following may bother your script; I have these settings for BOTH of those apps in my Window management (KDE Plasma), but it used to work with an older version just fine. Now it doesn't work:

Settings

lingtjien commented 3 years ago

I can reproduce it with the Skip taskbar Force rule, but it's not related to telegram-desktop, I can reproduce it for every client, interesting... I'll take a look

Could you try to remove that rule and see if it works for you? (So that I'm sure we're dealing with the same behavior)

Hmm, seems it's because when you use that option, it makes the client appear on all activities and I ignore all clients which are not on 1 specific activity... (I mean, how am I going to tile the same client across multiple activities... it has the same geometry on all activities...)

The reason it worked on the old version is because that version used client.activities.length <= 1 and now I use client.activities.length === 1 (if a client is on all activities the length is 0). But that seems more like a bug in the old version... because you can't really tile a client that is on multiple activities, I think?

The only way to properly solve it would be to request a method in the KWin API to allow scripting to send clients to a specific activity, I think... but I'm open to suggestions. (A way to hack it, if you don't use activities is to change line 175 in Manager.qml to <= instead of ===, this also makes the script work for wayland since that's the thing that blocks wayland and makes all clients ignored because they're on all activities in wayland, because wayland doesn't support activities yet)

jazz-it commented 3 years ago

I can reproduce it with the Skip taskbar Force rule. Could you try to remove that rule and see if it works for you? (So that I'm sure we're dealing with the same behavior).

Good catch. I could confirm this behavior when Skip taskbar is forced for any window.

The only way to properly solve it would be to request a method in the KWin API to allow scripting to send clients to a specific activity...

Agreed. This should be discussed with the KWin API crew.

A way to hack it, if you don't use activities is to change line 175 in Manager.qml to <= instead of ===, this also makes the script work for wayland since that's the thing that blocks wayland and makes all clients ignored because they're on all activities in wayland, because wayland doesn't support activities yet

I don't use activities, but couldn't this be automated temporarily? E.g. the script checks if activities has been used (~/.config/kactivitymanagerdrc) and then uses <= instead of === by default? I'm sure activities are rarely used anyway.

Not sure if this is helpful, but I made a one-liner in AWK for checking if activities has been used:

awk '/^\[activities\]$/{flag=1; next} /^$/{count++;flag=0} flag {print count}' ~/.config/kactivitymanagerdrc

If the command returns any number >1 it means that custom activities are used on the system (1 is the default).

jazz-it commented 3 years ago

Unfortunately, this <= hack in line 175 opens another issue: When I apply this change, then open rambox and telegram-desktop, the windows are tiled properly. But as soon as I click on an image within the telegram-desktop, the image is tiled as well (!), but without this "hack" it has been opened properly as float. It seems that this "hack" also messes with your automation for ignoring the sub-windows.

BTW: It would be great if you could update the hardcoded X-KDE-PluginInfo-Version=0.0.1 inside of the metadata.desktop regularly, so we could get a better grip of the versioning.

lingtjien commented 3 years ago

And rambox works fine now?

So it's only the opening of an image in telegram that opens it in a new tiled window that was previously not tiled (so a different issue)? If you remove the KWin custom rules you made for telegram, does it float or tile then?

BTW: It would be great if you could update the hardcoded X-KDE-PluginInfo-Version=0.0.1 inside of the metadata.desktop regularly, so we could get a better grip of the versioning.

Oh yeah I probably should lol

jazz-it commented 3 years ago

And rambox works fine now?

No, they both have the same behavior. If I apply the <= hack, then all apps work fine, but it seems like Clients Ignored doesn't work at all anymore. If I revert back the line 175 to ===, then the tiling doesn't work, and Clients Ignored works just fine. Previously I thought that the hack <= affects only the automation for ignoring the sub-windows, but it seems it ignores all settings for Clients Ignored altogether, including some of your automation.

So it's only the opening of an image in telegram that opens it in a new tiled window that was previously not tiled (so a different issue)?

No, it happens for other applications the same way, not just for telegram. But some applications work just fine. I.e. I could not open my terminal or calculator as float, but I could open sub-windows of Gimp as float automatically. Yes, this is a new issue I guess.

If you remove the KWin custom rules you made for telegram, does it float or tile then?

Let me test this... I will update you in a bit.

lingtjien commented 3 years ago

but it seems it ignores all settings for Clients Ignored altogether

If I take the latest develop branch implementation and change line 175 to <= and I add |konsole to the ignored name list, then it ignores konsole and everything else is still tiled normally...

But can't you just revert the change in line 175 and then remove that KWin rule skip taskbar force? I mean... that rule puts the client on all activities and I don't see how one could tile a client logically across all activities (with 1 geomtry) when it's active on more than 1 activity...

jazz-it commented 3 years ago

If I take the latest develop branch implementation and change line 175 to <= and I add |konsole to the ignored name list, then it ignores konsole and everything else is still tiled normally...

Ah, you're right. It's just you've changed the settings UI again with the new dev and forced reset settings to defaults, that's why my settings were dismissed. I pressed "Default" and set my custom settings manually, now I can see my terminal and calculator floating.

But can't you just revert the change in line 175 and then remove that KWin rule skip taskbar force? I mean... that rule puts the client on all activities and I don't see how one could tile a client logically across all activities (with 1 geomtry) when it's active on more than 1 activity...

The thing is I already have many apps in my panel and would like to narrow it down to only necessary apps. Since chat apps are resident in System tray, I don't see any reason to hold them at the panel as well. I may do that, but it's just not what I want. I think you were right yesterday - multi-activity tiling should be discussed with KWin API developers, I guess.

BTW, I tested removing all my KWin custom Window rules and behavior is just the same with <= code (with my custom rules or without it).

lingtjien commented 3 years ago

It's just you've changed the settings UI again

Oh yeah I should have mentioned that, my bad. I'm kinda busy refactoring the whole UI and adding some new stuff...

but it's just not what I want.

I understand, that's why I think that for your case, you can use that hack for now 😄

lingtjien commented 3 years ago

@madjoe I added a new delay setting (develop branch). It allows you to specify how many ms the script should wait before tiling new clients. Since you had problems with BleachBit not tiling correctly at startup. Could you give it a try and maybe increase the delay time to see if it works, the max value is 9999, but I don't think anyone would want to wait 10 seconds before new clients are tiled, everything works with a default time of 0 for me, but I'm curious to your experience with applications you previously had trouble with and see if increasing this time fixes it.

jazz-it commented 3 years ago

Could you give it a try and maybe increase the delay time to see if it works, the max value is 9999, but I don't think anyone would want to wait 10 seconds before new clients are tiled, everything works with a default time of 0 for me, but I'm curious to your experience with applications you previously had trouble with and see if increasing this time fixes it.

Interestingly, I pulled the new develop branch (I didn't change === to <=), restarted Manjaro and ran bleachbit. It worked immediately just fine, without any additional gap like it previously did. Well done!

I really hope the multi-activity tiling could be resolved somehow, since that's the only feature missing with this beautiful script. Everything else works just fine now, thanks! :)

lingtjien commented 3 years ago

Give the dev branch another try (I had a better idea, for both wayland and X11)

jazz-it commented 3 years ago

Almost there. Now I can have my rambox and telegram apps tiled (with custom Window rules enabled), sub-windows automation for all Ignored Clients works fine (including the previous telegram issue with Media viewer), but now it seems we have a new issue when working in multiple workplaces. For example, according to my custom Window rules those chat apps should be opened in my workspace 6. When they really open over there, I go to workspace 3 and then I try to open another random application but it opens in workspace 4 by leaving me in workspace 3 with completely empty desktop.

In another try, I try to open bleachbit in workspace 3, but then the app opens properly in workspace 3, but at the same time rambox jumps to workspace 3 as well and telegram moves from workspace 6 to workspace 4. I couldn't find the pattern, but the tiling seems to work now, now the positioning of windows in workspaces are messed up in some circumstances for some reason.

I also noticed a certain delay before rendering the window. Could you explain the main idea behind, maybe I could help to debug it properly?

lingtjien commented 3 years ago

give the dev branch another try

jazz-it commented 3 years ago

I tested it pretty extensively today and it's still not there. Now every time I restart my OS, rambox and telegram launches automatically and when I open each app from systray they open in floating mode. Then I need to exit from both apps and run them again, then the first app starts tiled, the second one not, then they both get tiled but appears like in a different layers (since both windows show up as 1x1 mode - one on tope the other, instead of splitting the screen as 1x2) then finally, after a few more tries of hide/show window, they get tiled properly filling the appropriate half of the screen.

Then I tested the Media viewer window inside telegram and it starts tiled (which is not expected) and then I close it, open it again a few times and then it opens as float (in a full screen, as expected).

There was a few times when I opened several applications and the rambox jumped to the same workspace all of a sudden for no obvious reason.

lingtjien commented 3 years ago

I'm going to need a few more reproducible steps... in order to debug that... so... trying to digest that info out of your story you did the following?

  1. set application to auto launch at startup
  2. reboot
  3. application looks floating

Is that correct?

I just tried with konsole, put that in the autostart list and rebooted and yes konsole looks like it starts floating, but as soon as I start another instance of konsole or use the Grid-Tiling: Refresh it becomes tiled again

Regarding the media viewer of telegram, I'm assuming its transient property is false but only one way to know for sure

  1. open terminal
  2. kdebugsettings
  3. KWin Scripting to Full Debug
  4. open contents/code/Manager.qml add if (client) {print(client.resourceName, client.caption, client.transient);} after line function add(client) { 179
  5. open the application that you would like to see the property of (telegram image window in this case)
  6. kwin_x11 --replace &
  7. output? (bonus, this also prints the caption that you can use to create a regex to ignore it)
jazz-it commented 3 years ago

Is that correct?

Yes. And I can also confirm both windows get tiled after Meta + R.

output?

QApplication: invalid style override 'gtk' passed, ignoring it.
        Available styles: Breeze, kvantum-dark, kvantum, qt5ct-style, Windows, Fusion
qt.svg: link #path2410 is undefined!
Module 'org.kde.kwin.decoration' does not contain a module identifier directive - it cannot be protected from external registrations.
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
QPainter::begin: Paint device returned engine == 0, type: 3
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
QPainter::begin: Paint device returned engine == 0, type: 3
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
QPainter::begin: Paint device returned engine == 0, type: 3
OpenGL vendor string:                   NVIDIA Corporation
OpenGL renderer string:                 Quadro P2000/PCIe/SSE2
OpenGL version string:                  3.1.0 NVIDIA 450.80.02
OpenGL shading language version string: 1.40 NVIDIA via Cg compiler
Driver:                                 NVIDIA
Driver version:                         450.80.2
GPU class:                              Unknown
OpenGL version:                         3.1
GLSL version:                           1.40
X server version:                       1.20.10
Linux kernel version:                   5.4.80
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
qml: plasmashell Desktop — Plasma false
qml: plasmashell Plasma false
qml: plasmashell Plasma false
qml: rambox Rambox - WhatsApp false
qml: telegram-desktop Telegram false
qml: kdebugsettings KDebugSettings true
qml: telegram-desktop Media viewer false
qml: konsole joe@sensei:~ — Konsole false
qml: FORCE-BLUR: starting the script
qml: ["yakuake","urxvt","keepassxc"]
file:///usr/share/kwin/scripts/desktopchangeosd/contents/ui/main.qml:18:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
qt.qpa.xcb: QXcbConnection: XCB error: 10 (BadAccess), sequence: 2376, resource id: 588, major code: 142 (Unknown), minor code: 2
lingtjien commented 3 years ago

Yes. And I can also confirm both windows get tiled after Meta + R.

Alright, so then it's just a startup thing. The screen area hasn't fully completed yet when the startup application is launched so that's why you need an additional call to the render method. One way to solve this would be to delay starting of your autostart applications by a few seconds, so that the whole desktop environment has finished

I could also repurpose the current delay setting for this and use that setting to delay the script before starting. Which is... hmm... I don't know what I think about that... I'll think about it, what's better

qml: telegram-desktop Telegram false
qml: kdebugsettings KDebugSettings true
qml: telegram-desktop Media viewer false

Yeah, so my suspicion was correct, the media viewer of telegram is set as a main application and not as a child of the telegram-desktop application. I can't really solve that (that's either a bug in KWin of not setting the transient property correctly, but I highly doubt that, it's more likely something the telegram developers should fix, since the media viewer of the main desktop application should be a child of the main desktop application and thus transient)

So this is where ignored captions come in handy, if you add the string that matches this media viewer then it should be ignored, so in this case Media viewer should work, since that's the caption (and if you need to add more in the future separate them by |, such as Media viewer|Some other caption)

jazz-it commented 3 years ago

One way to solve this would be to delay starting of your autostart applications by a few seconds, so that the whole desktop environment has finished

I just tried appending to front of each autostart command sleep 20 && and they did show up with a huge 20s delay, but unfortunately the result is still the same - when I opened the apps, the apps ran as float, not as tiled. It feels like the actual delay should be applied inside your script, since even if I restart only those apps, they behave the same way until I press Meta+R.

I can't really solve that (that's either a bug in KWin of not setting the transient property correctly, but I highly doubt that, it's more likely something the telegram developers should fix, since the media viewer of the main desktop application should be a child and thus transient)

Maybe I could report that to the Telegram team.

So this is where ignored captions come in handy, if you add the string that matches this media viewer then it should be ignored, so in this case Media viewer should work, since that's the caption (and if you need to add more in the future separate them by |, such as Media viewer|Some other caption)

I added Media viewer to the Ignored Captions (maybe we have the Default candidate?) and now it seems to work. I did NOT put any escape character in front of the space, I hope that's how I should proceed when stringing the captions.

lingtjien commented 3 years ago

when I opened the apps, the apps ran as float, not as tiled

Err wut? So the application always opens as float? So it's not related to autostarting?

I just tested

  1. create a test.sh script with content
    #!/bin/bash
    sleep 10
    konsole &
  2. put that script in autostart
  3. reboot
  4. konsole is autostarted after 10 seconds and tiled correctly

So delaying the start of autostart applications works fine for me

I did NOT put any escape character in front of the space

Spaces don't have to be escaped in neither JS nor inside regex, you can if you want too in JS, Media viewer and Media\ viewer should give the same result. (If you test that in any browser F12: console.log('a b') gives the same as console.log('a\ b')

jazz-it commented 3 years ago

Yep. It's not autostart. Even if I close the app (kill the process), then open it again, it behaves the same way. Maybe the previous issue with skipping the taksbar persists?

lingtjien commented 3 years ago

With which apps do you have this? And do they have special window rules?

jazz-it commented 3 years ago

rambox & telegram

do they have special window rules?

Yes, they do: https://github.com/lingtjien/Grid-Tiling-Kwin/issues/92#issuecomment-748508939

lingtjien commented 3 years ago

Oh okay, so it's only those two. What if you increase the delay in the settings?

jazz-it commented 3 years ago

With the delay value of 100 it behaves absolutely the same.

lingtjien commented 3 years ago

that's 100ms, try 1000 and see if that does anything, nvm a different issue

lingtjien commented 3 years ago

oh seems to be the initalize minimized setting hmm

jazz-it commented 3 years ago

I think it works... I just tried it with 4500 and it works, but obviously such value is too big for the delay, especially since it affects all the new opened windows. I need to find a sweet spot and bring it down to the minimal efficient value.

Although, it would be perfect to filter out such delays only for certain windows that really need it. The rest of the windows obviously don't need such delay.

lingtjien commented 3 years ago

Yeah, seems to be a different issue. I'll check it out

jazz-it commented 3 years ago

Strike my previous comment. It worked only if I close those apps, start them again. I tried to restart Manjaro and repeat my test with 4500ms delay, but it didn't work for my both autostart apps out of box.

lingtjien commented 3 years ago

I already found the problem, but it's a bit more rooted so to say...

jazz-it commented 3 years ago

Maybe this will help... it works with the following scenario even with no delay right after restart:

  1. Show rambox window (floating)
  2. Open any app that should be tiled, e.g. kate
  3. kate gets tiled
  4. Close kate and hide rambox window (it stays resident in memory)
  5. Show rambox (tiled)
  6. Show telegram (tiled)

Without opening an app that normally will get tiled in between, it doesn't work.

lingtjien commented 3 years ago

Try the dev branch

jazz-it commented 3 years ago

Wow. It works now! :) Good job: https://github.com/lingtjien/Grid-Tiling-Kwin/commit/210944c32be27143666e8683fa321444b672a22f

jazz-it commented 3 years ago

The latest patch seems to fix even some other issues I didn't report here.

lingtjien commented 3 years ago

Well, you did report a lot of issues, to be fair 😄

But yeah, most of these things were already broken previously... because... well... I took a lot of the code from the old stuff...

So yeah... I'm probably going to tag this one 1.1 and then refactor some stuff later again because this last bug made me realize, I made an assumption more than a year ago that I used for the design, that isn't always true apparently... so yeah... need to fix that

lingtjien commented 3 years ago

merged to master