forked from sd65/toggleZoom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prefs.js
63 lines (49 loc) · 1.67 KB
/
prefs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const Gtk = imports.gi.Gtk;
const Convenience = imports.misc.extensionUtils.getCurrentExtension().imports.lib.convenience;
const Gettext = imports.gettext.domain('toggleZoom');
const _ = Gettext.gettext;
let settings;
function init()
{
settings = Convenience.getSettings();
Convenience.initTranslations("toggleZoom");
}
function buildPrefsWidget() {
// Objects
let frame = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, border_width: 10, spacing: 10});
let labelScale = new Gtk.Label({
label: _("Zoom factor")+":\n<small>"+_("1.0 is normal, <1.0 is zoomed in, >1.0 is zoomed out.")+"</small>",
use_markup: true,
xalign: 0
});
frame.add(labelScale);
let scale = new Gtk.HScale({
digits:2,
adjustment: new Gtk.Adjustment({lower: 0.1,upper: 2.0,step_increment: 0.05}),
value_pos: Gtk.PositionType.RIGHT
});
scale.set_value(settings.get_double("scale"))
frame.add(scale);
let labelOutput = new Gtk.Label({
label: _("Screen")+":\n<small>"+_("Pick your value by running this command")+":</small>\n<tt><small>xrandr | awk -F ' ' '/ connected/ { print $1}'</small></tt>",
use_markup: true,
xalign: 0
});
labelOutput.set_selectable(true);
frame.add(labelOutput);
let output = new Gtk.Entry
({
hexpand: true,
text: settings.get_string("output"),
});
frame.add(output);
// Events
scale.connect('value-changed', function(v) {
settings.set_double("scale", v.get_value());
});
output.connect('changed', function(v) {
settings.set_string("output", v.get_text());
});
frame.show_all();
return frame;
}