krohnkite icon indicating copy to clipboard operation
krohnkite copied to clipboard

Adding support for config file

Open esjeon opened this issue 4 years ago • 2 comments

This ticket is created to combine all related issues.

Rationale

KWin allows scripts to provide a custom configuration dialog, which can be accessed through "KWin Scripts" panel in System Settings. However, KWin only accepts Qt Designer UI file for this purpose, which is mostly static and doesn't allow any programming logic inside. This imposes a significant limitation on how scripts can be configured.

Here, accepting external config files opens up many possibilities, including the ones already employed by independent applications. For example:

  • Change the default layout, and reorder layouts ( #118 #117 )
  • Customize the default layout settings ( #102 )
  • Manage script settings using VCS (e.g. Git)

Technical Aspect

Krohnkite is a "declarative script", that is based on QML, and QML provides XMLHttpRequest function, which can be used to access local files. Combining this with JSON interface built into the Javascript engine, it should be possible to read an external JSON file as a config file with a minimum effort.

Possible Security Concern

While this feature itself won't cause any security problems, the fact that KWin extension scripts can read local files is a security problem. QML-based scripts also can access network using various modules, and this means scripts can both read local data and transmit it over the network. This is enough to create a malware capable of stealing user credentials and probing system configuration.

esjeon avatar Oct 23 '20 02:10 esjeon

I like this idea. My main reason for using Krohnkite is a lack of a decent compositor for i3 and using the kwin script settings to configure tiling is a concession I made (I very much liked the config file approach i3 uses) in order to get proper vsync without screen tearing.

Ethergeist avatar Oct 24 '20 20:10 Ethergeist

Yes, setting the default layout would be a nice addition. Thanks.

ilkerhk avatar Nov 02 '20 21:11 ilkerhk