Closed letscho123 closed 1 year ago
No, this is unfortunately not possible with the scripting system.
However, I implemented this in core KWin, and am hoping to get it merged with the next Plasma release: https://invent.kde.org/plasma/kwin/-/merge_requests/2201
However, I implemented this in core KWin, and am hoping to get it merged with the next Plasma release: https://invent.kde.org/plasma/kwin/-/merge_requests/2201
This happened, and is available in Plasma now.
Thanks a lot for your work!
Unfortunately, the new behavior is even worse for my workflow. For example, I have one Firefox instance open on virtual desktop 1, and another on vd 2. If I open now a link in vd 3, the link is opened on the last used vd instead of vd 3. I would like to have the different Firefox instances independently on every vd. If open a link on vd 1 either 2 things should happen, independently of all other vds:
The only two programs where I need this behavior would be Okular and Firefox. Do you think something like this is possible on Wayland? On x11, a simple script can do it.
Are you talking about the new setting in window behavior?
The default behavior should be the same as in previous versions.
The new alternative behavior should make sure you will never be teleported to a different desktop when opening a link.
What is currently not possible on the window manager side is to tell Firefox to open a new window on the current virtual desktop rather than raising an existing window on another desktop (which would then be brought to the current desktop with the window behavior setting). It is however possible to achieve this with a script on X11: https://github.com/nclarius/shell-scripts/tree/main/open-on-current-desktop I don't currently have a solution for Wayland.
Yes, I was talking about the new setting. Also with the old setting I was never teleported to a different desktop, the program just didn't open on the current one.
If it was not clear, the new setting works as it should, but it does not fit to my workflow.
It's a pity that it doesn't work on Wayland.
Also with the old setting I was never teleported to a different desktop, the program just didn't open on the current one.
Should be fixed in the next Plasma release with https://bugs.kde.org/show_bug.cgi?id=458983.
See also the other possible solution in https://bugs.kde.org/show_bug.cgi?id=430713.
If it was not clear, the new setting works as it should, but it does not fit to my workflow.
I don't understand how then it can be that
If I open now a link in vd 3, the link is opened on the last used vd instead of vd 3.
? - as this is precisely what should no longer happen with the new setting.
It's a pity that it doesn't work on Wayland.
Come to think of it, there is a way of getting open windows on Wayland without wmctrl
by asking KWin for the information directly. See here for the basic idea; this would need to be adapted to your use case though.
You can print whether or not an existing Firefox window is open on the current desktop in a KWin script like so:
print(workspace.clientList().some(window => window.resourceClass == "firefox" && window.desktop == workspace.currentDesktop);
Then call it via DBus as in the linked example and use the output to decide whether to use an existing instance or launch a new one in a shell script set up the way described in the readme in the link I gave earlier.
I'm not using Wayland myself yet so I don't have any use for setting this up, but if you want to give it a try and have a question I can see if I can help.
Thanks a lot for the suggestions! I will look into it and try to get it working.
I don't understand how then it can be that
If I open now a link in vd 3, the link is opened on the last used vd instead of vd 3.
? - as this is precisely what should no longer happen with the new setting.
I guess the problem could be that there are already two instances open in this scenario.
Since I don't have much time and you have clearly much more experience, would you be willing to write a kwin script which does what I need? I could also pay for it :)
I'd be happy to do that. Contact me at natalie_clarius@yahoo.de and we can figure out the details.
Hello,
Would it be possible to add a function which ensures that windows only open on the current virtual desktop?
Thanks