I tried making it work, but I failed to. Can someone post a screen of a working rule set up for it?

Posting to this community as well in hopes someone may know. I’m not sure if it’s broken, but following the documentation for the window rules didn’t yield any results. :(

  • phx@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    If you can’t get it to work with KDE tools, try devilspie2 for scripted window management, and “xinfo” to figure out what’s what

  • tubbadu@lemmy.kde.social
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    “fullscreen” cannot be used as a condition in windows rules AFAIK, but you can achieve this with a simple kwin script (the syntax is very easy, nothing to be scared with). You can find on the KDE website a tutorial and the whole API set.
    Let me show you: We are going to add an event listener listening to any client going fullscreen (or de-fullscreening), and then we will apply the “keep below” property to the fullscreen ones.
    you first need to add a rule to listen to clients changing fullscreen status: (references)

    workspace.clientAdded.connect(client => {
        client.fullScreenChanged.connect(function() {fullscreenChanged(client)})
    });
    

    This will call the function fullscreenChanged each time a new client changes its fullscreen status, passing to the function the client. ( I don’t know why but workspace.clientFullScreenSet does not work, it would have been better, but whatever)

    We need now to write the fullscreenChanged function. It should change the KeepBelow status, evaluating if the client has been fullscreened or de-fullscreened:

    function fullscreenChanged(client){
        console.warn(client, client.fullScreen) // not needed, just to debug 
        if(client.fullScreen){
            // set as keep below
            client.keepBelow = true;
        } else {
            // unset as keep below
            client.keepBelow = false;
        }
    }
    

    so the final script will be:

    function fullscreenChanged(client){
        console.warn(client, client.fullScreen) // not needed, just to debug 
        if(client.fullScreen){
            // set as keep below
            client.keepBelow = true;
        } else {
            // unset as keep below
            client.keepBelow = false;
        }
    }
    
    workspace.clientAdded.connect(client => {
        client.fullScreenChanged.connect(function() {fullscreenChanged(client)})
    });
    

    you can follow the instruction on the tutorial on how to install it. Hope this helps!
    (I haven’t tested it much, in case of any problem feel free to ask!)