Skip to content

Commit

Permalink
Add quick settings toggle setting to preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Jul 6, 2024
1 parent 58711bb commit 5e3f34c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions caffeine@patapon.info/preferences/displayPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ class CaffeineDisplayPage extends Adw.PreferencesPage {
selected: this._settings.get_enum(this._settingsKey.SHOW_INDICATOR)
});

// Show quick settings toggle
let showToggleRow = new Adw.SwitchRow({
title: _('Show quick settings toggle'),
subtitle: _('Enable or disable the toggle in the quick settings menu'),
active: this._settings.get_boolean(this._settingsKey.SHOW_TOGGLE)
});

// Show timer
let showTimerRow = new Adw.SwitchRow({
title: _('Show timer in top panel'),
Expand Down Expand Up @@ -86,6 +93,7 @@ class CaffeineDisplayPage extends Adw.PreferencesPage {

// Add elements
displayGroup.add(showStatusIndicatorRow);
displayGroup.add(showToggleRow);
displayGroup.add(showTimerRow);
displayGroup.add(notificationRow);
displayGroup.add(this.posIndicatorOffsetRow);
Expand All @@ -102,6 +110,9 @@ class CaffeineDisplayPage extends Adw.PreferencesPage {
}
this._settings.set_enum(this._settingsKey.SHOW_INDICATOR, widget.selected);
});
showToggleRow.connect('notify::active', (widget) => {
this._settings.set_boolean(this._settingsKey.SHOW_TOGGLE, widget.get_active());
});
showTimerRow.connect('notify::active', (widget) => {
this._settings.set_boolean(this._settingsKey.SHOW_TIMER, widget.get_active());
});
Expand Down
1 change: 1 addition & 0 deletions caffeine@patapon.info/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const SettingsKey = {
SHOW_INDICATOR: 'show-indicator',
SHOW_NOTIFICATIONS: 'show-notifications',
SHOW_TIMER: 'show-timer',
SHOW_TOGGLE: 'show-toggle',
DURATION_TIMER_INDEX: 'duration-timer',
DURATION_TIMER_LIST: 'duration-timer-list',
USE_CUSTOM_DURATION: 'use-custom-duration',
Expand Down

0 comments on commit 5e3f34c

Please sign in to comment.