For a possible approach that should work with Wayland (from some quick testing), you could create a KWin script which registers a shortcut, that you can then set a keybinding to and you can simply press the keybinding to clear the demandsAttention
property (again, this is assuming that’s the property that’s causing the orange highlight). The code below is adapted from this moveallwindowstoscreen script.
You need to put create a folder somewhere, let’s say it’s just under your home directory (~
) called clear-demanding-windows
. You want to have the following directory structure with the files noted:
clear-demanding-windows/
├─ contents/
│ ├─ code/
│ │ ├─ main.js
├─ metadata.json
In the main.js
file, add the following:
function clearDemandsAttention() {
// Get a list of all windows.
var allClients = workspace.clientList();
// Filter out special windows (desktop, dock, splash, etc.).
var relevantClients = allClients.filter(function(client) {
return !client.specialWindow;
});
// Go through the remaining windows not filtered out and if the
// demandsAttention property is true, set it to false.
for (var i = 0; i < relevantClients.length; ++i) {
var client = relevantClients[i];
if (client.demandsAttention) {
client.demandsAttention = false;
}
}
}
// Register a shortcut that we can create set a keybinding for.
if (registerShortcut) {
registerShortcut("Clear Demanding Windows",
"Clear Demanding Windows",
"",
function() { clearDemandsAttention(); }
);
}
In the metadata.json
file, add the following:
{
"KPlugin": {
"Name": "Clear Demanding Windows",
"Description": "Clear the demandsAttention property from windows.",
"Icon": "preferences-system-windows-script-test",
"Authors": [
{
"Name": "ExXfceUser"
}
],
"Id": "clear-demanding-windows",
"Version": "1.0"
},
"X-Plasma-API": "javascript",
"X-Plasma-MainScript": "code/main.js",
"KPackageStructure": "KWin/Script"
}
Once you’ve done all that, run the following command to install the script (it will be installed to ~/.local/share/kwin/scripts/
):
kpackagetool5 --type=KWin/Script -i ~/clear-demanding-windows/
Then you need to go to System Settings and under Window Management > KWin Scripts
, tick on the Clear Demanding Windows
script from the list and click Apply
. This should give enable the script and you should now have a shortcut that you can set a keybinding to.
Go to Shortcuts > Shortcuts > KWin
(KWin
may be under a System Settings
section) and you should find an empty shortcut for Clear Demanding Windows
, which you can set a key binding to.
Hopefully that all works (hoping I’ve copied and pasted the correct things) and while it does mean you need to press a keybinding to do it, it does mean that you actually have a mechanism if you ever want to clear the “demands attention” state of windows in the future without clicking on and focusing them.