[gnome] Update extensions

This commit is contained in:
2024-10-31 10:19:02 -04:00
parent 851ec4a772
commit 6d1e6d1132
238 changed files with 8705 additions and 4185 deletions

View File

@ -21,6 +21,8 @@ import Adw from 'gi://Adw';
import { ExtensionPreferences } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
import { Orientation } from './orientation.js';
export default class MyExtensionPreferences extends ExtensionPreferences {
fillPreferencesWindow(window) {
@ -37,6 +39,14 @@ export default class MyExtensionPreferences extends ExtensionPreferences {
shellMenuGroup.set_title('GNOME Shell Menu Settings');
page.add(shellMenuGroup);
const oskSettingsGroup = new Adw.PreferencesGroup();
oskSettingsGroup.set_title('On-Screen-Keyboard Settings');
page.add(oskSettingsGroup);
const disableOnRotateGroup = new Adw.PreferencesGroup();
disableOnRotateGroup.set_title('Disable-On-Rotation Settings');
page.add(disableOnRotateGroup);
const debugGroup = new Adw.PreferencesGroup();
debugGroup.set_title('Debug Settings');
page.add(debugGroup);
@ -59,9 +69,10 @@ export default class MyExtensionPreferences extends ExtensionPreferences {
const setOffsetRow = new Adw.ActionRow({
title: 'Set orientation offset',
subtitle: 'Valid offset range: 0 to 3. Default is 0\nExperiment with this in case\
orientation is incorrect due to the display being mounted in a non-landscape orientation\
e.g PineTab2 or GPD Pocket 3'
subtitle: 'Valid offset range: 0 to 3. Default is 0\nExperiment with' +
' this in case orientation is incorrect due to the display' +
' being mounted in a non-landscape orientation' +
' e.g PineTab2 or GPD Pocket 3'
});
orientationGroup.add(setOffsetRow);
@ -77,6 +88,26 @@ export default class MyExtensionPreferences extends ExtensionPreferences {
});
shellMenuGroup.add(hideLockRotateRow);
const landscapeOskRow = new Adw.ActionRow({
title: 'Show OSK in landscape orientation'
});
oskSettingsGroup.add(landscapeOskRow);
const portraitRightOskRow = new Adw.ActionRow({
title: 'Show OSK in portrait (right) orientation'
});
oskSettingsGroup.add(portraitRightOskRow);
const landscapeFlippedOskRow = new Adw.ActionRow({
title: 'Show OSK in landscape (flipped) orientation'
});
oskSettingsGroup.add(landscapeFlippedOskRow);
const portraitLeftOskRow = new Adw.ActionRow({
title: 'Show OSK in portrait (left) orientation'
});
oskSettingsGroup.add(portraitLeftOskRow);
const toggleLoggingRow = new Adw.ActionRow({
title: 'Enable debug logging',
subtitle: 'Use "journalctl /usr/bin/gnome-shell -f" to see log output.'
@ -111,6 +142,125 @@ export default class MyExtensionPreferences extends ExtensionPreferences {
valign: Gtk.Align.CENTER,
});
const landscapeOskCheckButton = new Gtk.CheckButton({
active: window._settings.get_boolean('landscape-osk'),
valign: Gtk.Align.CENTER
});
const portraitRightOskCheckButton = new Gtk.CheckButton({
active: window._settings.get_boolean('portrait-right-osk'),
valign: Gtk.Align.CENTER
});
const portraitLeftOskCheckButton = new Gtk.CheckButton({
active: window._settings.get_boolean('portrait-left-osk'),
valign: Gtk.Align.CENTER
});
const landscapeFlippedOskCheckButton = new Gtk.CheckButton({
active: window._settings.get_boolean('landscape-flipped-osk'),
valign: Gtk.Align.CENTER
});
const dorNotebook = new Gtk.Notebook();
const dorKeyboardPage = new Gtk.ListBox();
dorKeyboardPage.set_visible(false); // Keep hidden until feature can be implemented.
dorKeyboardPage.set_selection_mode(Gtk.SelectionMode.NONE);
for (let orientation in Orientation) {
let actionRowTitle = undefined;
let checkButtonBoolId = undefined;
switch (orientation) {
case 'normal':
actionRowTitle = "Landscape";
checkButtonBoolId = "dor-keyboard-landscape";
break;
case 'left-up':
actionRowTitle = "Portrait (Left)";
checkButtonBoolId = "dor-keyboard-portrait-left";
break;
case 'bottom-up':
actionRowTitle = "Landscape Flipped";
checkButtonBoolId = "dor-keyboard-landscape-flipped";
break;
case 'right-up':
actionRowTitle = "Portrait (Right)";
checkButtonBoolId = "dor-keyboard-portrait-right";
break;
}
const dorActionRow = new Adw.ActionRow({
title: actionRowTitle
});
const dorCheckButton = new Gtk.CheckButton({
active: window._settings.get_boolean(checkButtonBoolId),
valign: Gtk.Align.CENTER
});
window._settings.bind(checkButtonBoolId,
dorCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT);
dorActionRow.add_suffix(dorCheckButton);
dorActionRow.activatable_widget = dorCheckButton;
dorKeyboardPage.append(dorActionRow);
}
const dorTouchpadPage = new Gtk.ListBox();
dorTouchpadPage.set_selection_mode(Gtk.SelectionMode.NONE);
for (let orientation in Orientation) {
let actionRowTitle = undefined;
let checkButtonBoolId = undefined;
switch (orientation) {
case 'normal':
actionRowTitle = "Landscape";
checkButtonBoolId = "dor-touchpad-landscape";
break;
case 'left-up':
actionRowTitle = "Portrait (Left)";
checkButtonBoolId = "dor-touchpad-portrait-left";
break;
case 'bottom-up':
actionRowTitle = "Landscape Flipped";
checkButtonBoolId = "dor-touchpad-landscape-flipped";
break;
case 'right-up':
actionRowTitle = "Portrait (Right)";
checkButtonBoolId = "dor-touchpad-portrait-right";
break;
}
const dorActionRow = new Adw.ActionRow({
title: actionRowTitle
});
const dorCheckButton = new Gtk.CheckButton({
active: window._settings.get_boolean(checkButtonBoolId),
valign: Gtk.Align.CENTER
});
window._settings.bind(checkButtonBoolId,
dorCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT);
dorActionRow.add_suffix(dorCheckButton);
dorActionRow.activatable_widget = dorCheckButton;
dorTouchpadPage.append(dorActionRow);
}
const dorKeyboardLabel = Gtk.Label.new('Keyboard');
dorNotebook.append_page(dorKeyboardPage, dorKeyboardLabel);
const dorTouchpadLabel = Gtk.Label.new('Touchpad');
dorNotebook.append_page(dorTouchpadPage, dorTouchpadLabel)
disableOnRotateGroup.add(dorNotebook);
const toggleLoggingSwitch = new Gtk.Switch({
active: window._settings.get_boolean('debug-logging'),
valign: Gtk.Align.CENTER
@ -134,6 +284,18 @@ export default class MyExtensionPreferences extends ExtensionPreferences {
window._settings.bind('hide-lock-rotate',
hideLockRotateSwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
window._settings.bind('landscape-osk',
landscapeOskCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT);
window._settings.bind('portrait-right-osk',
portraitRightOskCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT);
window._settings.bind('portrait-left-osk',
portraitLeftOskCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT);
window._settings.bind('landscape-flipped-osk',
landscapeFlippedOskCheckButton, 'active', Gio.SettingsBindFlags.DEFAULT);
window._settings.bind('debug-logging',
toggleLoggingSwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
@ -155,6 +317,18 @@ export default class MyExtensionPreferences extends ExtensionPreferences {
hideLockRotateRow.add_suffix(hideLockRotateSwitch);
hideLockRotateRow.activatable_widget = hideLockRotateSwitch;
landscapeOskRow.add_suffix(landscapeOskCheckButton);
landscapeOskRow.activatable_widget = landscapeOskCheckButton;
portraitRightOskRow.add_suffix(portraitRightOskCheckButton);
portraitRightOskRow.activatable_widget = portraitRightOskCheckButton;
portraitLeftOskRow.add_suffix(portraitLeftOskCheckButton);
portraitLeftOskRow.activatable_widget = portraitLeftOskCheckButton;
landscapeFlippedOskRow.add_suffix(landscapeFlippedOskCheckButton);
landscapeFlippedOskRow.activatable_widget = landscapeFlippedOskCheckButton;
toggleLoggingRow.add_suffix(toggleLoggingSwitch);
toggleLoggingRow.activatable_widget = toggleLoggingSwitch;
}