-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprefs.js
101 lines (88 loc) · 2.88 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
import Adw from "gi://Adw";
import Gtk from "gi://Gtk";
import Gio from "gi://Gio";
import {
ExtensionPreferences,
gettext as _,
} from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
export default class ZenExtensionPreferences extends ExtensionPreferences {
/**
* This function is called when the preferences window is first created to fill
* the `Adw.PreferencesWindow`.
*
* @param {Adw.PreferencesWindow} window - The preferences window
*/
fillPreferencesWindow(window) {
const settings = this.getSettings();
const prefsPage = new Adw.PreferencesPage({
name: "general",
title: _("General"),
});
window.add(prefsPage);
const group = new Adw.PreferencesGroup({
title: _("Components"),
description: _("Select any components you want to have enabled"),
});
prefsPage.add(group);
{
const row = new Adw.ActionRow({
title: _("Direct window switch"),
subtitle: _(
"Enables Super-TAB and Super-Shift-TAB bindings for quick window switching",
),
});
group.add(row);
const toggle = new Gtk.Switch({
valign: Gtk.Align.CENTER,
});
row.add_suffix(toggle);
row.set_activatable_widget(toggle);
settings.bind(
"enable-direct-window-switch",
toggle,
"active",
Gio.SettingsBindFlags.DEFAULT,
);
}
{
const row = new Adw.ActionRow({
title: _("Mouse follows focus"),
subtitle: _(
"Enables automatic teleporting of cursor to newly focused windows",
),
});
group.add(row);
const toggle = new Gtk.Switch({
valign: Gtk.Align.CENTER,
});
row.add_suffix(toggle);
row.set_activatable_widget(toggle);
settings.bind(
"enable-mouse-follows-focus",
toggle,
"active",
Gio.SettingsBindFlags.DEFAULT,
);
}
{
const row = new Adw.ActionRow({
title: _("D-Bus window focus"),
subtitle: _(
"Enables a D-Bus interface to predictably focus windows",
),
});
group.add(row);
const toggle = new Gtk.Switch({
valign: Gtk.Align.CENTER,
});
row.add_suffix(toggle);
row.set_activatable_widget(toggle);
settings.bind(
"enable-dbus-window-focus",
toggle,
"active",
Gio.SettingsBindFlags.DEFAULT,
);
}
}
}