Request for help packaging Gnome extensions


#1

Hi all,

I’m attempting to package two Gnome extensions and running into small issues. Any help would be appreciated.

Derivations can be found in this Gist.

Desktop Icons

The first, desktop-icons@csoriano, builds fine, but Gnome Tweaks reports “error loading extension” and I can’t find any relevant logs to explain why.

Syncthing Icon

The second, syncthingicon@jay.strict@posteo.de, installs and runs perfectly, except when I attempt to launch the Syncthing web Interface from the extension’s menu. When I do that, it fails with:

gjs[23339]: JS ERROR: Error: Requiring WebKit2, version none: Typelib file for namespace ‘WebKit2’ (any version) not found

From what I can tell, clicking the “Web Interface” button invokes gjs to load webviewer.js, which attempts to import WebKit2.

I suspect I need to modify the environment when gjs is spawned so that imports.gi.WebKit2 can be found, but I’m not sure how to do that with Glib spawning functions , or what variables control the gobject-introspection search path. Help?

Thank you!


#2

Since discourse ML support is borked for me, I am reposting through the web UI:

gobject-introspection obtains the paths from GI_TYPELIB_PATH environment variable, see https://github.com/NixOS/nixpkgs/pull/43150. And while you could replace the null argument with environment array in the spawn_async, it is probably cleaner to modify the lookup path in the target source file directly. We are already doing that in some extensions:

Cannot reproduce the desktop icons failure.


#3

Actually, I managed to reproduce the issue now:

Mar 11 10:43:07 nixos .gnome-shell-wr[1007]: Extension "desktop-icons@csoriano" had error: Error: Schema org.gnome.shell.extensions.desktop-icons could not be found for extension desktop-icons@csoriano. Please check your installation.

The extension expect the schemas somewhere in $XDG_DATA_DIRS/share/glib-2.0/schemas, whereas our glib setup hook moves it to $out/share/gsettings-schemas/$name/glib-2.0/schemas to avoid conflicts.

We will need to do the same we do for GPaste:

Here: https://gitlab.gnome.org/World/ShellExtensions/desktop-icons/blob/4686efd0a9a78ac521b80b8022e8cb184c04e297/prefs.js#L62

We can probably assume the GTK and gsettings-desktop-schemas are available but Nautilus and the extension paths need to be hardcoded.