Skip to content

Commit 6eed004

Browse files
committed
prefs: Wire the Pin Mode toggle and the Indicators page
The schema, the overflow manager and the Indicators page are in place but completely unreachable from the UI until the preferences window registers them. Add the new Pin Mode switch on the General page and instantiate the Indicators page next to the existing General and Custom Icon pages so the user can turn the feature on and pick which icons to hide. Also expose the new GSettings keys (`pin-mode-enabled`, `hidden-icons`, `known-indicators`) through the `SettingsKey` constants table so the preferences pages don't have to repeat the raw key names.
1 parent 9eda5a9 commit 6eed004

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

preferences/generalPage.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@ class AppIndicatorGeneralPage extends Adw.PreferencesPage {
9292
round: true,
9393
});
9494

95+
const pinModeSwitch = new Adw.SwitchRow({
96+
title: _('Pin Mode'),
97+
subtitle: _('Right-click indicators to hide them '
98+
+ 'into the overflow menu'),
99+
active: this._settings.get_boolean(
100+
this._settingsKey.PIN_MODE_ENABLED),
101+
});
102+
pinModeSwitch.connect('notify::active', widget =>
103+
this._settings.set_boolean(
104+
this._settingsKey.PIN_MODE_ENABLED,
105+
widget.get_active()));
106+
this.group.add(pinModeSwitch);
107+
95108
const alignmentList = new Gtk.StringList();
96109
const comboItems = [
97110
{pos: 'center', label: _('Center')},

prefs.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Gtk from 'gi://Gtk'; // will be removed
66
import Gdk from 'gi://Gdk';
77
import * as GeneralPreferences from './preferences/generalPage.js';
88
import * as CustomIconPreferences from './preferences/customIconPage.js';
9+
import * as IndicatorPreferences from './preferences/indicatorPage.js';
910

1011
import {
1112
ExtensionPreferences,
@@ -22,6 +23,9 @@ const SettingsKey = {
2223
ICON_CONTRAST: 'icon-contrast',
2324
TRAY_POS: 'tray-pos',
2425
CUSTOM_ICONS: 'custom-icons',
26+
PIN_MODE_ENABLED: 'pin-mode-enabled',
27+
HIDDEN_ICONS: 'hidden-icons',
28+
KNOWN_INDICATORS: 'known-indicators',
2529
};
2630

2731
export default class DockPreferences extends ExtensionPreferences {
@@ -34,9 +38,11 @@ export default class DockPreferences extends ExtensionPreferences {
3438
const settings = this.getSettings();
3539
const generalPage = new GeneralPreferences.GeneralPage(settings, SettingsKey);
3640
const customIconPage = new CustomIconPreferences.CustomIconPage(settings, SettingsKey);
41+
const indicatorPage = new IndicatorPreferences.IndicatorPage(settings, SettingsKey);
3742

3843
window.add(generalPage);
3944
window.add(customIconPage);
45+
window.add(indicatorPage);
4046

4147
window.connect('close-request', () => {
4248
window.destroy();

0 commit comments

Comments
 (0)