Title. Plasma 6 just dropped on my arch-based distro, and it came with an option for a colorblindness correction filter:

Neat little tool that my Protanope ass was very excited about, and it works.

The thing is.

Some time ago Windows also introduced one of those, and in Windows, you can turn it on and off with a key-combination shortcut. I use that a lot on Windows, to keep the filter off and turn it on just when it is necessary (look, every person experiences colorblindness differently, and on my end, these filters while useful for certain kinds of work, are very ugly most other times)

Now, I already know I can set a key-combination shortcut to a terminal command on plasma. Easy peasy.

But for me to do that on plasma I’d need to have a way to switch the effect on and off from the terminal.

I know that I can do systemsettings kcm_kwin_effects to launch the configs app straight into the relevant tab. But now I’m wondering if I could make that even more automatic, maybe using the --args thing, which apparently is literally meant for sending commands directly to the configuration module. But then I wouldn’t know what the command is.

  • Ephera
    link
    fedilink
    English
    34 months ago

    I’m not on Plasma 6 yet, so I can’t tell you exactly what to run, but you can find out yourself.

    First, figure out what needs to be changed in the config files.
    To do so, you can run git init in ~/.config. Then run git add . in there.
    Now change the setting you want to change in the UI.
    And now run git diff to see what changed.

    I’ll use enabling the Wobbly Windows effect as an example.

    So, my diff looks like this:

    [Plugins]
    ...
    + wobblywindowsEnabled=true
    

    (The wobblywindows-line got added into the Plugins group.)

    Now you can switch off Wobbly Windows in the UI settings and then use these commands (with the appropriate parameters in kwriteconfig5) to switch it on again, and tell KWin to load the new settings:

    kwriteconfig5 --file ~/.config/kwinrc --group Plugins --key wobblywindowsEnabled true
    qdbus-qt5 org.kde.KWin /KWin reconfigure
    

    Presumably, those "5"s need to be "6"s on Plasma 6.

    You can also check git diff again to see whether it changes the config file correctly.

    To actually toggle the value, you’ll have to write a script. You can use kreadconfig to read out the current value:

    kreadconfig5 --file ~/.config/kwinrc --group Plugins --key wobblywindowsEnabled
    

    Make sure, you clean up the Git repo we created in your ~/.config folder once you’re done:

    rm -rf ~/.config/.git/
    
    • Count Regal InkwellOP
      link
      English
      2
      edit-2
      4 months ago

      I am thankful for you explaining how to ACTUALLY work with kwriteconfig. It did work with kwriteconfig6 --file ~/.config/kwinrc --group Plugins --key colorblindnesscorrectionEnabled false in that the file changed the way I expected it to.

      BUT

      While the command does work for changing the configuration on the file – the qdbus command to reload it doesn’t seem to work.

      EDIT: I FOUND IT!

      See my post (assuming that’s already up, am writing it) if you care about the details