Schedule Page: Add automatic schedule offset setting

This commit is contained in:
Romain Vigier
2025-08-17 18:06:02 +02:00
parent 0706644e5b
commit 01dd625258
5 changed files with 56 additions and 12 deletions
-10
View File
@@ -66,16 +66,6 @@ Unfortunately, Ubuntu ships heavily modified GNOME components to implement some
As the issue is in Ubuntu, and because I don't have the energy nor the will to work around the consequences of their decisions, unfortunately Ubuntu is not supported until it provides a standard GNOME environment.
### Switching happens too early/too late
There's a hidden setting to configure the offset (in hours) applied to the calculated sunrise and sunset times, you can change it with the `gsettings` command:
```
gsettings --schemadir ~/.local/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.time offset $DESIRED_OFFSET
```
The default offset is `0.4`, set it to `0` do disable it.
### I have disabled Location services but want to use sunrise and sunset times from my location
If you know your coordinates, you can enter them in a hidden setting, and the extension will use them to calculate the sunrise and sunset times. You can set it with the `gsettings` command:
@@ -47,7 +47,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<default>(91,181)</default>
</key>
<key name="offset" type="d">
<range min="0" max="24"/>
<range min="-6" max="6"/>
<default>0.4</default>
</key>
</schema>
+33
View File
@@ -44,6 +44,39 @@ SPDX-License-Identifier: GPL-3.0-or-later
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Automatic schedule offset</property>
<property name="subtitle" translatable="yes">A positive value makes the night longer, a negative value makes the day longer.</property>
<child>
<object class="GtkBox">
<property name="spacing">8</property>
<child>
<object class="GtkSpinButton" id="schedule_offset_spin_button">
<property name="digits">2</property>
<property name="valign">center</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="lower">-6</property>
<property name="upper">6</property>
<property name="step-increment">0.01</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">hours</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<child>
+19 -1
View File
@@ -8,7 +8,11 @@ msgid ""
msgstr ""
"Project-Id-Version: nightthemeswitcher@romainvigier.fr\n"
"Report-Msgid-Bugs-To: \n"
<<<<<<< HEAD
"POT-Creation-Date: 2024-03-24 11:18+0100\n"
=======
"POT-Creation-Date: 2025-08-17 17:45+0200\n"
>>>>>>> 8f766cc (FIX)
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -84,10 +88,24 @@ msgid "Use a manual schedule instead of the one computed from your location."
msgstr ""
#: src/data/ui/SchedulePage.ui:51
msgid "Automatic schedule offset"
msgstr ""
#: src/data/ui/SchedulePage.ui:52
msgid ""
"A positive value makes the night longer, a negative value makes the day "
"longer."
msgstr ""
#: src/data/ui/SchedulePage.ui:71
msgid "hours"
msgstr ""
#: src/data/ui/SchedulePage.ui:84
msgid "Run the transition when an app is fullscreen"
msgstr ""
#: src/data/ui/SchedulePage.ui:60
#: src/data/ui/SchedulePage.ui:93
msgid "Keyboard shortcut"
msgstr ""
+3
View File
@@ -16,6 +16,7 @@ export class SchedulePage extends Adw.PreferencesPage {
'keyboard_shortcut_button',
'schedule_sunrise_time_chooser',
'schedule_sunset_time_chooser',
'schedule_offset_spin_button',
'fullscreen_transition_switch',
],
}, this);
@@ -29,6 +30,8 @@ export class SchedulePage extends Adw.PreferencesPage {
settings.bind('sunrise', this._schedule_sunrise_time_chooser, 'time', Gio.SettingsBindFlags.DEFAULT);
settings.bind('sunset', this._schedule_sunset_time_chooser, 'time', Gio.SettingsBindFlags.DEFAULT);
settings.bind('offset', this._schedule_offset_spin_button, 'value', Gio.SettingsBindFlags.DEFAULT);
settings.bind('fullscreen-transition', this._fullscreen_transition_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
settings.connect('changed::nightthemeswitcher-ondemand-keybinding', () => {