From a5b6e84cbc66545f7f526e4512953a4c1c584a5c Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Tue, 1 Sep 2026 13:11:02 -0400 Subject: [PATCH] add smart-close KWin script to minimize Cisco Secure Client vpnui's GTK window quits the whole process on close, removing its tray icon. This KWin script registers a shortcut that minimizes the window when Cisco Secure Client is focused and closes any other window normally, so binding it to the window-close shortcut keeps vpnui in the tray. --- .../scripts/smartclose/contents/code/main.js | 18 ++++++++++++++++++ .../kwin/scripts/smartclose/metadata.json | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 dot_local/share/kwin/scripts/smartclose/contents/code/main.js create mode 100644 dot_local/share/kwin/scripts/smartclose/metadata.json diff --git a/dot_local/share/kwin/scripts/smartclose/contents/code/main.js b/dot_local/share/kwin/scripts/smartclose/contents/code/main.js new file mode 100644 index 0000000..3296378 --- /dev/null +++ b/dot_local/share/kwin/scripts/smartclose/contents/code/main.js @@ -0,0 +1,18 @@ +// Smart Close: minimize Cisco Secure Client, close everything else. +registerShortcut( + "SmartCloseWindow", + "Smart Close Window (minimize Cisco Secure Client)", + "Ctrl+Alt+Shift+F4", // placeholder default; rebind to your real close shortcut + function () { + var w = workspace.activeWindow; + if (!w) { + return; + } + var cls = String(w.resourceClass).toLowerCase(); + if (cls.indexOf("secureclient") !== -1) { + w.minimized = true; + } else { + w.closeWindow(); + } + } +); diff --git a/dot_local/share/kwin/scripts/smartclose/metadata.json b/dot_local/share/kwin/scripts/smartclose/metadata.json new file mode 100644 index 0000000..9a69ef2 --- /dev/null +++ b/dot_local/share/kwin/scripts/smartclose/metadata.json @@ -0,0 +1,13 @@ +{ + "KPlugin": { + "Id": "smartclose", + "Name": "Smart Close Window", + "Description": "Minimize Cisco Secure Client instead of closing it; close all other windows normally", + "Version": "1.0", + "Authors": [{ "Name": "dotfiles" }], + "EnabledByDefault": true + }, + "KPackageStructure": "KWin/Script", + "X-Plasma-API": "javascript", + "X-Plasma-MainScript": "code/main.js" +}