forked from ddVital/panel-wizard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprefs.js
44 lines (34 loc) · 1.12 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
'use strict';
const { Adw, Gio, Gtk } = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils;
function init() {
}
function fillPreferencesWindow(window) {
const settings = ExtensionUtils.getSettings('org.gnome.shell.extensions.topbar-menus');
const page = new Adw.PreferencesPage();
const group = new Adw.PreferencesGroup({
title: 'Menu Settings',
description: 'Configure which menus appear in the top bar'
});
page.add(group);
const menuItems = ['File', 'Edit', 'View', 'Window', 'Help'];
menuItems.forEach(menu => {
const row = new Adw.ActionRow({
title: menu,
subtitle: `Show ${menu} menu in top bar`
});
const toggle = new Gtk.Switch({
active: settings.get_boolean(`show-${menu.toLowerCase()}`),
valign: Gtk.Align.CENTER,
});
settings.bind(
`show-${menu.toLowerCase()}`,
toggle,
'active',
Gio.SettingsBindFlags.DEFAULT
);
row.add_suffix(toggle);
group.add(row);
});
window.add(page);
}