Port preferences to libadwaita

This commit is contained in:
Romain Vigier
2022-02-18 13:23:44 +01:00
parent 6e16cde3d0
commit a70955c2fd
42 changed files with 683 additions and 1685 deletions
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2020-2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: CC-BY-SA-4.0
-->
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="m2 0.99841c-1.108 0-2 0.892-2 2v10.001c0 1.108 0.892 2 2 2h12c1.108 0 2-0.892 2-2v-10.001c0-1.108-0.892-2-2-2zm1 2h10c0.554 0 1 0.446 1 1v8.0008c0 0.554-0.446 1-1 1h-10c-0.554 0-1-0.446-1-1v-8.0008c0-0.554 0.446-1 1-1z"/>
<path d="m3 10v2h10v-4l-3-3-3 4-2-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 541 B

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: CC-BY-SA-4.0
-->
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="m4.5 1c-2.4853 0-4.5 2.0147-4.5 4.5 0.0032498 1.2489 0.75291 2.3099 1.4414 3.2891 1.7318 2.463 6.5586 6.2109 6.5586 6.2109s4.8267-3.7479 6.5586-6.2109c0.68851-0.97919 1.4382-2.0402 1.4414-3.2891 0-2.4853-2.0147-4.5-4.5-4.5-2.5 0-3.101 2.001-3.5 2s-1-2-3.5-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 535 B

