Development documentation
Official documentation
Development process
-
Symlink directory of extension to the Gnome Shell extensions directory, e.g.
cd spotify-ad-blocker ln -s $(pwd) ~/.local/share/gnome-shell/extensions/spotify-ad-block@danigm.net
-
Next, Gnome needs to load the extension
(https://gjs.guide/extensions/development/creating.html#enabling-the-extension)
The extension can’t be loaded or updated at runtime, so you have two choices:
- If you’re using Wayland, run a nested instance of Gnome Shell
dbus-run-session -- gnome-shell --nested --wayland
- If you’re using X server, restart Gnome Shell
killall -3 gnome-shell
-
Enable the extension, e.g.
gnome-extensions enable spotify-ad-block@danigm.net
-
(Optional) Modify the extension’s version number
Gnome (or is it Gnome Extension Manager that does this?) may try to update the plugin, which will overwrite your changes. Here’s a workaround to prevent it:
-
Open
metadata.json
-
Change
version
to something big (e.g.1000
)
-
-
After making changes to the extension, repeat the steps above (under Gnome needs to load the extension) so Gnome will reload the extension with the new changes
Debugging
(https://gjs.guide/extensions/development/debugging.html)
- Use
console.log
to log messages -
To see messages
journalctl /usr/bin/gnome-shell -f
Overview
Preferences and schema
API documentation
imports.gi.*
See https://gjs-docs.gnome.org/
Alternatives:
- https://www.roojs.com/seed/gir-1.2-gtk-3.0/gjs/index.html
- https://www.roojs.org/seed/gir-1.2-gtk-3.0/seed/index.html
imports.misc.*
, imports.ui.*
See https://gitlab.gnome.org/GNOME/gnome-shell/-/tree/main/js
- e.g.
imports.ui.status.volume
: https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/status/volume.js