Request for help packaging Gnome extensions

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!

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 doc: add GNOME by jtojnar · Pull Request #43150 · NixOS/nixpkgs · GitHub. 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.

1 Like

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: prefs.js · 4686efd0a9a78ac521b80b8022e8cb184c04e297 · World / Shell extensions / Desktop Icons · GitLab

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

2 Likes

Thank you again for the many helpful links.

Finally found time to revisit this today, and successfully got both extensions working with Gnome 3.32.

I will submit them for inclusion in nixpkgs later this week.

Thanks for the pointer to imports.gi.GIRepository.Repository.prepend_search_path!