How to disable / enable KWin script from command line / shell script?

Hi

Issue

I was wondering if there is a way to disable and re-enable a KWin script from the command line, so I can put that into a shell script. The particular script is krohnkite and I installed it through the GUI (Window Management > KWin Scripts > Get New Scripts).

Research

I played around with qdbus (never heard of it or used it before) but didn’t manage to find a way to disable/enable a KWin Script that way (I’m sure there is one).

What I found was this post. It seems very convoluted plus it allows to run a certain script (while I am interested in disabling / enabling a script).

Context

I am using the awesome Krohnkite KWin script for dynamic window tiling support in KWin. Since I don’t care as much about “bloat” and such, This script allows me to have the best of both worlds (tiling and a full DE). But the tiling stops working properly sometimes and what I found helped was disabling and re-enabling the script (through the KWin Scripts GUI). Now it would be nice to write a script (and maybe even bind that to a shortcut) that disables the script and re-enables it.

Cheers.

Config is in ~/.config/kwinrc. You need only two command to change config file and apply:

kwriteconfig5 --file kwinrc --group <yourgroup> --key <yourkey> <parameter>
qdbus org.kde.KWin /KWin reconfigure

If you put it in script you can create dongle to change it, it’s my example script to switching Video Wall:

current=`kreadconfig5 --file kwinrc --group Plugins --key videowallEnabled`

if [ $current = "true" ]; then
  kwriteconfig5 --file kwinrc --group Plugins --key videowallEnabled false
elif [ $current = "false" ]; then
  kwriteconfig5 --file kwinrc --group Plugins --key videowallEnabled true
fi

qdbus org.kde.KWin /KWin reconfigure

Feel free to use and modify :wink:

1 Like

Very awesome. Exactly what I was looking for, thanks for sharing!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.