-13
View File
@@ -1,13 +0,0 @@
// SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
var Appearance = GObject.registerClass({
GTypeName: 'Appearance',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'Appearance.ui'])}`,
}, class Appearance extends Gtk.ScrolledWindow {});
+4
View File
@@ -21,6 +21,10 @@ var BackgroundButton = GObject.registerClass({
),
},
}, class BackgroundButton extends Gtk.Stack {
vfunc_mnemonic_activate() {
this.activate();
}
activate() {
if (this.path)
return this._change_button.activate();
+25
View File
@@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: 2020-2022 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Adw, Gio, GLib, GObject } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
var BackgroundsPage = GObject.registerClass({
GTypeName: 'BackgroundsPage',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'BackgroundsPage.ui'])}`,
InternalChildren: [
'day_button',
'night_button',
],
}, class BackgroundsPage extends Adw.PreferencesPage {
_init(props = {}) {
super._init(props);
const settings = new Gio.Settings({ schema: 'org.gnome.desktop.background' });
settings.bind('picture-uri', this._day_button, 'path', Gio.SettingsBindFlags.DEFAULT);
settings.bind('picture-uri-dark', this._night_button, 'path', Gio.SettingsBindFlags.DEFAULT);
}
});
-45
View File
@@ -1,45 +0,0 @@
// SPDX-FileCopyrightText: 2021, 2022 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
var BackgroundsPreferences = GObject.registerClass({
GTypeName: 'BackgroundsPreferences',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'BackgroundsPreferences.ui'])}`,
InternalChildren: [
'day_button',
'night_button',
],
Properties: {
settings: GObject.ParamSpec.object(
'settings',
'Settings',
'Backgrounds GSettings',
GObject.ParamFlags.READWRITE,
Gio.Settings.$gtype
),
},
}, class BackgroundsPreferences extends Gtk.Box {
_init(props = {}) {
super._init(props);
this.settings = new Gio.Settings({ schema: 'org.gnome.desktop.background' });
this.settings.bind(
'picture-uri',
this._day_button,
'path',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'picture-uri-dark',
this._night_button,
'path',
Gio.SettingsBindFlags.DEFAULT
);
}
});
-51
View File
@@ -1,51 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const utils = Me.imports.utils;
var Commands = GObject.registerClass({
GTypeName: 'Commands',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'Commands.ui'])}`,
InternalChildren: ['enabled_switch', 'sunrise_entry', 'sunset_entry'],
Properties: {
settings: GObject.ParamSpec.object(
'settings',
'Settings',
'Command GSettings',
GObject.ParamFlags.READWRITE,
Gio.Settings.$gtype
),
},
}, class Commands extends Gtk.ScrolledWindow {
_init(props = {}) {
super._init(props);
this.settings = extensionUtils.getSettings(utils.getSettingsSchema('commands'));
this.settings.bind(
'enabled',
this._enabled_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'sunrise',
this._sunrise_entry,
'text',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'sunset',
this._sunset_entry,
'text',
Gio.SettingsBindFlags.DEFAULT
);
}
});
+29
View File
@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: 2020-2022 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Adw, Gio, GLib, GObject } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const utils = Me.imports.utils;
var CommandsPage = GObject.registerClass({
GTypeName: 'CommandsPage',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'CommandsPage.ui'])}`,
InternalChildren: [
'enabled_switch',
'sunrise_entry',
'sunset_entry',
],
}, class CommandsPage extends Adw.PreferencesPage {
_init(props = {}) {
super._init(props);
const settings = extensionUtils.getSettings(utils.getSettingsSchema('commands'));
settings.bind('enabled', this._enabled_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('sunrise', this._sunrise_entry, 'text', Gio.SettingsBindFlags.DEFAULT);
settings.bind('sunset', this._sunset_entry, 'text', Gio.SettingsBindFlags.DEFAULT);
}
});
+13
View File
@@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: 2022 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Adw, GLib, GObject } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
var ContributePage = GObject.registerClass({
GTypeName: 'ContributePage',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'ContributePage.ui'])}`,
}, class ContributePage extends Adw.PreferencesPage {});
-64
View File
@@ -1,64 +0,0 @@
// SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const utils = Me.imports.utils;
const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var CursorPreferences = GObject.registerClass({
GTypeName: 'CursorPreferences',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'CursorPreferences.ui'])}`,
InternalChildren: [
'enabled_switch',
'day_dropdown',
'night_dropdown',
],
Properties: {
settings: GObject.ParamSpec.object(
'settings',
'Settings',
'Cursor GSettings',
GObject.ParamFlags.READWRITE,
Gio.Settings.$gtype
),
},
}, class CursorPreferences extends Gtk.Box {
_init(props = {}) {
super._init(props);
this.settings = extensionUtils.getSettings(utils.getSettingsSchema('cursor-variants'));
this.settings.bind(
'enabled',
this._enabled_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const themeChoices = Gio.ListStore.new(DropDownChoice);
themeChoices.splice(0, 0, Array.from(utils.getInstalledCursorThemes()).sort().map(theme => new DropDownChoice({ id: theme, title: theme })));
this._day_dropdown.model = themeChoices;
this._day_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._day_dropdown.connect('notify::selected-item', () => this.settings.set_string('day', this._day_dropdown.selected_item.id));
const updateDayDropDownSelected = () => {
this._day_dropdown.selected = utils.findItemPositionInModel(this._day_dropdown.model, item => item.id === this.settings.get_string('day'));
};
this.settings.connect('changed::day', () => updateDayDropDownSelected());
updateDayDropDownSelected();
this._night_dropdown.model = themeChoices;
this._night_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._night_dropdown.connect('notify::selected-item', () => this.settings.set_string('night', this._night_dropdown.selected_item.id));
const updateNightDropDownSelected = () => {
this._night_dropdown.selected = utils.findItemPositionInModel(this._night_dropdown.model, item => item.id === this.settings.get_string('night'));
};
this.settings.connect('changed::night', () => updateNightDropDownSelected());
updateNightDropDownSelected();
}
});
-72
View File
@@ -1,72 +0,0 @@
// SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const utils = Me.imports.utils;
const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var GtkPreferences = GObject.registerClass({
GTypeName: 'GtkPreferences',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'GtkPreferences.ui'])}`,
InternalChildren: [
'enabled_switch',
'manual_switch',
'day_dropdown',
'night_dropdown',
],
Properties: {
settings: GObject.ParamSpec.object(
'settings',
'Settings',
'GTK GSettings',
GObject.ParamFlags.READWRITE,
Gio.Settings.$gtype
),
},
}, class GtkPreferences extends Gtk.Box {
_init(props = {}) {
super._init(props);
this.settings = extensionUtils.getSettings(utils.getSettingsSchema('gtk-variants'));
this.settings.bind(
'enabled',
this._enabled_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'manual',
this._manual_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const themeChoices = Gio.ListStore.new(DropDownChoice);
themeChoices.splice(0, 0, Array.from(utils.getInstalledGtkThemes()).sort().map(theme => new DropDownChoice({ id: theme, title: theme })));
this._day_dropdown.model = themeChoices;
this._day_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._day_dropdown.connect('notify::selected-item', () => this.settings.set_string('day', this._day_dropdown.selected_item.id));
const updateDayDropDownSelected = () => {
this._day_dropdown.selected = utils.findItemPositionInModel(this._day_dropdown.model, item => item.id === this.settings.get_string('day'));
};
this.settings.connect('changed::day', () => updateDayDropDownSelected());
updateDayDropDownSelected();
this._night_dropdown.model = themeChoices;
this._night_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._night_dropdown.connect('notify::selected-item', () => this.settings.set_string('night', this._night_dropdown.selected_item.id));
const updateNightDropDownSelected = () => {
this._night_dropdown.selected = utils.findItemPositionInModel(this._night_dropdown.model, item => item.id === this.settings.get_string('night'));
};
this.settings.connect('changed::night', () => updateNightDropDownSelected());
updateNightDropDownSelected();
}
});
-47
View File
@@ -1,47 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
var Headerbar = GObject.registerClass({
GTypeName: 'Headerbar',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'Headerbar.ui'])}`,
Properties: {
preferences: GObject.ParamSpec.object(
'preferences',
'Preferences',
'A Preferences stack',
GObject.ParamFlags.READWRITE,
Gtk.Stack.$gtype
),
},
}, class Headerbar extends Gtk.HeaderBar {
onPreferencesChanged(headerbar) {
headerbar.title_widget = null;
if (!headerbar.preferences)
return;
const pages = headerbar.preferences.pages;
const box = new Gtk.Box({ orientation: 'horizontal', css_classes: ['linked'] });
for (let i = 0; i < pages.get_n_items(); i++) {
const page = pages.get_item(i);
const button = new Gtk.ToggleButton({ active: pages.is_selected(i) });
const buttonBox = new Gtk.Box({ orientation: 'horizontal', margin_start: 12, margin_end: 12, spacing: 6 });
buttonBox.append(new Gtk.Image({ icon_name: page.icon_name }));
buttonBox.append(new Gtk.Label({ label: page.title }));
button.set_child(buttonBox);
button.connect('clicked', () => {
pages.select_item(i, true);
button.active = true;
});
pages.connect('selection-changed', () => {
button.active = pages.is_selected(i);
});
box.append(button);
}
headerbar.title_widget = box;
}
});
-64
View File
@@ -1,64 +0,0 @@
// SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const utils = Me.imports.utils;
const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var IconPreferences = GObject.registerClass({
GTypeName: 'IconPreferences',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'IconPreferences.ui'])}`,
InternalChildren: [
'enabled_switch',
'day_dropdown',
'night_dropdown',
],
Properties: {
settings: GObject.ParamSpec.object(
'settings',
'Settings',
'Icon GSettings',
GObject.ParamFlags.READWRITE,
Gio.Settings.$gtype
),
},
}, class IconPreferences extends Gtk.Box {
_init(props = {}) {
super._init(props);
this.settings = extensionUtils.getSettings(utils.getSettingsSchema('icon-variants'));
this.settings.bind(
'enabled',
this._enabled_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const themeChoices = Gio.ListStore.new(DropDownChoice);
themeChoices.splice(0, 0, Array.from(utils.getInstalledIconThemes()).sort().map(theme => new DropDownChoice({ id: theme, title: theme })));
this._day_dropdown.model = themeChoices;
this._day_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._day_dropdown.connect('notify::selected-item', () => this.settings.set_string('day', this._day_dropdown.selected_item.id));
const updateDayDropDownSelected = () => {
this._day_dropdown.selected = utils.findItemPositionInModel(this._day_dropdown.model, item => item.id === this.settings.get_string('day'));
};
this.settings.connect('changed::day', () => updateDayDropDownSelected());
updateDayDropDownSelected();
this._night_dropdown.model = themeChoices;
this._night_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._night_dropdown.connect('notify::selected-item', () => this.settings.set_string('night', this._night_dropdown.selected_item.id));
const updateNightDropDownSelected = () => {
this._night_dropdown.selected = utils.findItemPositionInModel(this._night_dropdown.model, item => item.id === this.settings.get_string('night'));
};
this.settings.connect('changed::night', () => updateNightDropDownSelected());
updateNightDropDownSelected();
}
});
-58
View File
@@ -1,58 +0,0 @@
// SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
var PreferenceRow = GObject.registerClass({
GTypeName: 'PreferenceRow',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'PreferenceRow.ui'])}`,
InternalChildren: ['subtitle_label', 'end_box'],
Properties: {
title: GObject.ParamSpec.string(
'title',
'Title',
'Title of the preference',
GObject.ParamFlags.READWRITE,
null
),
subtitle: GObject.ParamSpec.string(
'subtitle',
'Subtitle',
'Description of the preference',
GObject.ParamFlags.READWRITE,
null
),
activatable_widget: GObject.ParamSpec.object(
'activatable-widget',
'Activatable widget',
'The widget to activate when the row is activated',
GObject.ParamFlags.READWRITE,
Gtk.Widget.$gtype
),
},
}, class PreferenceRow extends Gtk.ListBoxRow {
activate() {
if (this.activatable_widget)
return this.activatable_widget.activate();
else
return false;
}
onSubtitleChanged(list) {
list._subtitle_label.visible = !!list.subtitle;
}
onActivatableWidgetChanged(list) {
while (list._end_box.get_last_child())
list._end_box.remove(list._end_box.get_last_child());
list.activatable = false;
if (list.activatable_widget) {
list._end_box.append(list.activatable_widget);
list.activatable = true;
}
}
});
-28
View File
@@ -1,28 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const { Appearance } = Me.imports.preferences.Appearance;
const { BackgroundButton } = Me.imports.preferences.BackgroundButton;
const { BackgroundsPreferences } = Me.imports.preferences.BackgroundsPreferences;
const { ClearableEntry } = Me.imports.preferences.ClearableEntry;
const { Commands } = Me.imports.preferences.Commands;
const { CursorPreferences } = Me.imports.preferences.CursorPreferences;
const { GtkPreferences } = Me.imports.preferences.GtkPreferences;
const { IconPreferences } = Me.imports.preferences.IconPreferences;
const { PreferenceRow } = Me.imports.preferences.PreferenceRow;
const { PreferencesList } = Me.imports.preferences.PreferencesList;
const { Schedule } = Me.imports.preferences.Schedule;
const { ShellPreferences } = Me.imports.preferences.ShellPreferences;
const { ShortcutButton } = Me.imports.preferences.ShortcutButton;
const { TimeChooser } = Me.imports.preferences.TimeChooser;
var Preferences = GObject.registerClass({
GTypeName: 'Preferences',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'Preferences.ui'])}`,
}, class Preferences extends Gtk.Stack {});
-17
View File
@@ -1,17 +0,0 @@
// SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
var PreferencesList = GObject.registerClass({
GTypeName: 'PreferencesList',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'PreferencesList.ui'])}`,
}, class PreferencesList extends Gtk.ListBox {
onRowActivated(_list, row) {
row.activate();
}
});
-147
View File
@@ -1,147 +0,0 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const _ = extensionUtils.gettext;
const utils = Me.imports.utils;
const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var Schedule = GObject.registerClass({
GTypeName: 'Schedule',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'Schedule.ui'])}`,
InternalChildren: [
'manual_time_source_switch',
'time_source_dropdown',
'always_show_ondemand_switch',
'nightlight_preferences_revealer',
'nightlight_follow_disable_switch',
'schedule_preferences_revealer',
'schedule_sunrise_time_chooser',
'schedule_sunset_time_chooser',
'ondemand_preferences_revealer',
'ondemand_shortcut_button',
'ondemand_button_location_combo',
],
Properties: {
settings: GObject.ParamSpec.object(
'settings',
'Settings',
'Time GSettings',
GObject.ParamFlags.READWRITE,
Gio.Settings.$gtype
),
},
}, class Schedule extends Gtk.ScrolledWindow {
_init(props = {}) {
super._init(props);
this.settings = extensionUtils.getSettings(utils.getSettingsSchema('time'));
this.settings.bind(
'manual-time-source',
this._manual_time_source_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const choiceFilter = new Gtk.BoolFilter({ expression: Gtk.PropertyExpression.new(DropDownChoice, null, 'enabled') });
const colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
const nightlightChoice = new DropDownChoice({ id: 'nightlight', title: _('Night Light') });
nightlightChoice.connect('notify::enabled', () => choiceFilter.changed(Gtk.FilterChange.DIFFERENT));
colorSettings.bind(
'night-light-enabled',
nightlightChoice,
'enabled',
Gio.SettingsBindFlags.GET
);
const locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
const locationChoice = new DropDownChoice({ id: 'location', title: _('Location Services') });
locationChoice.connect('notify::enabled', () => choiceFilter.changed(Gtk.FilterChange.DIFFERENT));
locationSettings.bind(
'enabled',
locationChoice,
'enabled',
Gio.SettingsBindFlags.GET
);
const timeSources = Gio.ListStore.new(DropDownChoice);
timeSources.splice(0, 0, [
nightlightChoice,
locationChoice,
new DropDownChoice({ id: 'schedule', title: _('Manual schedule') }),
new DropDownChoice({ id: 'ondemand', title: _('On-demand') }),
]);
this._time_source_dropdown.model = new Gtk.FilterListModel({
model: timeSources,
filter: choiceFilter,
});
this._time_source_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._time_source_dropdown.connect('notify::selected-item', () => this.settings.set_string('time-source', this._time_source_dropdown.selected_item.id));
const updateTimeSourceDropDownSelected = () => {
this._time_source_dropdown.selected = utils.findItemPositionInModel(this._time_source_dropdown.model, item => item.id === this.settings.get_string('time-source'));
};
this.settings.connect('changed::time-source', () => updateTimeSourceDropDownSelected());
updateTimeSourceDropDownSelected();
this.settings.bind(
'always-enable-ondemand',
this._always_show_ondemand_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'nightlight-follow-disable',
this._nightlight_follow_disable_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'schedule-sunrise',
this._schedule_sunrise_time_chooser,
'time',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'schedule-sunset',
this._schedule_sunset_time_chooser,
'time',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', () => {
this._ondemand_shortcut_button.keybinding = this.settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
});
this._ondemand_shortcut_button.connect('notify::keybinding', () => {
this.settings.set_strv('nightthemeswitcher-ondemand-keybinding', [this._ondemand_shortcut_button.keybinding]);
});
this._ondemand_shortcut_button.keybinding = this.settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
this.settings.bind(
'ondemand-button-placement',
this._ondemand_button_location_combo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
);
const updatePreferencesVisibility = () => {
const timeSource = this.settings.get_string('time-source');
this._nightlight_preferences_revealer.reveal_child = timeSource === 'nightlight';
this._schedule_preferences_revealer.reveal_child = timeSource === 'schedule';
this._ondemand_preferences_revealer.reveal_child = timeSource === 'ondemand' || this.settings.get_boolean('always-enable-ondemand');
};
this.settings.connect('changed::time-source', () => updatePreferencesVisibility());
this.settings.connect('changed::always-enable-ondemand', () => updatePreferencesVisibility());
updatePreferencesVisibility();
}
});
+111
View File
@@ -0,0 +1,111 @@
// SPDX-FileCopyrightText: 2020-2022 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Adw, Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const _ = extensionUtils.gettext;
const utils = Me.imports.utils;
const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var SchedulePage = GObject.registerClass({
GTypeName: 'SchedulePage',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'SchedulePage.ui'])}`,
InternalChildren: [
'manual_time_source_switch',
'time_source_combo_row',
'always_show_ondemand_switch',
'nightlight_follow_disable_switch',
'schedule_sunrise_time_chooser',
'schedule_sunset_time_chooser',
'ondemand_shortcut_button',
'ondemand_button_location_combo_row',
'nightlight_preferences_group',
'manual_schedule_preferences_group',
'ondemand_preferences_group',
],
}, class SchedulePage extends Adw.PreferencesPage {
_init(props = {}) {
super._init(props);
const settings = extensionUtils.getSettings(utils.getSettingsSchema('time'));
const colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
const locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
settings.bind('manual-time-source', this._manual_time_source_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
const choiceFilter = new Gtk.BoolFilter({ expression: Gtk.PropertyExpression.new(DropDownChoice, null, 'enabled') });
const nightlightChoice = new DropDownChoice({ id: 'nightlight', title: _('Night Light') });
nightlightChoice.connect('notify::enabled', () => choiceFilter.changed(Gtk.FilterChange.DIFFERENT));
colorSettings.bind('night-light-enabled', nightlightChoice, 'enabled', Gio.SettingsBindFlags.GET);
const locationChoice = new DropDownChoice({ id: 'location', title: _('Location Services') });
locationChoice.connect('notify::enabled', () => choiceFilter.changed(Gtk.FilterChange.DIFFERENT));
locationSettings.bind('enabled', locationChoice, 'enabled', Gio.SettingsBindFlags.GET);
const timeSources = Gio.ListStore.new(DropDownChoice);
timeSources.splice(0, 0, [
nightlightChoice,
locationChoice,
new DropDownChoice({ id: 'schedule', title: _('Manual schedule') }),
new DropDownChoice({ id: 'ondemand', title: _('On-demand') }),
]);
this._time_source_combo_row.model = new Gtk.FilterListModel({
model: timeSources,
filter: choiceFilter,
});
this._time_source_combo_row.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._time_source_combo_row.connect('notify::selected-item', () => settings.set_string('time-source', this._time_source_combo_row.selected_item.id));
const updateTimeSourceComboRowSelected = () => {
this._time_source_combo_row.selected = utils.findItemPositionInModel(this._time_source_combo_row.model, item => item.id === settings.get_string('time-source'));
};
settings.connect('changed::time-source', () => updateTimeSourceComboRowSelected());
updateTimeSourceComboRowSelected();
settings.bind('always-enable-ondemand', this._always_show_ondemand_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('nightlight-follow-disable', this._nightlight_follow_disable_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('schedule-sunrise', this._schedule_sunrise_time_chooser, 'time', Gio.SettingsBindFlags.DEFAULT);
settings.bind('schedule-sunset', this._schedule_sunset_time_chooser, 'time', Gio.SettingsBindFlags.DEFAULT);
settings.connect('changed::nightthemeswitcher-ondemand-keybinding', () => {
this._ondemand_shortcut_button.keybinding = settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
});
this._ondemand_shortcut_button.connect('notify::keybinding', () => {
settings.set_strv('nightthemeswitcher-ondemand-keybinding', [this._ondemand_shortcut_button.keybinding]);
});
this._ondemand_shortcut_button.keybinding = settings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
const ondemandButtonLocations = Gio.ListStore.new(DropDownChoice);
ondemandButtonLocations.splice(0, 0, [
new DropDownChoice({ id: 'none', title: _('None') }),
new DropDownChoice({ id: 'panel', title: _('Top bar') }),
new DropDownChoice({ id: 'menu', title: _('System menu') }),
]);
this._ondemand_button_location_combo_row.model = ondemandButtonLocations;
this._ondemand_button_location_combo_row.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._ondemand_button_location_combo_row.connect('notify::selected-item', () => settings.set_string('ondemand-button-placement', this._ondemand_button_location_combo_row.selected_item.id));
const updateOndemandButtonLocationComboRowSelected = () => {
this._ondemand_button_location_combo_row.selected = utils.findItemPositionInModel(this._ondemand_button_location_combo_row.model, item => item.id === settings.get_string('ondemand-button-placement'));
};
settings.connect('changed::ondemand-button-placement', () => updateOndemandButtonLocationComboRowSelected());
updateOndemandButtonLocationComboRowSelected();
const updateGroupsVisibility = () => {
const timeSource = settings.get_string('time-source');
this._nightlight_preferences_group.visible = timeSource === 'nightlight';
this._manual_schedule_preferences_group.visible = timeSource === 'schedule';
this._ondemand_preferences_group.visible = timeSource === 'ondemand' || settings.get_boolean('always-enable-ondemand');
};
settings.connect('changed::time-source', () => updateGroupsVisibility());
settings.connect('changed::always-enable-ondemand', () => updateGroupsVisibility());
updateGroupsVisibility();
}
});
-73
View File
@@ -1,73 +0,0 @@
// SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const _ = extensionUtils.gettext;
const utils = Me.imports.utils;
const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var ShellPreferences = GObject.registerClass({
GTypeName: 'ShellPreferences',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'ShellPreferences.ui'])}`,
InternalChildren: [
'enabled_switch',
'manual_switch',
'day_dropdown',
'night_dropdown',
],
Properties: {
settings: GObject.ParamSpec.object(
'settings',
'Settings',
'Shell GSettings',
GObject.ParamFlags.READWRITE,
Gio.Settings.$gtype
),
},
}, class ShellPreferences extends Gtk.Box {
_init(props = {}) {
super._init(props);
this.settings = extensionUtils.getSettings(utils.getSettingsSchema('shell-variants'));
this.settings.bind(
'enabled',
this._enabled_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
this.settings.bind(
'manual',
this._manual_switch,
'active',
Gio.SettingsBindFlags.DEFAULT
);
const themeChoices = Gio.ListStore.new(DropDownChoice);
themeChoices.splice(0, 0, Array.from(utils.getInstalledShellThemes()).sort().map(theme => new DropDownChoice({ id: theme, title: theme || _('Default') })));
this._day_dropdown.model = themeChoices;
this._day_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._day_dropdown.connect('notify::selected-item', () => this.settings.set_string('day', this._day_dropdown.selected_item.id));
const updateDayDropDownSelected = () => {
this._day_dropdown.selected = utils.findItemPositionInModel(this._day_dropdown.model, item => item.id === this.settings.get_string('day'));
};
this.settings.connect('changed::day', () => updateDayDropDownSelected());
updateDayDropDownSelected();
this._night_dropdown.model = themeChoices;
this._night_dropdown.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
this._night_dropdown.connect('notify::selected-item', () => this.settings.set_string('night', this._night_dropdown.selected_item.id));
const updateNightDropDownSelected = () => {
this._night_dropdown.selected = utils.findItemPositionInModel(this._night_dropdown.model, item => item.id === this.settings.get_string('night'));
};
this.settings.connect('changed::night', () => updateNightDropDownSelected());
updateNightDropDownSelected();
}
});
+5 -1
View File
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-FileCopyrightText: 2021, 2022 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Gdk, GLib, GObject, Gtk } = imports.gi;
@@ -23,6 +23,10 @@ var ShortcutButton = GObject.registerClass({
),
},
}, class ShortcutButton extends Gtk.Stack {
vfunc_mnemonic_activate() {
this.activate();
}
activate() {
if (this.keybinding)
return this._change_button.activate();
+87
View File
@@ -0,0 +1,87 @@
// SPDX-FileCopyrightText: 2020-2022 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
const { Adw, Gio, GLib, GObject, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const _ = extensionUtils.gettext;
const utils = Me.imports.utils;
const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var ThemesPage = GObject.registerClass({
GTypeName: 'ThemesPage',
Template: `file://${GLib.build_filenamev([Me.path, 'preferences', 'ui', 'ThemesPage.ui'])}`,
InternalChildren: [
'gtk_enabled_switch',
'gtk_day_variant_combo_row',
'gtk_night_variant_combo_row',
'shell_enabled_switch',
'shell_day_variant_combo_row',
'shell_night_variant_combo_row',
'icon_enabled_switch',
'icon_day_variant_combo_row',
'icon_night_variant_combo_row',
'cursor_enabled_switch',
'cursor_day_variant_combo_row',
'cursor_night_variant_combo_row',
],
}, class ThemesPage extends Adw.PreferencesPage {
_init(props = {}) {
super._init(props);
const gtkSettings = extensionUtils.getSettings(utils.getSettingsSchema('gtk-variants'));
const shellSettings = extensionUtils.getSettings(utils.getSettingsSchema('shell-variants'));
const iconSettings = extensionUtils.getSettings(utils.getSettingsSchema('icon-variants'));
const cursorSettings = extensionUtils.getSettings(utils.getSettingsSchema('cursor-variants'));
gtkSettings.bind('enabled', this._gtk_enabled_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
const gtkThemesStore = Gio.ListStore.new(DropDownChoice);
gtkThemesStore.splice(0, 0, Array.from(utils.getInstalledGtkThemes()).sort().map(theme => new DropDownChoice({ id: theme, title: theme })));
_setupComboRow(this._gtk_day_variant_combo_row, gtkThemesStore, gtkSettings, 'day');
_setupComboRow(this._gtk_night_variant_combo_row, gtkThemesStore, gtkSettings, 'night');
shellSettings.bind('enabled', this._shell_enabled_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
const shellThemesStore = Gio.ListStore.new(DropDownChoice);
shellThemesStore.splice(0, 0, Array.from(utils.getInstalledShellThemes()).sort().map(theme => new DropDownChoice({ id: theme, title: theme || _('Default') })));
_setupComboRow(this._shell_day_variant_combo_row, shellThemesStore, shellSettings, 'day');
_setupComboRow(this._shell_night_variant_combo_row, shellThemesStore, shellSettings, 'night');
iconSettings.bind('enabled', this._icon_enabled_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
const iconThemesStore = Gio.ListStore.new(DropDownChoice);
iconThemesStore.splice(0, 0, Array.from(utils.getInstalledIconThemes()).sort().map(theme => new DropDownChoice({ id: theme, title: theme })));
_setupComboRow(this._icon_day_variant_combo_row, iconThemesStore, iconSettings, 'day');
_setupComboRow(this._icon_night_variant_combo_row, iconThemesStore, iconSettings, 'night');
cursorSettings.bind('enabled', this._cursor_enabled_switch, 'active', Gio.SettingsBindFlags.DEFAULT);
const cursorThemesStore = Gio.ListStore.new(DropDownChoice);
cursorThemesStore.splice(0, 0, Array.from(utils.getInstalledCursorThemes()).sort().map(theme => new DropDownChoice({ id: theme, title: theme })));
_setupComboRow(this._cursor_day_variant_combo_row, cursorThemesStore, cursorSettings, 'day');
_setupComboRow(this._cursor_night_variant_combo_row, cursorThemesStore, cursorSettings, 'night');
}
});
/**
* Set up the model of a combo row.
*
* @param {Adw.ComboRow} row The row to set up.
* @param {Gio.ListModel} model A list model of DropDownChoice.
* @param {Gio.Settings} settings The settings to connect.
* @param {str} key The key to update.
*/
function _setupComboRow(row, model, settings, key) {
row.model = model;
row.expression = Gtk.PropertyExpression.new(DropDownChoice, null, 'title');
row.connect('notify::selected-item', () => settings.set_string(key, row.selected_item.id));
const updateComboRowSelected = () => {
row.selected = utils.findItemPositionInModel(row.model, item => item.id === settings.get_string(key));
};
settings.connect(`changed::${key}`, () => updateComboRowSelected());
updateComboRowSelected();
}
-42
View File
@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="Appearance" parent="GtkScrolledWindow">
<property name="propagate-natural-height">True</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkViewport">
<property name="scroll-to-focus">True</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="width-request">600</property>
<property name="halign">center</property>
<property name="margin-start">36</property>
<property name="margin-end">36</property>
<property name="margin-top">36</property>
<property name="margin-bottom">36</property>
<child>
<object class="GtkPreferences"/>
</child>
<child>
<object class="ShellPreferences"/>
</child>
<child>
<object class="IconPreferences"/>
</child>
<child>
<object class="CursorPreferences"/>
</child>
<child>
<object class="BackgroundsPreferences"/>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021, 2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="BackgroundsPage" parent="AdwPreferencesPage">
<property name="name">backgrounds</property>
<property name="title" translatable="yes">Backgrounds</property>
<property name="icon-name">nightthemeswitcher-backgrounds-symbolic</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Day background</property>
<property name="activatable-widget">day_button</property>
<child>
<object class="BackgroundButton" id="day_button">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Night background</property>
<property name="activatable-widget">night_button</property>
<child>
<object class="BackgroundButton" id="night_button">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021, 2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="BackgroundsPreferences" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Switch backgrounds</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Day background</property>
<property name="activatable-widget">
<object class="BackgroundButton" id="day_button"/>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Night background</property>
<property name="activatable-widget">
<object class="BackgroundButton" id="night_button"/>
</property>
</object>
</child>
</object>
</child>
</template>
</interface>
-88
View File
@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="Commands" parent="GtkScrolledWindow">
<property name="propagate-natural-height">True</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkViewport">
<property name="scroll-to-focus">True</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="width-request">600</property>
<property name="halign">center</property>
<property name="margin-start">36</property>
<property name="margin-end">36</property>
<property name="margin-top">36</property>
<property name="margin-bottom">36</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Run commands</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkSwitch" id="enabled_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="enabled_switch" bind-property="active" bind-flags="sync-create"/>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Sunrise</property>
<property name="activatable-widget">
<object class="ClearableEntry" id="sunrise_entry">
<property name="placeholder-text" translatable="yes" comments="Don't translate the `notify-send` command.">notify-send "Hello sunshine!"</property>
<property name="input-purpose">terminal</property>
<property name="width-chars">28</property>
</object>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Sunset</property>
<property name="activatable-widget">
<object class="ClearableEntry" id="sunset_entry">
<property name="placeholder-text" translatable="yes" comments="Don't translate the `notify-send` command.">notify-send "Hello moonshine!"</property>
<property name="input-purpose">terminal</property>
<property name="width-chars">28</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
+50
View File
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021, 2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="CommandsPage" parent="AdwPreferencesPage">
<property name="name">commands</property>
<property name="title" translatable="yes">Commands</property>
<property name="icon-name">nightthemeswitcher-commands-symbolic</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Run commands</property>
<property name="header-suffix">
<object class="GtkSwitch" id="enabled_switch">
<property name="valign">center</property>
</object>
</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Sunrise</property>
<property name="activatable-widget">sunrise_entry</property>
<child>
<object class="ClearableEntry" id="sunrise_entry">
<property name="placeholder-text" translatable="yes" comments="Don't translate the `notify-send` command.">notify-send "Hello sunshine!"</property>
<property name="input-purpose">terminal</property>
<property name="width-chars">28</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Sunset</property>
<property name="activatable-widget">sunset_entry</property>
<child>
<object class="ClearableEntry" id="sunset_entry">
<property name="placeholder-text" translatable="yes" comments="Don't translate the `notify-send` command.">notify-send "Hello sunshine!"</property>
<property name="input-purpose">terminal</property>
<property name="width-chars">28</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
+55
View File
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="ContributePage" parent="AdwPreferencesPage">
<property name="name">contribute</property>
<property name="title" translatable="yes">Contribute</property>
<property name="icon-name">nightthemeswitcher-contribute-symbolic</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">View the code and report issues</property>
<property name="icon-name">nightthemeswitcher-code-symbolic</property>
<property name="activatable-widget">gitlab_button</property>
<child>
<object class="GtkLinkButton" id="gitlab_button">
<property name="label">GitLab</property>
<property name="uri">https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Contribute to the translation</property>
<property name="icon-name">nightthemeswitcher-translate-symbolic</property>
<property name="activatable-widget">weblate_button</property>
<child>
<object class="GtkLinkButton" id="weblate_button">
<property name="label">Weblate</property>
<property name="uri">https://hosted.weblate.org/engage/night-theme-switcher/</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Support me with a donation</property>
<property name="icon-name">nightthemeswitcher-support-symbolic</property>
<property name="activatable-widget">liberapay_button</property>
<child>
<object class="GtkLinkButton" id="liberapay_button">
<property name="label">Liberapay</property>
<property name="uri">https://liberapay.com/rmnvgr/donate</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
-62
View File
@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="CursorPreferences" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Switch cursor theme variants</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkSwitch" id="enabled_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="enabled_switch" bind-property="active" bind-flags="sync-create"/>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Day variant</property>
<property name="activatable-widget">
<object class="GtkDropDown" id="day_dropdown">
<property name="enable-search">True</property>
</object>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Night variant</property>
<property name="activatable-widget">
<object class="GtkDropDown" id="night_dropdown">
<property name="enable-search">True</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
-73
View File
@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="GtkPreferences" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Switch GTK theme variants</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkSwitch" id="enabled_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="enabled_switch" bind-property="active" bind-flags="sync-create"/>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Manual variants</property>
<property name="subtitle" translatable="yes"><![CDATA[You can manually set variants if the extension cannot automatically detect the day and night variants of your GTK theme. Please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a> to get your theme supported.]]></property>
<property name="activatable-widget">
<object class="GtkSwitch" id="manual_switch"/>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Day variant</property>
<property name="sensitive" bind-source="manual_switch" bind-property="active" bind-flags="sync-create"/>
<property name="activatable-widget">
<object class="GtkDropDown" id="day_dropdown">
<property name="enable-search">True</property>
</object>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Night variant</property>
<property name="sensitive" bind-source="manual_switch" bind-property="active" bind-flags="sync-create"/>
<property name="activatable-widget">
<object class="GtkDropDown" id="night_dropdown">
<property name="enable-search">True</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
-108
View File
@@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="Headerbar" parent="GtkHeaderBar">
<signal name="notify::preferences" handler="onPreferencesChanged" swapped="no"/>
<child type="start">
<object class="GtkMenuButton">
<property name="icon-name">face-smile-big-symbolic</property>
<property name="tooltip-text" translatable="yes">Support us</property>
<property name="popover">
<object class="GtkPopover">
<style>
<class name="support"/>
</style>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Support us</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkLinkButton">
<property name="uri">https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension</property>
<style>
<class name="gitlab"/>
</style>
<child>
<object class="GtkCenterBox">
<child type="start">
<object class="GtkImage">
<property name="icon-name">nightthemeswitcher-code-symbolic</property>
<property name="margin-end">12</property>
</object>
</child>
<child type="center">
<object class="GtkLabel">
<property name="label" translatable="yes">View code on GitLab</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLinkButton">
<property name="uri">https://hosted.weblate.org/engage/night-theme-switcher/</property>
<style>
<class name="weblate"/>
</style>
<child>
<object class="GtkCenterBox">
<child type="start">
<object class="GtkImage">
<property name="icon-name">nightthemeswitcher-translate-symbolic</property>
<property name="margin-end">12</property>
</object>
</child>
<child type="center">
<object class="GtkLabel">
<property name="label" translatable="yes">Translate on Weblate</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLinkButton">
<property name="uri">https://liberapay.com/rmnvgr/donate</property>
<style>
<class name="liberapay"/>
</style>
<child>
<object class="GtkCenterBox">
<child type="start">
<object class="GtkImage">
<property name="icon-name">nightthemeswitcher-support-symbolic</property>
<property name="margin-end">12</property>
</object>
</child>
<child type="center">
<object class="GtkLabel">
<property name="label" translatable="yes">Donate on Liberapay</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
</template>
</interface>
-62
View File
@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="IconPreferences" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Switch icon theme variants</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkSwitch" id="enabled_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="enabled_switch" bind-property="active" bind-flags="sync-create"/>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Day variant</property>
<property name="activatable-widget">
<object class="GtkDropDown" id="day_dropdown">
<property name="enable-search">True</property>
</object>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Night variant</property>
<property name="activatable-widget">
<object class="GtkDropDown" id="night_dropdown">
<property name="enable-search">True</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
-56
View File
@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="PreferenceRow" parent="GtkListBoxRow">
<property name="activatable">False</property>
<signal name="notify::subtitle" handler="onSubtitleChanged" swapped="no"/>
<signal name="notify::activatable-widget" handler="onActivatableWidgetChanged" swapped="no"/>
<property name="child">
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="spacing">72</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="spacing">4</property>
<child>
<object class="GtkLabel">
<property name="label" bind-source="PreferenceRow" bind-property="title"/>
<property name="use-markup">True</property>
<property name="xalign">0</property>
</object>
</child>
<child>
<object class="GtkLabel" id="subtitle_label">
<property name="visible">False</property>
<property name="label" bind-source="PreferenceRow" bind-property="subtitle"/>
<property name="use-markup">True</property>
<property name="wrap">True</property>
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
<class name="caption"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="end_box">
<property name="valign">center</property>
</object>
</child>
</object>
</property>
</template>
</interface>
-42
View File
@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="Preferences" parent="GtkStack">
<property name="interpolate-size">True</property>
<property name="vhomogeneous">True</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkStackPage">
<property name="name">schedule</property>
<property name="title" translatable="yes">Schedule</property>
<property name="icon-name">nightthemeswitcher-schedule-symbolic</property>
<property name="child">
<object class="Schedule"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">appearance</property>
<property name="title" translatable="yes">Appearance</property>
<property name="icon-name">nightthemeswitcher-appearance-symbolic</property>
<property name="child">
<object class="Appearance"/>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">commands</property>
<property name="title" translatable="yes">Commands</property>
<property name="icon-name">nightthemeswitcher-commands-symbolic</property>
<property name="child">
<object class="Commands"/>
</property>
</object>
</child>
</template>
</interface>
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="PreferencesList" parent="GtkListBox">
<signal name="row-activated" handler="onRowActivated" swapped="no"/>
<property name="show-separators">True</property>
<property name="selection-mode">none</property>
<property name="activate-on-single-click">True</property>
<style>
<class name="rich-list"/>
<class name="frame"/>
</style>
</template>
</interface>
-179
View File
@@ -1,179 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="Schedule" parent="GtkScrolledWindow">
<property name="propagate-natural-height">True</property>
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkViewport">
<property name="scroll-to-focus">True</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="width-request">600</property>
<property name="halign">center</property>
<property name="margin-start">36</property>
<property name="margin-end">36</property>
<property name="margin-top">36</property>
<property name="margin-bottom">36</property>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Manual time source</property>
<property name="subtitle" translatable="yes">The extension will try to use Night Light or Location Services to automatically set your current sunrise and sunset times if they are enabled. If you prefer, you can manually choose a time source.</property>
<property name="activatable-widget">
<object class="GtkSwitch" id="manual_time_source_switch"/>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Time source</property>
<property name="sensitive" bind-source="manual_time_source_switch" bind-property="active" bind-flags="sync-create"/>
<property name="activatable-widget">
<object class="GtkDropDown" id="time_source_dropdown"/>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Always show on-demand controls</property>
<property name="subtitle" translatable="yes">Allows you to override the current time when using a schedule.</property>
<property name="activatable-widget">
<object class="GtkSwitch" id="always_show_ondemand_switch"/>
</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer" id="nightlight_preferences_revealer">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Night Light</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes"><![CDATA[Follow <i>Disable until tomorrow</i>]]></property>
<property name="subtitle" translatable="yes">When Night Light is temporarily disabled, the extension will switch to day variants.</property>
<property name="activatable-widget">
<object class="GtkSwitch" id="nightlight_follow_disable_switch"/>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer" id="schedule_preferences_revealer">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Manual schedule times</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Sunrise</property>
<property name="activatable-widget">
<object class="TimeChooser" id="schedule_sunrise_time_chooser"/>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Sunset</property>
<property name="activatable-widget">
<object class="TimeChooser" id="schedule_sunset_time_chooser"/>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer" id="ondemand_preferences_revealer">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">On-demand</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Keyboard shortcut</property>
<property name="activatable-widget">
<object class="ShortcutButton" id="ondemand_shortcut_button"/>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Button location</property>
<property name="activatable-widget">
<object class="GtkComboBoxText" id="ondemand_button_location_combo">
<property name="active-id">panel</property>
<items>
<item id="none" translatable="yes">None</item>
<item id="panel" translatable="yes">Top bar</item>
<item id="menu" translatable="yes">System menu</item>
</items>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
+113
View File
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021, 2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="SchedulePage" parent="AdwPreferencesPage">
<property name="name">schedule</property>
<property name="title" translatable="yes">Schedule</property>
<property name="icon-name">nightthemeswitcher-schedule-symbolic</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Manual time source</property>
<property name="subtitle" translatable="yes">The extension will try to use Night Light or Location Services to automatically set your current sunrise and sunset times if they are enabled. If you prefer, you can manually choose a time source.</property>
<property name="activatable-widget">manual_time_source_switch</property>
<child>
<object class="GtkSwitch" id="manual_time_source_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwComboRow" id="time_source_combo_row">
<property name="title" translatable="yes">Time source</property>
<property name="sensitive" bind-source="manual_time_source_switch" bind-property="active" bind-flags="sync-create"/>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Always show on-demand controls</property>
<property name="subtitle" translatable="yes">Allows you to override the current time when using a schedule.</property>
<property name="activatable-widget">always_show_ondemand_switch</property>
<child>
<object class="GtkSwitch" id="always_show_ondemand_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="nightlight_preferences_group">
<property name="title" translatable="yes">Night Light</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes"><![CDATA[Follow <i>Disable until tomorrow</i>]]></property>
<property name="subtitle" translatable="yes">When Night Light is temporarily disabled, the extension will switch to day variants.</property>
<property name="activatable-widget">nightlight_follow_disable_switch</property>
<child>
<object class="GtkSwitch" id="nightlight_follow_disable_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="manual_schedule_preferences_group">
<property name="title" translatable="yes">Manual schedule times</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Sunrise</property>
<child>
<object class="TimeChooser" id="schedule_sunrise_time_chooser">
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Sunset</property>
<child>
<object class="TimeChooser" id="schedule_sunset_time_chooser">
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="ondemand_preferences_group">
<property name="title" translatable="yes">On-demand</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Keyboard shortcut</property>
<property name="activatable-widget">ondemand_shortcut_button</property>
<child>
<object class="ShortcutButton" id="ondemand_shortcut_button">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwComboRow" id="ondemand_button_location_combo_row">
<property name="title" translatable="yes">Button location</property>
</object>
</child>
</object>
</child>
</template>
</interface>
-73
View File
@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="ShellPreferences" parent="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Switch Shell theme variants</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkSwitch" id="enabled_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="enabled_switch" bind-property="active" bind-flags="sync-create"/>
<child>
<object class="PreferencesList">
<property name="margin-bottom">36</property>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Manual variants</property>
<property name="subtitle" translatable="yes"><![CDATA[You can manually set variants if the extension cannot automatically detect the day and night variants of your GNOME Shell theme. Please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a> to get your theme supported.]]></property>
<property name="activatable-widget">
<object class="GtkSwitch" id="manual_switch"/>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Day variant</property>
<property name="sensitive" bind-source="manual_switch" bind-property="active" bind-flags="sync-create"/>
<property name="activatable-widget">
<object class="GtkDropDown" id="day_dropdown">
<property name="enable-search">True</property>
</object>
</property>
</object>
</child>
<child>
<object class="PreferenceRow">
<property name="title" translatable="yes">Night variant</property>
<property name="sensitive" bind-source="manual_switch" bind-property="active" bind-flags="sync-create"/>
<property name="activatable-widget">
<object class="GtkDropDown" id="night_dropdown">
<property name="enable-search">True</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
+18 -40
View File
@@ -54,63 +54,41 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
</template>
<object class="GtkWindow" id="dialog">
<object class="AdwWindow" id="dialog">
<property name="modal">True</property>
<property name="default_width">440</property>
<property name="default_height">200</property>
<property name="default-width">440</property>
<property name="hide-on-close">True</property>
<property name="decorated">False</property>
<style>
<class name="toolbox"/>
</style>
<child>
<property name="content">
<object class="GtkWindowHandle">
<property name="vexpand">True</property>
<property name="hexpand">True</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkCenterBox">
<object class="AdwHeaderBar">
<property name="title-widget">
<object class="GtkBox"/>
</property>
<property name="valign">start</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<child type="start">
<object class="GtkWindowControls">
<property name="side">start</property>
</object>
</child>
<child type="end">
<object class="GtkWindowControls">
<property name="side">end</property>
</object>
</child>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="vexpand">True</property>
<property name="hexpand">True</property>
<property name="margin-start">36</property>
<property name="margin-end">36</property>
<property name="margin-top">36</property>
<property name="margin-bottom">36</property>
<property name="label" translatable="yes">Press your keyboard shortcut…</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<style>
<class name="large-title"/>
</style>
</object>
</child>
<object class="AdwStatusPage">
<property name="title" translatable="yes">Press your keyboard shortcut…</property>
<property name="icon-name">preferences-desktop-keyboard-shortcuts-symbolic</property>
<property name="vexpand">true</property>
<style>
<class name="compact"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</property>
<child>
<object class="GtkEventControllerKey">
<signal name="key-pressed" handler="onKeyPressed" swapped="no"/>
+93
View File
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2021, 2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<interface domain="nightthemeswitcher@romainvigier.fr">
<template class="ThemesPage" parent="AdwPreferencesPage">
<property name="name">themes</property>
<property name="title" translatable="yes">Themes</property>
<property name="icon-name">nightthemeswitcher-themes-symbolic</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">GTK theme</property>
<property name="description" translatable="yes">Forcing a dark theme on applications not designed to support it can have undesirable side-effects such as unreadable text or invisible icons.</property>
<property name="header-suffix">
<object class="GtkSwitch" id="gtk_enabled_switch">
<property name="valign">center</property>
</object>
</property>
<child>
<object class="AdwComboRow" id="gtk_day_variant_combo_row">
<property name="title" translatable="yes">Day variant</property>
</object>
</child>
<child>
<object class="AdwComboRow" id="gtk_night_variant_combo_row">
<property name="title" translatable="yes">Night variant</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Shell theme</property>
<property name="header-suffix">
<object class="GtkSwitch" id="shell_enabled_switch">
<property name="valign">center</property>
</object>
</property>
<child>
<object class="AdwComboRow" id="shell_day_variant_combo_row">
<property name="title" translatable="yes">Day variant</property>
</object>
</child>
<child>
<object class="AdwComboRow" id="shell_night_variant_combo_row">
<property name="title" translatable="yes">Night variant</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Icon theme</property>
<property name="header-suffix">
<object class="GtkSwitch" id="icon_enabled_switch">
<property name="valign">center</property>
</object>
</property>
<child>
<object class="AdwComboRow" id="icon_day_variant_combo_row">
<property name="title" translatable="yes">Day variant</property>
</object>
</child>
<child>
<object class="AdwComboRow" id="icon_night_variant_combo_row">
<property name="title" translatable="yes">Night variant</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Cursor theme</property>
<property name="header-suffix">
<object class="GtkSwitch" id="cursor_enabled_switch">
<property name="valign">center</property>
</object>
</property>
<child>
<object class="AdwComboRow" id="cursor_day_variant_combo_row">
<property name="title" translatable="yes">Day variant</property>
</object>
</child>
<child>
<object class="AdwComboRow" id="cursor_night_variant_combo_row">
<property name="title" translatable="yes">Night variant</property>
</object>
</child>
</object>
</child>
</template>
</interface>
-104
View File
@@ -1,104 +0,0 @@
/*
SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
*/
window.nightthemeswitcher,
window.toolbox
{
border-radius: 8px;
}
window.nightthemeswitcher headerbar
{
background: #000;
color: alpha(#fff, 0.9);
border: none;
}
window.nightthemeswitcher headerbar button
{
background: alpha(#fff, 0.2);
color: inherit;
border: none;
font-weight: bold;
transition: all 200ms;
}
window.nightthemeswitcher headerbar button.close
{
background: none;
}
window.nightthemeswitcher headerbar button:hover
{
background: alpha(#fff, 0.3);
}
window.nightthemeswitcher headerbar button:active
{
background: alpha(#fff, 0.4);
}
window.nightthemeswitcher headerbar button:checked
{
background: alpha(#fff, 0.1);
}
window.nightthemeswitcher headerbar .linked button.toggle
{
border-right: 1px solid alpha(#000, 0.4);
}
window.nightthemeswitcher headerbar .linked button.toggle:last-child
{
border-right: none;
}
window.nightthemeswitcher list.frame
{
border-radius: 8px;
}
window.nightthemeswitcher list.frame row:last-child
{
border-bottom: none;
}
window.nightthemeswitcher .support button
{
margin: 0;
}
window.nightthemeswitcher .support button.gitlab
{
background-color: rgba(250, 112, 53, 1);
color: #fff;
}
window.nightthemeswitcher .support button.gitlab:hover
{
background-color: rgba(250, 112, 53, 1);
}
window.nightthemeswitcher .support button.liberapay
{
background-color: rgba(246, 201, 21, 0.8);
color: #1a171b;
}
window.nightthemeswitcher .support button.liberapay:hover
{
background-color: rgba(246, 201, 21, 1);
}
window.nightthemeswitcher .support button.weblate
{
background-color: rgba(46, 204, 170, 0.8);
color: #fff;
}
window.nightthemeswitcher .support button.weblate:hover
{
background-color: rgba(46, 204, 170, 1);
}
+25 -18
View File
@@ -1,15 +1,24 @@
// SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr>
// SPDX-FileCopyrightText: 2020-2022 Romain Vigier <contact AT romainvigier.fr>
// SPDX-License-Identifier: GPL-3.0-or-later
'use strict';
const { Gdk, GLib, Gtk } = imports.gi;
const { Adw, Gdk, GLib, Gtk } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
const _ = extensionUtils.gettext;
const { Headerbar } = Me.imports.preferences.Headerbar;
const { Preferences } = Me.imports.preferences.Preferences;
const { BackgroundsPage } = Me.imports.preferences.BackgroundsPage;
const { CommandsPage } = Me.imports.preferences.CommandsPage;
const { ContributePage } = Me.imports.preferences.ContributePage;
const { SchedulePage } = Me.imports.preferences.SchedulePage;
const { ThemesPage } = Me.imports.preferences.ThemesPage;
const { BackgroundButton } = Me.imports.preferences.BackgroundButton;
const { ClearableEntry } = Me.imports.preferences.ClearableEntry;
const { ShortcutButton } = Me.imports.preferences.ShortcutButton;
const { TimeChooser } = Me.imports.preferences.TimeChooser;
/**
@@ -20,22 +29,20 @@ function init() {
const iconTheme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
iconTheme.add_search_path(GLib.build_filenamev([Me.path, 'icons']));
const styleProvider = new Gtk.CssProvider();
styleProvider.load_from_path(GLib.build_filenamev([Me.path, 'preferences', 'ui', 'style.css']));
Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(), styleProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
}
/**
* Build the preferences widget.
* Fill the PreferencesWindow.
*
* @param {Adw.PreferencesWindow} window The PreferencesWindow to fill.
*/
function buildPrefsWidget() {
const preferences = new Preferences();
preferences.connect('notify::root', () => {
const window = preferences.get_root();
window.add_css_class('nightthemeswitcher');
const headerbar = new Headerbar({ preferences });
window.set_titlebar(headerbar);
});
return preferences;
function fillPreferencesWindow(window) {
[
new SchedulePage(),
new BackgroundsPage(),
new CommandsPage(),
new ThemesPage(),
new ContributePage(),
].forEach(page => window.add(page));
window.search_enabled = true;
}