5

I started to write my own Gnome Shell Extensions and can't find any answer to this question -> is there any way, how to install gsettings schema on machine just via extension code (e.g. not copying schema.xml into glib-2.0/schemas directory and compiling by terminal)?

If I try to "make" access to not-installed schema it starts crashing and looking glass keeps telling that such a schema doesn't exist. It's really uncomfortable for potential users who wants to install those extensions.

1

3 Answers 3

2

From everything I've been able to find (google and gtk docs), it seems that you've hit on exactly the reason why extensions installed via web browser can't store settings via dconf/GSettings - you have to install dconf schemas at the system level. There doesn't appear to be a way to have per-user schemas - dconf only uses the single compiled binary file.

The statement about adding support for this in Gnome 3.4 leads me to beleive they are going to a) implement an alternate method for extensions to store settings, or b) extend GSettings/dconf in a way that allows users to install/compile schemas under $HOME.

If anyone can confirm this (or refute it, with pointers to documentation), I, and many others I'm sure, would appreciate it.

This post mentions the limitation, but doesn't explain exactly why... http://www.ubuntubuzz.com/2011/12/gnome-shell-extensions-website-has-been.html

1
  • Well, I know that gnome shell extensions web can't install schemas (one of reasons why my extension was rejected), I actually think that it's because on system level -> I know that when I tried to add my schema into ~/.local/glib-2.0/schemas/ and compile it there, nothing was able to load it. But that's everything what I know about it
    – Otaj
    Jan 7, 2012 at 5:55
1

Currently, you can't. This is not even an extensions limitation, but rather a core one: there is no method in the GSettings library for programatically compiling schemas. You really need to use the command line tool for that.

And manually copying your schema to ~/.local/glib-2.0/schemas and compiling it there does not work by default because GSettings searches for schemas in the directories listed on the XDG_DATA_DIRS environment variable. If you add ~/.local/glib-2.0/schemas to XDG_DATA_DIRS it should work.

0

I think this has changed since the earlier answers, extensions CAN store settings in gsettings without having to touch the system-wide schemas dir. For example to publish on gnome.extensions.org you simply include your schema and its compiled version within your published extension:

https://gjs.guide/extensions/review-guidelines/review-guidelines.html#gsettings-schemas

These are per-user schemas though. The confusing thing is that tools like gsetting and dconf will only read the system-wide schemas installed at /usr/share/glib-2.0/schemas/ which requires root to alter/update. So depending on what tools you are using you may see 'missing schema' but it does not prevent the extension from using gsettings.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .