Tag Archives: gnome

Making GNOME-Shell plugins save their config

I’m working on a GNOME-Shell plugin that can show alternate timezones. As part of the plugin, I want it to remember what the user’s selected timezone is.

A good extension to pull apart seems to be the “System Monitor“.

The “short version” of the minimum you need to do is as follows…

Add a schema name to your metadata.json, eg:

"settings-schema": "org.gnome.shell.extensions.system-monitor",

(Replace “system-monitor” with a unique name for your own extension)

Create a schemas directory inside your extension’s directory, and create a file inside that called YOURSCHEMANAME.gschema.xml, eg. org.gnome.shell.extensions.system-monitor.gschema.xml.

Populate this with appropriate gschema magic; the system-monitor schema is pretty handy again here.

Inside your extension’s schemas directory, run:

glib-compile-schemas .

(Don’t miss the “.” :)

Download convenience.js┬áinto your extension’s directory.

Inside your extension.js, set up some new imports:

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;

Somewhere during init() or enable(), you’ll want to grab a reference to your loaded schema object:

this._schema = Convenience.getSettings();

You can now get and set keys, eg. I’m using:




You probably should set up an actual preferences window… you can learn more about that at http://blog.mecheye.net/2012/02/more-extension-api-breaks/.

GNOME-Shell multi-timezone clock

As many of you know, the company I work for (Internode) was recentlyish purchased by iiNet.

iiNet’s headquarters is in Perth, which is 1.5 or 2.5 hours “behind” Adelaide time.

There’s no longer a multi-timezone clock available for the panel, so… oh well I just wrote one myself.

Screenshot of multi-timezone clock in GNOME-Shell top panel

Right now, it only supports GMT+8 as the “remote” timezone, but it’s easy enough to change the code.

The code is up on GitHub: https://github.com/mibus/MultiClock

Thanks to Marco Dallagiacoma for writing the “Fuzzy Clock” plugin, as I used it as a basis for my own code.