summaryrefslogtreecommitdiff
path: root/toggle-workspace@jodersky.github.com/util.js
blob: a604bfffcfc2f4e931e2c0fcfd3fac4d5a651db3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const Gio = imports.gi.Gio;
const Extension = imports.misc.extensionUtils.getCurrentExtension();

function getSettings() {
  let dir = Extension.dir.get_child('schemas').get_path();

  let source = Gio.SettingsSchemaSource.new_from_directory(dir, Gio.SettingsSchemaSource.get_default(), false);

  if(!source) {
    throw new Error('Error Initializing the thingy.');
  }

  let schema = source.lookup('org.gnome.shell.extensions.toggle-workspace', false);

  if(!schema) {
    throw new Error('Schema missing.');
  }

  return new Gio.Settings({
    settings_schema: schema
  });
}