-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
prefs.js
78 lines (69 loc) · 2.46 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
/*
* Copyright 2021 - 2024 José Expósito <[email protected]>
*
* This file is part of gnome-shell-extension-x11gestures.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* eslint-disable jsdoc/require-jsdoc */
import Adw from 'gi://Adw';
import Gio from 'gi://Gio';
import Gtk from 'gi://Gtk';
import { ExtensionPreferences } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
class Preferences extends ExtensionPreferences {
fillPreferencesWindow(window) {
// eslint-disable-next-line no-underscore-dangle, no-param-reassign
window._settings = this.getSettings('org.gnome.shell.extensions.x11gestures');
const page = new Adw.PreferencesPage();
const group = new Adw.PreferencesGroup({
title: 'X11 Gestures Preferences',
description: 'Restart extension to apply changes',
});
// Create a parent widget that we'll return from this function
const prefsWidget = new Gtk.Grid({
column_spacing: 12,
row_spacing: 12,
visible: true,
});
// Create a label & switch for `show-indicator`
const swipeFingerLabel = new Gtk.Label({
label: 'Number of fingers for Swipe action',
halign: Gtk.Align.START,
visible: true,
});
prefsWidget.attach(swipeFingerLabel, 0, 0, 1, 1);
this.swipeFinger = new Gtk.SpinButton({
halign: Gtk.Align.END,
visible: true,
adjustment: new Gtk.Adjustment({
lower: 3,
upper: 4,
step_increment: 1,
}),
});
prefsWidget.attach(this.swipeFinger, 1, 0, 1, 1);
// Bind the switch to the `swipe-fingers` key
// eslint-disable-next-line no-underscore-dangle
window._settings.bind(
'swipe-fingers',
this.swipeFinger,
'value',
Gio.SettingsBindFlags.DEFAULT,
);
group.add(prefsWidget);
page.add(group);
window.add(page);
}
}
export default Preferences;