Aetf / kwin-maxmize-to-new-desktop

KWin script that moves fullscreened window to a new virtual desktop
BSD 2-Clause "Simplified" License
55 stars 20 forks source link

When set to create new desktop on maximize, it doesn't create a desktop when window starts maximized #4

Closed maurges closed 1 year ago

maurges commented 5 years ago

This is annoying with the following example: 1) Open a dolphin window 2) Maximize it - a new desktop appears 3) Close it - the new desktop disappears 4) Open dolphin again - it starts maximized but new desktop does not appear

Aetf commented 5 years ago

It's indeed an inconsistency of the behaviour.

However, KWin doesn't emit clientMaximized signal for new windows. And there is no direct way to query maximize state of a window.

It might be possible to directly compare the geometry, but I'm not sure how reliable that is. I need to think about it.

maurges commented 5 years ago

I went looking and found this wonderful bug report: https://bugs.kde.org/show_bug.cgi?id=403071

kerriganx commented 2 years ago

I went looking and found this wonderful bug report: https://bugs.kde.org/show_bug.cgi?id=403071

I looked at this and it seems to be fixed. Is this going to help fix this issue? I think it is possible to connect to clientAdded and then check if window fullscreen or maximized

maurges commented 2 years ago

It seems this won't help. Looking through the api now, they made maximization into a function, not a property. So you can now manually maximize a window, but still can't check if it's maximized currently.

Unless the window now also emits the clientMaximized upon creation. If that were the case, this functionality would work already. I assume it does not?

maurges commented 2 years ago

I myself now use the extension you can find pinned in my profile, and manually move windows around. It's not ideal, but it's something

kerriganx commented 2 years ago

It seems this won't help. Looking through the api now, they made maximization into a function, not a property. So you can now manually maximize a window, but still can't check if it's maximized currently.

Unless the window now also emits the clientMaximized upon creation. If that were the case, this functionality would work already. I assume it does not?

According to this (https://develop.kde.org/docs/extend/plasma/kwin/api/#read-write-properties-3) we can check if window is fullscreen. Did I understand correctly, would it be possible to achieve something like this?

workspace.clientAdded.connect(client => {
    if (client.fullScreen) {
        //move window to new desktop
    }
});
maurges commented 2 years ago

That's fullscreen, not maximized. The fullscreen functionality worked from the start.

kerriganx commented 2 years ago

It doesn't seem to work for me. If I launch for example some game - it won't move to a new desktop. But if I change game's mode to windowed, and then back to fullscreen - only then it will move.

maurges commented 2 years ago

That might be because game engines sometimes use funky hacks to bypass your compositor, so it might not know about the game window state. Try it with a regular window and pressing F11 instead, and open a separate issue if that doesn't work: let's keep this one tracking the maximization problem.

In any case, I don't know what I'm talking about, I don't even use this extension anymore, and I haven't touched kwin scripting api in two years ;)

ezvezdov commented 2 years ago

It's indeed an inconsistency of the behaviour.

However, KWin doesn't emit clientMaximized signal for new windows. And there is no direct way to query maximize state of a window.

It might be possible to directly compare the geometry, but I'm not sure how reliable that is. I need to think about it.

Hi @Aetf. Maybe this code will be usefull, it's from Hide titles script and works properly.


workspace.clientAdded.connect(function(client) {
        var area = workspace.clientArea(KWin.MaximizeArea, client);
        var isMaximized = client.width >= area.width && client.height >= area.height;

        // if isMaximized: move_to_new_desktop()

});