I have a potential solution that utilises a KWin script which watches for the demands attention state of windows changing and if one is a Vinagre window which is also demanding attention, it changes that state to not be demanding attention.
Important Note: I’ve tried to write the script so that it will continue to work under KDE 6 (credit to @RedBearAK for some code I pinched for this) however I’ve only tested the below KWin script with KDE Plasma 5 as I don’t have a VM currently set up with KDE Plasma 6 (which I need to do for my own scripts), but I believe this should work. Additionally, I don’t know if I should be disconnecting the signals when windows are closed (or if I can), so hopefully this script doesn’t just cause any issues due to that.
The script is dependent on the window class (for this KWin script this is the resourceClass
) being vinagre
. I only did some basic testing using the main Vinagre window that opens when you load the application.
You need to put create a folder somewhere, let’s say it’s just under your home directory (~
) called shut-up-vinagre
. You want to have the following directory structure with the files noted:
shut-up-vinagre/
├─ contents/
│ ├─ code/
│ │ ├─ main.js
├─ metadata.json
In the main.js
file, add the following:
// Check if we're using KWin 6. If not, assume it's KWin 5.
const isKWIN6 = typeof workspace.windowList === 'function';
let windowAdded;
// Abstract away API differences between KWin 5 and KWin 6.
if (isKWIN6) {
windowAdded = workspace.windowAdded;
} else {
windowAdded = workspace.clientAdded;
}
// Watch for windows being opened so we can check for
// Vinagre windows.
windowAdded.connect(function(win) {
// Check if the window class is 'vinagre'.
if (win.resourceClass.toLowerCase() == 'vinagre') {
// Connect to the demandsAttentionChanged signal for Vinagre
// windows and if the window demands attention, unset the
// demands attention state.
win.demandsAttentionChanged.connect(function() {
if (win.demandsAttention) {
win.demandsAttention = false;
}
})
}
});
In the metadata.json
file, add the following:
{
"KPlugin": {
"Name": "Shut up Vinagre!",
"Description": "Prevents Vinagre from demanding attention.",
"Icon": "preferences-system-windows-script-test",
"Authors": [
{
"Name": "byteit101"
}
],
"Id": "shut-up-vinagre",
"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/
):
Under KDE 5:
kpackagetool5 --type=KWin/Script -i ~/shut-up-vinagre/
Under KDE 6 (again, untested, but I believe should work):
kpackagetool6 --type=KWin/Script -i ~/shut-up-vinagre/
Then you need to go to System Settings and under Window Management > KWin Scripts
, tick on the Shut up Vinagre!
script from the list and click Apply
. This should enable the script and whenever a Vinagre window demands attention it should immediately change back to not demanding attention.
I’ll try to get a VM set up with the most recent KDE Plasma 6 so that I can check if the script still works there, along with the kpackagetool6
command and the System Settings navigation.
Edit: I was able to test the updates in a VM and I’ve made a change to the script as the resourceClass
was capitalized there and was able to confirm the kpackagetool6
and System Settings navigation.