This repository has been archived by the owner on Mar 27, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a29707d
commit fd5c997
Showing
7 changed files
with
121 additions
and
29 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const Gtk = imports.gi.Gtk; | ||
|
||
let extension = imports.misc.extensionUtils.getCurrentExtension(); | ||
let ShellshapeSettings = extension.imports.shellshape_settings; | ||
|
||
let settings; | ||
|
||
const SETTINGS_SCHEMA = 'org.gnome.shell.extensions.alternate-tab'; | ||
|
||
function init() { | ||
convenience.initTranslations(extension); | ||
settings = convenience.getSettings(extension, 'alternate-tab'); | ||
} | ||
|
||
function buildPrefsWidget() { | ||
let config = ShellshapeSettings.get_config(); | ||
let frame = new Gtk.Box({ | ||
orientation: Gtk.Orientation.VERTICAL, | ||
border_width: 10 | ||
}); | ||
|
||
let label = new Gtk.Label({ | ||
label: "<b>Display</b>", | ||
use_markup: true, | ||
xalign: 0 | ||
}); | ||
frame.add(label); | ||
|
||
let hbox = new Gtk.Box({ | ||
orientation: Gtk.Orientation.HORIZONTAL | ||
}); | ||
|
||
let showIndicatorLabel = new Gtk.Label({ text: "Show layout name in indicator" }); | ||
let showIndicatorSwitch = new Gtk.Switch(); | ||
|
||
hbox.add(showIndicatorLabel); | ||
hbox.add(showIndicatorSwitch); | ||
frame.add(hbox); | ||
|
||
(function() { | ||
var active = config.DESCRIPTIVE_INDICATOR.get(); | ||
showIndicatorSwitch.set_active(active); | ||
showIndicatorSwitch.connect('active', function(sw) { | ||
var new_active = sw.get_active(); | ||
if (new_active != active) { | ||
active = new_active; | ||
config.CONCISE_INDICATOR.set(active); | ||
} | ||
}); | ||
})(); | ||
|
||
frame.show_all(); | ||
return frame; | ||
} |
6 changes: 6 additions & 0 deletions
6
shellshape/schemas/org.gnome.shell.extensions.net.gfxmonk.shellshape.prefs.gschema.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<schemalist> | ||
<schema id="org.gnome.shell.extensions.net.gfxmonk.shellshape.prefs" path="/org/gnome/shell/extensions/net/gfxmonk/shellshape/prefs/"> | ||
<key type="b" name="descriptive-indicator"><default>true</default><summary>(TODO...)</summary><description></description></key> | ||
</schema> | ||
</schemalist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const ExtensionUtils = imports.misc.extensionUtils; | ||
const Extension = ExtensionUtils.getCurrentExtension(); | ||
|
||
const SCHEMA_ROOT = 'org.gnome.shell.extensions.net.gfxmonk.shellshape'; | ||
const KEYBINDINGS = SCHEMA_ROOT + '.keybindings'; | ||
const PREFS = SCHEMA_ROOT + '.prefs'; | ||
|
||
function get_local_gsettings(schema_path) { | ||
self.log.info("initting schemas"); | ||
const GioSSS = Gio.SettingsSchemaSource; | ||
|
||
let schemaDir = Extension.dir.get_child('schemas'); | ||
let schemaSource = GioSSS.new_from_directory( | ||
schemaDir.get_path(), | ||
GioSSS.get_default(), | ||
false); | ||
|
||
let schemaObj = schemaSource.lookup(schema, true); | ||
if (!schemaObj) { | ||
throw new Error( | ||
'Schema ' + schema + | ||
' could not be found for extension ' + | ||
Extension.metadata.uuid | ||
); | ||
} | ||
return new Gio.Settings({ settings_schema: schemaObj }); | ||
}; | ||
|
||
function Keybindings() { | ||
var self = this; | ||
var settings this.settings = get_local_gsettings(KEYBINDINGS); | ||
this.each = function(fn, ctx) { | ||
var keys = settings.list_children(); | ||
for (let i=0; i < keys.length; i++) { | ||
let key = keys[i]; | ||
let setting = { | ||
key: key, | ||
get: function() { return settings.get_string_array(key); }, | ||
set: function(v) { settings.set_string_array(key, v); }, | ||
}; | ||
fn.call(ctx, setting); | ||
} | ||
}; | ||
}; | ||
|
||
function Prefs() { | ||
var self = this; | ||
var settings = this.settings = get_local_gsettings(PREFS); | ||
this.DESCRIPTIVE_INDICATOR = { | ||
key: 'descriptive-indicator', | ||
get: function() { return settings.get_boolean(this.key); }, | ||
set: function(v) { settings.set_boolean(this.key, v); } | ||
}; | ||
}; |