Create keybind settings page

This commit is contained in:
2023-05-13 15:10:22 +09:00
parent efcb454b9c
commit 3599ae4bdb
+24
View File
@@ -7,12 +7,25 @@ const Me = ExtensionUtils.getCurrentExtension();
function init() { }
function _createKeybind(settings, keybind) {
// TODO: Set the title to the gsettings's title.
const row = new Adw.ActionRow({ title: keybind });
// TODO: Implement a shortcut selector here.
const listener = new Gtk.Switch({});
// settings.bind(keybind, listener, );
row.add_suffix(listener);
row.activable_widget = listener;
return row
}
function fillPreferencesWindow(window) {
const settings = ExtensionUtils.getSettings(
"org.gnome.shell.extensions.fairy"
);
const page = new Adw.PreferencesPage();
page.set_title("General");
const group = new Adw.PreferencesGroup();
page.add(group);
@@ -33,5 +46,16 @@ function fillPreferencesWindow(window) {
row.add_suffix(toggle);
row.activatable_widget = toggle;
const keybinds = new Adw.PreferencesPage();
keybinds.set_title("Keybinds");
const tileBindings = new Adw.PreferencesGroup();
keybinds.add(tileBindings);
tileBindings.add(_createKeybind(settings, "incrmfact"));
tileBindings.add(_createKeybind(settings, "decmfact"));
tileBindings.add(_createKeybind(settings, "incrnmaster"));
tileBindings.add(_createKeybind(settings, "decnmaster"));
window.add(page);
window.add(keybinds);
}