kwin-scripts icon indicating copy to clipboard operation
kwin-scripts copied to clipboard

Wayland support

Open Techognito opened this issue 3 years ago • 5 comments

On wayland this script selects the leftmost monitor as primary, even if another monitor is set to primary in settings

Techognito avatar Nov 17 '22 11:11 Techognito

I had the same issue. I simply just swapped the hdmi cables on vga out and it solved.

tibssy avatar Dec 11 '22 04:12 tibssy

the problem still exit, and I'm using type-c cable

ghost avatar Sep 06 '23 03:09 ghost

Same problem. If you have fixed setup you can change the number in the script to 1 or whatever the display is. But I use it on laptop, so I need more flexible solution, because this disables virtual desktops on my built-in display even if there is no monitor connected

tobolikd avatar Sep 12 '23 12:09 tobolikd

The problem is that KWin scripting API does not expose primary screen information. The best thing I could come up with is this patch to main.js:

@@ -1,3 +1,5 @@
+var primaryScreen = 0;
+
 function bind(window) {
     window.previousScreen = window.screen;
     window.screenChanged.connect(window, update);
@@ -12,7 +14,6 @@
         return;
     }
 
-    var primaryScreen = 0;
     var currentScreen = window.screen;
     var previousScreen = window.previousScreen;
     window.previousScreen = currentScreen;
@@ -32,6 +33,7 @@
 }
 
 function main() {
+    primaryScreen = workspace.activeScreen;
     workspace.clientList().forEach(bind);
     workspace.clientList().forEach(update);
     workspace.clientAdded.connect(bindUpdate);

Now the script remembers the very first active screen it sees (which should be your primary screen).

NB: Remember to relogin into your Plasma Session after applying this patch and enabling the script, otherwise it'll use your currently active screen.

bemyak avatar Oct 03 '23 11:10 bemyak

@bemyak thanks, this worked for me also

CeeBeeEh avatar Feb 17 '24 23:02 CeeBeeEh