KWin: Toggle grayscale KDE destop effect with script
This doesn't deserve an answer, but I don't have the reputation to comment.
I'm trying to automate grayscale toggling via a shortcut too, and sometimes the set:
kwriteconfig5 --file ~/.config/kwinrc --group Plugins --key kwin4_effect_grayscaleEnabled "false"
qdbus org.kde.KWin /KWin reconfigure
doesn't work (effect is not disabling, even if visibly unchecked in the settings).
So I just add an extra line:
qdbus org.kde.KWin /Compositor suspend && qdbus org.kde.KWin /Compositor resume
(it reloads the compositor, the same as doing "alt+shift+F12" twice)
And this allows to avoid the heavy kwin_x11 --replace
solution, so I think it's better (but I'm absolutely no expert here).
(Note that I had to add a sleep 0.2
in between the two lines too, otherwise the grayscale disabling didn't work unless I triggered the whole thing a second time)