Skip to content

Instantly share code, notes, and snippets.

@kaorimatz
Created March 1, 2013 03:21
Show Gist options
  • Save kaorimatz/5062247 to your computer and use it in GitHub Desktop.
Save kaorimatz/5062247 to your computer and use it in GitHub Desktop.
#!/bin/sh
COMMAND=`cat <<JS
const Gio = imports.gi.Gio;
let settings = new Gio.Settings({ schema: 'org.gnome.desktop.input-sources' });
let current = settings.get_uint('current');
let sources = settings.get_value('sources').get_child_value(current);
let type = sources.get_child_value(0).unpack();
if (type === 'xkb') {
let layout = sources.get_child_value(1).unpack();
print('l:' + layout);
} else if (type === 'ibus') {
let engine = sources.get_child_value(1).unpack();
print('e:' + engine);
}
JS`
gjs -c "$COMMAND"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment