Skip to content

Instantly share code, notes, and snippets.

@RushOnline
Created September 2, 2015 21:37
Show Gist options
  • Save RushOnline/4f7832858e26034d3399 to your computer and use it in GitHub Desktop.
Save RushOnline/4f7832858e26034d3399 to your computer and use it in GitHub Desktop.
Debug gnome shell us/ru switcher
_modifiersSwitcher: function() {
let sourceIndexes = Object.keys(this._inputSources);
let i = 0;
while (i < sourceIndexes.length) {
let source = this._inputSources[sourceIndexes[i]];
print("index: ", source.index, ", id: ", source.id);
/*
let seen = [];
let obj = this._inputSources;
print(JSON.stringify(obj, function(key, val) {
if (val != null && typeof val == "object") {
if (seen.indexOf(val) >= 0) {
return;
}
seen.push(val);
}
return val;
}, '\t'));
*/
i++;
}
if (sourceIndexes.length == 0) {
releaseKeyboard();
return true;
}
let is = this._currentSource;
if (!is)
is = this._inputSources[sourceIndexes[0]];
print("current source index: ", is.index, ", id: ", is.id);
let nextIndex = is.index + 1;
print("nextIndex = ", nextIndex);
if (nextIndex > sourceIndexes[sourceIndexes.length - 1]) {
nextIndex = 0;
print("nextIndex set to zero");
}
while (!(is = this._inputSources[nextIndex])) {
print("skip is");
nextIndex += 1;
}
print("activating ", is.id, ", index = ", is.index);
is.activate();
return true;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment