-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprefs.js
More file actions
90 lines (77 loc) · 2.48 KB
/
prefs.js
File metadata and controls
90 lines (77 loc) · 2.48 KB
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
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";
export default class PaperShellPreferences extends ExtensionPreferences {
fillPreferencesWindow(window) {
const settings = this.getSettings();
const page = new Adw.PreferencesPage();
// --- APPEARANCE GROUP ---
const appearanceGroup = new Adw.PreferencesGroup({ title: "Appearance" });
const opacityRow = new Adw.ActionRow({
title: "Texture Intensity",
subtitle: "Recommended: 0.3. Max is safely capped.",
});
// GTK Scale (Slider)
const slider = Gtk.Scale.new_with_range(
Gtk.Orientation.HORIZONTAL,
0.05, // Minimum value
1.0, // Maximum value
0.05, // Step increment
);
// Format the slider
slider.set_hexpand(true);
slider.set_valign(Gtk.Align.CENTER);
slider.set_draw_value(true);
slider.set_digits(2);
slider.set_value_pos(Gtk.PositionType.RIGHT);
slider.set_size_request(200, -1);
// Bind the slider to the GSettings database
settings.bind(
"opacity",
slider.get_adjustment(),
"value",
Gio.SettingsBindFlags.DEFAULT,
);
opacityRow.add_suffix(slider);
appearanceGroup.add(opacityRow);
// BEHAVIOR GROUP
const behaviorGroup = new Adw.PreferencesGroup({ title: "Behavior" });
const toggleVisibleRow = new Adw.SwitchRow({
title: "Show Quick Settings Toggle",
subtitle: "Add or remove the PaperShell button from the system menu.",
});
settings.bind(
"show-quick-toggle",
toggleVisibleRow,
"active",
Gio.SettingsBindFlags.DEFAULT,
);
const fullscreenRow = new Adw.SwitchRow({
title: "Hide in Fullscreen",
subtitle: "Automatically disable texture when watching videos or gaming.",
});
settings.bind(
"hide-in-fullscreen",
fullscreenRow,
"active",
Gio.SettingsBindFlags.DEFAULT,
);
const nightLightRow = new Adw.SwitchRow({
title: "Sync with Night Light",
subtitle: "Automatically turn on/off when system Night Light is toggled.",
});
settings.bind(
"sync-night-light",
nightLightRow,
"active",
Gio.SettingsBindFlags.DEFAULT,
);
behaviorGroup.add(fullscreenRow);
behaviorGroup.add(nightLightRow);
behaviorGroup.add(toggleVisibleRow);
page.add(appearanceGroup);
page.add(behaviorGroup);
window.add(page);
}
}