System values for panel plugins with Xfconf
Simon Steinbeiss
simon at xfce.org
Fri Oct 22 00:52:56 CEST 2021
Hi Graeme and Matias,
first of all thanks Matias, I drafted a response earlier today but didn't
finish/send it and now I don't have to :)
Setting defaults/fallbacks in the plugin itself in combination with distros
being able to ship defaults so far covered all of my use cases.
Happy to hear though if there are shortcomings!
Cheers
Simon
Matias De lellis <mati86dl at gmail.com> schrieb am Fr., 22. Okt. 2021, 00:28:
> Hi Graeme and all,
>
> My first thought is to recommend migrating to gsettings. It is one of the
> few gnome projects, which does not have gnome-specific stuff hardcoded.
> However, my thinking was motivated by the fact that xfconf had no way of
> overwriting by the packagers and now just discovered that this is false,
> and this email turned into a little wake-up call to the distro packagers. ;)
>
> Well, xfconf respects the XDG standard and by default uses
> $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/* for user settings, and
> /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/* for default values. It
> basically takes the values of the environment variable XDG_CONFIG_DIRS.
> So, the way to modify the default options is to add a specific directory
> (/etc/xfce-vendors? /usr/share/xdg?, I don't know. It will depend on each
> distribution), to XDG_CONFIG_DIRS environment variable (Just a bash file on
> /etc/profile.d/ that sets it), and then just add the *.xml files in that
> directory.
>
> It would also be easy to add a patch in xfconf, to add an alternate
> default folder, but I think the current behavior is fine, it was just
> unknown.
>
> Xubuntu seems to do something like this, but Fedora and Debian add patches
> to change the default options. I don't know other distributions.
>
> So, IMHO obviously, I think we should promote the use of XDG_CONFIG_DIRS
> and that distributions use it instead of patching applications. =)
>
> Thank you for reading,
> Regards,
> Matias
>
>
>
>
>
>
> El jue, 21 oct 2021 a las 11:24, Graeme Gott (<graeme at gottcode.org>)
> escribió:
>
>> Hi,
>>
>> I am considering switching Whisker Menu to Xfconf, but one thing I have
>> not been able to determine: can panel plugins have general system values?
>>
>> The simplest way I could find to set system values for a panel plugin in
>> Xfconf was to put values under a property with name="plugin-$ID" in the
>> file "/etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml". But
>> that is obviously linked to a specific panel plugin ID, and there isn't
>> a way to predict what the plugin ID will be. It also won't work if the
>> user adds more than one instance.
>>
>> The method I settled on instead is a bit of a hack; have a separate
>> channel other than the xfce4-panel channel that all plugins use. Use
>> this separate channel only for loading the system values at plugin
>> start, then disconnect from it and connect to the regular xfce4-pannel
>> channel instead. This wouldn't detect any changes to the system values
>> until plugin restart, but those are usually set up once at install time.
>>
>> This separate channel would be used by distributions to preconfigure
>> Whisker Menu instances. That is better than making them patch Whisker
>> Menu to change the default values, which is what they did before I added
>> support for the "defaults.rc" file.
>>
>> I suppose I could just keep loading the file "defaults.rc" before
>> anything else. The code for reading from RC files would have to stay
>> around indefinitely anyway for migrating users to Xfconf, but it just
>> feels cleaner if I can use Xfconf for both the user settings and the
>> system values. Especially when I add new settings--I would want them to
>> be only in Xfconf.
>>
>> I want to make sure that I'm not missing something and that the separate
>> channel is actually necessary.
>>
>> Cheers,
>> Graeme
>> _______________________________________________
>> Xfce4-dev mailing list
>> Xfce4-dev at xfce.org
>> https://mail.xfce.org/mailman/listinfo/xfce4-dev
>
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> https://mail.xfce.org/mailman/listinfo/xfce4-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20211022/271631f4/attachment-0001.html>
More information about the Xfce4-dev
mailing list