This repository has been archived by the owner on Apr 10, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathprefs.js
138 lines (120 loc) · 4.25 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
"use strict";
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
function init() {}
function buildPrefsWidget() {
let gschema = Gio.SettingsSchemaSource.new_from_directory(
Me.dir.get_child("schemas").get_path(),
Gio.SettingsSchemaSource.get_default(),
false
);
this.settings = new Gio.Settings({
settings_schema: gschema.lookup(
"org.gnome.shell.extensions.improvedosk",
true
),
});
let prefsWidget = new Gtk.Grid({
margin: 24,
column_spacing: 24,
row_spacing: 12,
visible: true,
});
let labelPortraitHeight = new Gtk.Label({
label: "Portrait Height in Percent:",
halign: Gtk.Align.START,
visible: true,
});
prefsWidget.attach(labelPortraitHeight, 0, 0, 1, 1);
let inputPortraitHeight = new Gtk.SpinButton();
inputPortraitHeight.set_range(0, 100);
inputPortraitHeight.set_sensitive(true);
inputPortraitHeight.set_increments(1, 10);
prefsWidget.attach(inputPortraitHeight, 1, 0, 1, 1);
inputPortraitHeight.set_value(settings.get_int("portrait-height"));
inputPortraitHeight.connect("value-changed", (widget) => {
settings.set_int("portrait-height", widget.get_value_as_int());
});
settings.connect("changed::portrait-height", () => {
inputPortraitHeight.set_value(settings.get_int("portrait-height"));
});
let labelLandscapeHeight = new Gtk.Label({
label: "Landscape Height in Percent:",
halign: Gtk.Align.START,
visible: true,
});
prefsWidget.attach(labelLandscapeHeight, 0, 1, 1, 1);
let inputLandscapeHeight = new Gtk.SpinButton();
inputLandscapeHeight.set_range(0, 100);
inputLandscapeHeight.set_sensitive(true);
inputLandscapeHeight.set_increments(1, 10);
prefsWidget.attach(inputLandscapeHeight, 1, 1, 1, 1);
inputLandscapeHeight.set_value(settings.get_int("landscape-height"));
inputLandscapeHeight.connect("value-changed", (widget) => {
settings.set_int("landscape-height", widget.get_value_as_int());
});
settings.connect("changed::landscape-height", () => {
inputLandscapeHeight.set_value(settings.get_int("landscape-height"));
});
let labelResizeDesktop = new Gtk.Label({
label: "Resize Desktop (Shell restart required):",
halign: Gtk.Align.START,
visible: true,
});
let inputResizeDesktop = new Gtk.CheckButton({
label: "active",
});
inputResizeDesktop.set_active(settings.get_boolean("resize-desktop"));
inputResizeDesktop.connect("toggled", (widget) => {
settings.set_boolean("resize-desktop", widget.get_active());
});
settings.connect("changed::resize-dekstop", () => {
inputResizeDesktop.set_active(settings.get_boolean("resize-desktop"));
});
prefsWidget.attach(inputResizeDesktop, 1, 2, 1, 1);
prefsWidget.attach(labelResizeDesktop, 0, 2, 1, 1);
let labelIgnoreTouchInput = new Gtk.Label({
label: "Ignore touch-input",
halign: Gtk.Align.START,
visible: true,
});
let inputIgnoreTouchInput = new Gtk.CheckButton({
label: "active",
});
inputIgnoreTouchInput.set_active(settings.get_boolean("ignore-touch-input"));
inputIgnoreTouchInput.connect("toggled", (widget) => {
settings.set_boolean("ignore-touch-input", widget.get_active());
});
settings.connect("changed::ignore-touch-input", () => {
inputIgnoreTouchInput.set_active(
settings.get_boolean("ignore-touch-input")
);
});
prefsWidget.attach(inputIgnoreTouchInput, 1, 3, 1, 1);
prefsWidget.attach(labelIgnoreTouchInput, 0, 3, 1, 1);
let labelShowStatusbarIcon = new Gtk.Label({
label: "Show statusbar icon",
halign: Gtk.Align.START,
visible: true,
});
let inputShowStatusbarIcon = new Gtk.CheckButton({
label: "active",
});
inputShowStatusbarIcon.set_active(
settings.get_boolean("show-statusbar-icon")
);
inputShowStatusbarIcon.connect("toggled", (widget) => {
settings.set_boolean("show-statusbar-icon", widget.get_active());
});
settings.connect("changed::show-statusbar-icon", () => {
inputShowStatusbarIcon.set_active(
settings.get_boolean("show-statusbar-icon")
);
});
prefsWidget.attach(inputShowStatusbarIcon, 1, 4, 1, 1);
prefsWidget.attach(labelShowStatusbarIcon, 0, 4, 1, 1);
prefsWidget.show_all();
return prefsWidget;
}