wsdfhjxc / kwin-scripts

Some scripts for KWin
GNU General Public License v3.0
124 stars 21 forks source link

Wayland support #9

Open Techognito opened 1 year ago

Techognito commented 1 year ago

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

tibssy commented 1 year ago

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

ghost commented 1 year ago

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

tobolikd commented 1 year ago

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

bemyak commented 11 months ago

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.

CeeBeeEh commented 6 months ago

@bemyak thanks, this worked for me also