Window Management Window Rules, Property to run a script on window/process start/open and exit/close

Hello!

I like many have been making the transition to Linux from the burning, sinking ship that is Windows.

I have a feature request I would like to propose.

One thing that I have found to be lacking on the Linux side of things is automated switching or activation of something based on when say a Game or Program is started or closed. On Windows one could use a group policy and the task scheduler to trigger say a script to do something when a program is launched. There are also some programs such as Corsair iCue or AutoHotKey that could change things like keyboard bindings based on running or in focus applications. Linux for the most part does not seem to have this functionality.

After digging into some stuff it would seem as though a lot of the foundation is present, just not a binder per say. An example of this is Input Remapper, but it does not have a way to automate the switching of key binding on it’s own. Another example is GPU screen recorder (basically NV Shadowplay but Linux, and not NV exclusive), has no way to reliably determine what is open or in focus, so by default it just start the capture loop on startup.

After digging into the KDE settings I have found the Window Management, and more exactly the Window Rules section. What I would like to be added is a few new property that just allows the running of a script or command based on start, stop, and preferably focus gain and loss. (with trigger timeouts to prevent script spamming)

That way one could just make say an Input Remapper remap for say LibreOffice Cal. Then once its opened the Window rule would run a command to tell Input Remapper to switch the profile used for example. Or trigger a script when a Steam game is launched or closed that sends a command to start or stop GPU Screen Recorder respectively.

I suspect this would not be that hard of a task to add, and would GREATLY increase the usability of Linux on the desktop in general. This would also make it so one is not locked into peripheral HW ecosystems or HW based profiles, the like.

Thanks in advance

1 Like