Sample Header Ad - 728x90

How to run an arbitrary command from a Kwin script?

2 votes
0 answers
560 views
I want to run some commands when the active window changes in KDE. How can I do this from within a kwin script? My use case is that I want to change monitor color preset for some applications, and another use case is to toggle input remap depending on active application. There is a similar question: https://unix.stackexchange.com/questions/115084/how-can-i-run-a-kwin-script-from-the-command-line But this question is not related. Previously, I could use Window Actions for X11 to partly solve the problem, but that UI was removed (see Bug 455444 ) as it does not work in Wayland. I have heard that kwin scripts could not explicitly run an arbitrary commands, and the only way to interect with outside world is running dbus commands. But I am not completely sire about this statement. And if that is true, which is the dbus command, that runs an arbitrary shell command? I tried searching, and found only few info. Question on reddit that says that maybe dbus call to krunner can help. I think this probably is a key to solve the task. And this another question , but it has nothing useful in answers. Any help and code example would be appreciated.
Asked by Ashark (1069 rep)
Jun 26, 2022, 12:32 AM
Last activity: Sep 6, 2023, 05:49 AM