From 1e64cf4a4d5fffd775855729c59f08cfff544ea7 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Tue, 4 Jun 2024 18:55:13 +0200 Subject: [PATCH] Port to Plasma 6 --- contents/code/main.js | 6 +++--- metadata.desktop | 17 ----------------- metadata.json | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 metadata.desktop create mode 100644 metadata.json diff --git a/contents/code/main.js b/contents/code/main.js index b34b4b2..a2964b9 100644 --- a/contents/code/main.js +++ b/contents/code/main.js @@ -1,5 +1,5 @@ /* - SPDX-FileCopyrightText: 2021 Arne Keller + SPDX-FileCopyrightText: 2024 Arne Keller SPDX-License-Identifier: GPL-3.0-or-later */ @@ -12,8 +12,8 @@ function isRelevant(client) { function toggleWindow() { assertTrue(windowName != null, "ToggleWindow failed to load windowName from config!"); - var allClients = workspace.clientList(); - for (var i = 0; i < allClients.length; ++i) { + var allClients = workspace.windowList(); + for (var i = 0; i < allClients.length; i++) { if (isRelevant(allClients[i])) { var prevMini = allClients[i].minimized; allClients[i].minimized = !prevMini; diff --git a/metadata.desktop b/metadata.desktop deleted file mode 100644 index f49ba19..0000000 --- a/metadata.desktop +++ /dev/null @@ -1,17 +0,0 @@ -[Desktop Entry] -Name=Toggle Window -Comment=Changes minimization state of one window -Icon=preferences-system-windows-move -Type=Service - -X-KDE-ServiceTypes=KWin/Script -X-Plasma-API=javascript -X-Plasma-MainScript=code/main.js - -X-KDE-PluginInfo-Author=Arne Keller -X-KDE-PluginInfo-Email=arne.keller@posteo.de -X-KDE-PluginInfo-Name=togglewindow -X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-PluginInfo-License=GPL-3.0 -X-KDE-PluginInfo-Category=Windows and Tasks diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..e6a6b76 --- /dev/null +++ b/metadata.json @@ -0,0 +1,21 @@ +{ + "KPlugin": { + "Name": "Toggle Window Visibility", + "Description": "Changes minimization state of one window", + "Icon": "preferences-system-windows-move", + + "Authors": [ + { + "Email": "arne.keller@posteo.de", + "Name": "Arne Keller" + } + ], + "Id": "togglewindow", + "Version": "0.1.1", + "License": "GPLv3", + "Website": "https://www.opencode.net/arnek01/kwin-toggle-window/" + }, + "X-Plasma-API": "javascript", + "X-Plasma-MainScript": "code/main.js", + "KPackageStructure": "KWin/Script" +}