This profile is from a federated server and may be incomplete. View on remote instance

How to send DDC commands or run script on window focus

I have a monitor with multiple modes which include "standard" (good for most things) and "movie". I want to conveniently switch modes when I change programs. Ideally giving keyboard focus to mpv or similar programs would switch the video mode to movie and taking keyboard focus away would switch it to standard....

nexv ,

You can write a Kwin script and connect to the windowActivated function. Unfortunately you can't run arbitrary command from Kwin script, but as suggested in the comment you can use DBus to workaround that.

workspace.windowActivated.connect(function(client) {
    if (client != null && client.caption == "name") {
        callDBus(...); // call your DBus function which call ddcutil
    }
})

Just an example, you will have to do some trial and error yourself!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • All magazines