multiplatform-settings icon indicating copy to clipboard operation
multiplatform-settings copied to clipboard

Add desktop Linux implementation

Open russhwolf opened this issue 2 years ago • 2 comments

I've wanted to have something here for a long time but I'm not a frequent enough Linux user to know what a reasonable backing API is. There are some proofs-of-concept in #111 and #112.

russhwolf avatar May 02 '22 03:05 russhwolf

o/ Just saw your KotlinConf talk. Here's my experience of using desktop Linux for almost a decade:

The GNOME suite and some other apps built on GTK use dconf (GSettings), analagous to the Windows registry. The KDE suite and some other apps built on Qt use KConfig. It would be sufficient to just pick one, as distros typically package both sets of base libraries even if the corresponding DE isn't officially supported.

But most apps use a bespoke method, serialising as INI, XML, etc. to the file/dir $HOME/.config/<app> or, if you're lucky, $XDG_CONFIG_HOME/<app>. Some apps also use /etc/<app> (for daemons; only writable by admins) as a fallback or base for per-user settings.

I'm not sure if AppImage/Flatpak/snap have settings APIs, but when packaging with those, apps could always use the filesystem APIs.

YoshiRulz avatar May 08 '23 22:05 YoshiRulz

Thanks for the notes! Apparently I actually started to look at dconf/gsettings back when I did the last round of PoCs, but didn't go further than configuring the cinterop. Looking at them now, I'm wary of GSettings since from what I can tell from the docs, it requires a schema with all possible keys defined in advance. That's much more restrictive than other existing implementations and seems like it could be a pretty big source of issues. Talking to dconf directly may be better, so I can give that a closer look, though it's a little confusing finding api docs for it.

I can give kconfig a look too, but if it's GPL rather than LGPL, then I don't think it's safe to link against from Apache-licensed code.

I've thought a little about whether it'd be worth doing some sort of custom filesystem-based implementation for users who don't care about interop, but with multiplatform DataStore on the horizon I think that might become a better choice in the medium term so I'm not sure it's worth the effort.

russhwolf avatar May 15 '23 02:05 russhwolf