From 5c2ccf5acc88b9d9112b02a95f945300011f2be5 Mon Sep 17 00:00:00 2001 From: Al Williams Date: Sat, 20 Apr 2024 23:07:27 -0500 Subject: [PATCH 1/2] Updates for KDE6 --- README.md | 10 +++++----- contents/code/main.js | 4 ++-- metadata.json | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d680bc5..d301df8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ This KWin script provides user definable shortcuts that let you move all your windows to a specific screen. If you want to quickly move all windows from one screen to another this is for you. +Updated by Al Williams for KDE6 ## Motive @@ -18,9 +19,9 @@ providing shortcuts for moving all windows to a specific screen. ## Installation First clone this repo and run the following command in the root directory of the -repo. +repo (note that KWin has two capital letters and, yes, it matters). - plasmapkg2 --type kwinscript -i . + kpackagetool6 --type KWin/Script -i . After that open KWin Scripts (System Settings -> Window Management -> KWin Scripts) and enable "Move All Windows to Screen". This won't yet enable @@ -28,9 +29,8 @@ any shortcuts, you can define your own key bindings. See Setup for details. If you need to update the script to a new version pull the repo again and run: - plasmapkg2 --type kwinscript -r . - plasmapkg2 --type kwinscript -i . - + kpackagetool6 --type KWin/Script -r moveallwindowstoscreen6 + kpackagetool6 --type KWin/Script -i . ## Setup diff --git a/contents/code/main.js b/contents/code/main.js index 7cf17b5..193d29b 100644 --- a/contents/code/main.js +++ b/contents/code/main.js @@ -4,14 +4,14 @@ function isRelevant(client) { } function moveAllWindowsToScreen(screen) { - var allClients = workspace.clientList(); + 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, screen); + workspace.sendClientToScreen(client, workspace.screens[screen]); // was just screen number in v5 } } diff --git a/metadata.json b/metadata.json index b8951d8..cfd5b97 100644 --- a/metadata.json +++ b/metadata.json @@ -19,5 +19,6 @@ }, "X-KDE-PluginKeyword": "moveallwindowstoscreen", "X-Plasma-API": "javascript", - "X-Plasma-MainScript": "code/main.js" + "X-Plasma-MainScript": "code/main.js", + "KPackageStructure": "KWin/Script" } From 1daaec25f7b365f6641d2f8ec25acfd18f8176d2 Mon Sep 17 00:00:00 2001 From: Al Williams Date: Sun, 21 Apr 2024 18:07:28 -0500 Subject: [PATCH 2/2] Added sanity check to screen number (fixed readme) --- README.md | 2 +- contents/code/main.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d301df8..665c05a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ any shortcuts, you can define your own key bindings. See Setup for details. If you need to update the script to a new version pull the repo again and run: - kpackagetool6 --type KWin/Script -r moveallwindowstoscreen6 + kpackagetool6 --type KWin/Script -r moveallwindowstoscreen kpackagetool6 --type KWin/Script -i . ## Setup diff --git a/contents/code/main.js b/contents/code/main.js index 193d29b..4039bb7 100644 --- a/contents/code/main.js +++ b/contents/code/main.js @@ -4,6 +4,7 @@ function isRelevant(client) { } function moveAllWindowsToScreen(screen) { + if (screen>workspace.screens.length-1) return; var allClients = workspace.windowList(); // was clientList in v5 var relevantClients = allClients.filter(function(client) { return isRelevant(client);