peterfajdiga/karousel

Karousel: Window Movement Issue in Multi-Screen Setup on plasma 6 git version

Closed this issue · 10 comments

Karousel shifts all windows to the active screen in a multi-screen setup instead of remaining on the primary screen.

Steps to replicate:

  • Open windows on the primary screen.
  • Click anywhere on another screen.

Thanks for the report! I can confirm this bug, but unfortunately in Plasma 6 there doesn't seem to be any way to find out which screen is the primary one.

I'm trying to decide what's the best way to work around this limitation.

I just found out about this script for plasma 6 :
https://github.com/wd5gnr/moveallwindowstoscreen6/tree/main
It let's the user send all windows to a selected screen via a keyboard shortcut. Maybe it could help ?
The relevant code seems to be this :

function isRelevant(client) {
    return !client.specialWindow;
}

function moveAllWindowsToScreen(screen) {
    var allClients = workspace.windowList();   // was clientList in v5
    var relevantClients = allClients.filter(function(client) {
        return isRelevant(client);
    });

    for (var i = 0; i < relevantClients.length; ++i) {
        var client = relevantClients[i];
        workspace.sendClientToScreen(client, workspace.screens[screen]);   // was just screen number in v5
    }
}

function moveAllTo0() {moveAllWindowsToScreen(0)}
function moveAllTo1() {moveAllWindowsToScreen(1)}
function moveAllTo2() {moveAllWindowsToScreen(2)}
function moveAllTo3() {moveAllWindowsToScreen(3)}
registerShortcut("Move All Windows To Screen 0", "Move All Windows To Screen 0", "", moveAllTo0);
registerShortcut("Move All Windows To Screen 1", "Move All Windows To Screen 1", "", moveAllTo1);
registerShortcut("Move All Windows To Screen 2", "Move All Windows To Screen 2", "", moveAllTo2);
registerShortcut("Move All Windows To Screen 3", "Move All Windows To Screen 3", "", moveAllTo3);

Maybeworkspace.screens[0]points out to the primary screen ?

@peterfajdiga Thanks for your awesome work btw. I've been using Karousel for months. I recently updated to Plasma 6 and found myself in the same exact situation.

If the script that @maxinova found works as expected, it would be nice for the Karousel windows to be fixed to the primary screen

Unfortunately workspace.screens[0] doesn't necessarily point to the primary screen.

A possible temporary solution might be to force Karousel to stay on a single screen, regardless of whether it's the primary one. Users could then utilize keyboard shortcuts to switch between different screens.

@Riebeck-one Yes, that would work. But it would be a bit annoying having to switch to your preferred screen after every startup.

Another possible solution/workaround I'm thinking of would be to implement per-screen tiling with a keyboard shortcut to disable tiling on the current screen. This has the same problem of having to do this after every startup, though.

Using a laptop with a sometimes connected external monitor, I tend to want to change which screen handles which windows often anyway, so enabling/disabling things after startup is common for me anyway, but when i really whant to automate, it is usually scriptable or handled by Window Rules. I'd imagine having per-screen tiling enabled for all screens should generally be OK, but having the option to configure some options would be good, ie: if the screen for new windows targets the current focus (either the screen of the active window, or the screen where the mouse is pointing, depending on settings.) I'd imagine using KDE window rules would work for most exceptions, such as forcing certain apps to always open on a specific screen, but maybe that could be handled more conveniently in Karousel config Window Rules.
Anyway, when I do have more than one screen, I would like to tile a set of window columns independently on each screen, and be able to drag a window (or move with keyboard shortcuts) from one screen to another.

@Riebeck-one I've implemented the solution you've described, with the keyboard shortcut Meta+Ctrl+Return by default (picked arbitrarily, alternative suggestions welcome).

Oh, nice! Can't wait to try this out.

@peterfajdiga Just did the update, it's much more comfortable to use now. Thanks!