I changed the gsettings schema of my extension. The new key names are used both in the xml schema file and in the code. However, when installing the new extension version (by running gnome-extensions install on the archive) the new XML file doesn’t get installed, while the new code does. So the code references new schema keys which don’t exist, and throws an error. How can I fix this?
The error points to a key within a complex variant value inside a setting, so perhaps the setting key exists, but the key in the variant dict doesn’t?
As far as I can see you changed the names of the keys inside the variant from snake case to camel case, so what happens if the user has old configuration which still has snake case keys?
Where are the schemas installed when installing the extension from an archive? I can’t debug the issue because while neither dconf-editor nor the gsettings cli detect the schema when installing it through gnome-extensions install
The entire extension is installed in a self-contained directory under ~/.local/share/gnome-shell/extensions/, including the schema. For gsettings, you’ll need to use the the --schemadir option to point it to the schema directory of the installed extension.
Ok, I tried that and it works, but I’m having a weird issue
I ran the gsettings cli and set the settings-version pref to 4. When running gsettings get, the correct value of 4 is returned. However, when I add console.log(prefs.get_uint('settings-version')) in the extension code, it prints out “5”.
I can’t say anything about that as I do not know what you did precisely. You’d need to show the exact commands you ran and the exact code you used to check the setting.
But in general, I think we can conclude that GNOME Shell updates the schema just fine, but the extension fails to read settings correctly.
I’m just reading the settings by calling this.getSettings().get_uint("settings-version"). It seems like this is the correct way to get them, so I’m not sure why it produces this behavior.
It looks like there are two different places where the settings are stored. For example, if I modify a key with gsettings, the new value is not picked up by the extension and by dconf-editor. And vice versa, if I change a value in dconf-editor, it will be found by the extension, but not by gsettings cli.