Add options for on-demand button placement

This commit is contained in:
Romain
2020-08-06 06:35:21 +00:00
parent 632e5db4dc
commit 6ff6df8248
8 changed files with 332 additions and 132 deletions
+11
View File
@@ -65,6 +65,7 @@ var SettingsManager = class {
this._timeSourceChangedConnect = this._extensionsSettings.connect('changed::time-source', this._onTimeSourceChanged.bind(this));
this._manualTimeSourceChangedConnect = this._extensionsSettings.connect('changed::manual-time-source', this._onManualTimeSourceChanged.bind(this));
this._ondemandKeybindingChangedConnect = this._extensionsSettings.connect('changed::nightthemeswitcher-ondemand-keybinding', this._onOndemandKeybindingChanged.bind(this));
this._ondemandButtonPlacementChangedConnect = this._extensionsSettings.connect('changed::ondemand-button-placement', this._onOndemandButtonPlacementChanged.bind(this));
this._commandsStatusConnect = this._extensionsSettings.connect('changed::commands-enabled', this._onCommandsStatusChanged.bind(this));
this._backgroundsStatusConnect = this._extensionsSettings.connect('changed::backgrounds-enabled', this._onBackgroundsStatusChanged.bind(this));
this._backgroundDayChangedConnect = this._extensionsSettings.connect('changed::background-day', this._onBackgroundDayChanged.bind(this));
@@ -101,6 +102,7 @@ var SettingsManager = class {
this._extensionsSettings.disconnect(this._timeSourceChangedConnect);
this._extensionsSettings.disconnect(this._manualTimeSourceChangedConnect);
this._extensionsSettings.disconnect(this._ondemandKeybindingChangedConnect);
this._extensionsSettings.disconnect(this._ondemandButtonPlacementChangedConnect);
this._extensionsSettings.disconnect(this._commandsStatusConnect);
this._extensionsSettings.disconnect(this._backgroundsStatusConnect);
this._extensionsSettings.disconnect(this._backgroundDayChangedConnect);
@@ -318,6 +320,10 @@ var SettingsManager = class {
return this._extensionsSettings.get_strv('nightthemeswitcher-ondemand-keybinding')[0];
}
get ondemandButtonPlacement() {
return this._extensionsSettings.get_string('ondemand-button-placement');
}
get scheduleSunrise() {
return this._extensionsSettings.get_double('schedule-sunrise');
}
@@ -568,6 +574,11 @@ var SettingsManager = class {
this.emit('ondemand-keybinding-changed', this.ondemandKeybinding);
}
_onOndemandButtonPlacementChanged(_settings, _changedKey) {
logDebug(`On-demand button placement has changed to ${this.ondemandButtonPlacement}`);
this.emit('ondemand-button-placement-changed', this.ondemandButtonPlacement);
}
/* Commands */
+64 -29
View File
@@ -20,14 +20,17 @@ const { Shell, St } = imports.gi;
const { extensionUtils } = imports.misc;
const Signals = imports.signals;
const { main, panelMenu } = imports.ui;
const { main, panelMenu: PanelMenu, popupMenu: PopupMenu } = imports.ui;
const Me = extensionUtils.getCurrentExtension();
const e = Me.imports.extension;
const { logDebug } = Me.imports.utils;
const { logDebug, findShellAggregateMenuItemPosition } = Me.imports.utils;
const { keyBindingAutoRepeat, getActor } = Me.imports.compat;
const Gettext = imports.gettext.domain(Me.metadata.uuid);
const _ = Gettext.gettext;
/**
* The On-demand Timer allows the user to manually switch between the day and
* night variants with a button in the top bar and a keybinding.
@@ -38,8 +41,8 @@ var TimerOndemand = class {
constructor() {
this._button = null;
this._icon = null;
this._ondemandKeybindingConnect = null;
this._ondemandButtonPlacementConnect = null;
}
enable() {
@@ -68,6 +71,7 @@ var TimerOndemand = class {
_connectSettings() {
logDebug('Connecting On-demand Timer to settings...');
this._ondemandKeybindingConnect = e.settingsManager.connect('ondemand-keybinding-changed', this._onOndemandKeybindingChanged.bind(this));
this._ondemandButtonPlacementConnect = e.settingsManager.connect('ondemand-button-placement-changed', this._onOndemandButtonPlacementChanged.bind(this));
}
_disconnectSettings() {
@@ -76,6 +80,10 @@ var TimerOndemand = class {
e.settingsManager.disconnect(this._ondemandKeybindingConnect);
this._ondemandKeybindingConnect = null;
}
if (this._ondemandButtonPlacementConnect) {
e.settingsManager.disconnect(this._ondemandButtonPlacementConnect);
this._ondemandButtonPlacementConnect = null;
}
}
@@ -84,6 +92,11 @@ var TimerOndemand = class {
this._addKeybinding();
}
_onOndemandButtonPlacementChanged(_settings, _placement) {
this._removeButton();
this._addButton();
}
_addKeybinding() {
if (!e.settingsManager.ondemandKeybinding)
@@ -106,40 +119,62 @@ var TimerOndemand = class {
}
_addButton() {
logDebug('Adding On-demand Timer button...');
this._icon = new St.Icon({
icon_name: this._getIconNameForCurrentTime(),
style_class: 'system-status-icon',
});
this._button = new panelMenu.Button(0.0);
const buttonActor = getActor(this._button);
buttonActor.add_actor(this._icon);
buttonActor.connect(
'button-press-event',
this._toggleTime.bind(this)
);
main.panel.addToStatusArea('NightThemeSwitcherButton', this._button);
logDebug('Added On-demand Timer button.');
switch (e.settingsManager.ondemandButtonPlacement) {
case 'panel':
this._addButtonToPanel();
break;
case 'menu':
this._addButtonToMenu();
break;
}
}
_removeButton() {
logDebug('Removing On-demand Timer button...');
this._button.destroy();
logDebug('Removed On-demand Timer button.');
if (this._button) {
logDebug('Removing On-demand Timer button...');
this._button.destroy();
this._button = null;
logDebug('Removed On-demand Timer button.');
}
}
_addButtonToPanel() {
logDebug('Adding On-demand Timer button to the panel...');
const getIconNameForCurrentTime = () => e.timer.time === 'day' ? 'weather-clear-symbolic' : 'weather-clear-night-symbolic';
const icon = new St.Icon({
icon_name: getIconNameForCurrentTime(),
style_class: 'system-status-icon',
});
this._button = new PanelMenu.Button(0.0);
const buttonActor = getActor(this._button);
buttonActor.add_actor(icon);
buttonActor.connect('button-press-event', () => {
this._toggleTime();
icon.icon_name = getIconNameForCurrentTime();
});
main.panel.addToStatusArea('NightThemeSwitcherButton', this._button);
logDebug('Added On-demand Timer button to the panel.');
}
_addButtonToMenu() {
logDebug('Adding On-demand Timer button to the menu...');
const aggregateMenu = main.panel.statusArea.aggregateMenu;
const position = findShellAggregateMenuItemPosition(aggregateMenu._system.menu) - 1;
const getLabelForCurrentTime = () => e.timer.time === 'day' ? _('Switch to night theme') : _('Switch to day theme');
const getIconNameForCurrentTime = () => e.timer.time === 'day' ? 'weather-clear-night-symbolic' : 'weather-clear-symbolic';
this._button = new PopupMenu.PopupImageMenuItem(getLabelForCurrentTime(), getIconNameForCurrentTime());
this._button.connect('activate', () => {
this._toggleTime();
this._button.label.text = getLabelForCurrentTime();
this._button.setIcon(getIconNameForCurrentTime());
});
aggregateMenu.menu.addMenuItem(this._button, position);
logDebug('Added On-demand Timer button to the menu.');
}
_toggleTime() {
e.settingsManager.ondemandTime = e.timer.time === 'day' ? 'night' : 'day';
this.emit('time-changed', this.time);
this._icon.icon_name = this._getIconNameForCurrentTime();
}
_getIconNameForCurrentTime() {
return e.timer.time === 'day' ? 'weather-clear-symbolic' : 'weather-clear-night-symbolic';
}
};
+81 -49
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Night Theme Switcher 7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-03 20:16+0200\n"
"PO-Revision-Date: 2020-08-03 23:31+0200\n"
"POT-Creation-Date: 2020-08-05 08:43+0200\n"
"PO-Revision-Date: 2020-08-05 08:45+0200\n"
"Last-Translator: Romain Vigier <romain@romainvigier.fr>\n"
"Language-Team: French - France <romain@romainvigier.fr>\n"
"Language: fr_FR\n"
@@ -18,11 +18,11 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"X-Generator: Gtranslator 3.36.0\n"
#: src/prefs.js:212 src/prefs.ui:644
#: src/prefs.js:227 src/prefs.ui:644
msgid "Choose"
msgstr "Choisir"
#: src/prefs.js:324
#: src/prefs.js:347
msgid "Default"
msgstr "Par défaut"
@@ -47,8 +47,16 @@ msgstr ""
"pour le thème GNOME Shell \"%s\". Veuillez les sélectionner manuellement "
"dans les préférences de lextension."
#: src/modules/TimerOndemand.js:162
msgid "Switch to night theme"
msgstr "Passer au thème nocturne"
#: src/modules/TimerOndemand.js:162
msgid "Switch to day theme"
msgstr "Passer au thème diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:6
#: src/prefs.ui:755
#: src/prefs.ui:816
msgid "Switch GTK variants"
msgstr "Permuter les variantes GTK"
@@ -129,7 +137,7 @@ msgid "Disable automatic shell theme variants detection"
msgstr "Désactiver la détection automatique des variantes du thème shell"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56
#: src/prefs.ui:1443
#: src/prefs.ui:1504
msgid "Switch icon variants"
msgstr "Permuter les variantes dicônes"
@@ -162,7 +170,7 @@ msgid "The icon theme to restore when the extension is disabled"
msgstr "Le thème dicônes à restaurer quand lextension est désactivée"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76
#: src/prefs.ui:1689
#: src/prefs.ui:1750
msgid "Switch cursor variants"
msgstr "Permuter les variantes de curseur"
@@ -218,79 +226,87 @@ msgstr "Combinaison de touches pour permuter le temps"
msgid "The key combination that will toggle time in on-demand mode"
msgstr "La combinaison de touches qui permutera le temps en mode à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:121
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126
msgid "On-demand button placement"
msgstr "Emplacement du bouton à la demande"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127
msgid "Where the on-demand button will be placed"
msgstr "Où le bouton du changement à la demande sera placé"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
msgid "Use manual time source"
msgstr "Utiliser une source dhoraires manuelle"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:122
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
msgid "Disable automatic time source detection"
msgstr "Désactive la détection automatique de la source dhoraires"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136
msgid "Sunrise time"
msgstr "Heure du lever"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137
msgid "When the day starts"
msgstr "Quand le jour se lève"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
msgid "Sunset time"
msgstr "Heure du coucher"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142
msgid "When the day ends"
msgstr "Quand le jour se couche"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146
msgid "Enable commands"
msgstr "Activer les commandes"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:147
msgid "Commands will be spawned on time change"
msgstr "Les commandes seront lancées au changement dhoraire"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
#: src/prefs.ui:2308
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151
#: src/prefs.ui:2369
msgid "Sunrise command"
msgstr "Commande du lever de soleil"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:152
msgid "The command to spawn at sunrise"
msgstr "La commande à lancer quand le soleil se lève"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146
#: src/prefs.ui:2367
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/prefs.ui:2428
msgid "Sunset command"
msgstr "Commande du coucher de soleil"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:147
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:157
msgid "The command to spawn at sunset"
msgstr "La commande à lancer quand le soleil se couche"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161
msgid "Enable backgrounds"
msgstr "Activer les arrière-plans"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:152
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:162
msgid "Background will be changed on time change"
msgstr "Larrière-plan changera au changement dhoraire"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/prefs.ui:2022
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166
#: src/prefs.ui:2083
msgid "Day background"
msgstr "Arrière-plan diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:157
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:167
msgid "Path to the day background"
msgstr "Chemin vers larrière-plan diurne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161
#: src/prefs.ui:2082
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171
#: src/prefs.ui:2143
msgid "Night background"
msgstr "Arrière-plan nocturne"
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:162
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:172
msgid "Path to the night background"
msgstr "Chemin vers larrière-plan nocturne"
@@ -361,15 +377,31 @@ msgstr "Coucher du soleil"
msgid "Clear"
msgstr "Effacer"
#: src/prefs.ui:707
#: src/prefs.ui:713
msgid "Button location"
msgstr "Emplacement du bouton"
#: src/prefs.ui:728
msgid "None"
msgstr "Aucun"
#: src/prefs.ui:729
msgid "Top bar"
msgstr "Barre supérieure"
#: src/prefs.ui:730
msgid "System menu"
msgstr "Menu système"
#: src/prefs.ui:768
msgid "Schedule"
msgstr "Horaires"
#: src/prefs.ui:827 src/prefs.ui:902 src/prefs.ui:1171 src/prefs.ui:1246
#: src/prefs.ui:888 src/prefs.ui:963 src/prefs.ui:1232 src/prefs.ui:1307
msgid "Manual variants"
msgstr "Variantes manuelles"
#: src/prefs.ui:840
#: src/prefs.ui:901
msgid ""
"<small>You can manually set variants if the extension cannot automatically "
"detect the day and night variants of your GTK theme. Please <a href="
@@ -382,23 +414,23 @@ msgstr ""
"shell-extension/-/issues\">soumettre une requête</a> pour obtenir le support "
"de votre thème.</small>"
#: src/prefs.ui:941 src/prefs.ui:1285 src/prefs.ui:1531 src/prefs.ui:1777
#: src/prefs.ui:1002 src/prefs.ui:1346 src/prefs.ui:1592 src/prefs.ui:1838
msgid "Day variant"
msgstr "Variante diurne"
#: src/prefs.ui:997 src/prefs.ui:1341 src/prefs.ui:1587 src/prefs.ui:1833
#: src/prefs.ui:1058 src/prefs.ui:1402 src/prefs.ui:1648 src/prefs.ui:1894
msgid "Night variant"
msgstr "Variante nocturne"
#: src/prefs.ui:1050
#: src/prefs.ui:1111
msgid "GTK theme"
msgstr "Thème GTK"
#: src/prefs.ui:1099
#: src/prefs.ui:1160
msgid "Switch Shell variants"
msgstr "Permuter les variantes Shell"
#: src/prefs.ui:1184
#: src/prefs.ui:1245
msgid ""
"<small>You can manually set variants if the extension cannot automatically "
"detect the day and night variants of your GNOME Shell theme. Please <a href="
@@ -411,39 +443,39 @@ msgstr ""
"gnome-shell-extension/-/issues\">soumettre une requête</a> pour obtenir le "
"support de votre thème.</small>"
#: src/prefs.ui:1394
#: src/prefs.ui:1455
msgid "Shell theme"
msgstr "Thème du shell"
#: src/prefs.ui:1492 src/prefs.ui:1738
#: src/prefs.ui:1553 src/prefs.ui:1799
msgid "Variants"
msgstr "Variantes"
#: src/prefs.ui:1640
#: src/prefs.ui:1701
msgid "Icon theme"
msgstr "Thème dicônes"
#: src/prefs.ui:1886
#: src/prefs.ui:1947
msgid "Cursor theme"
msgstr "Thème de curseur"
#: src/prefs.ui:1935
#: src/prefs.ui:1996
msgid "Switch backgrounds"
msgstr "Permuter les arrière-plans"
#: src/prefs.ui:1983 src/prefs.ui:2139
#: src/prefs.ui:2044 src/prefs.ui:2200
msgid "Backgrounds"
msgstr "Arrière-plans"
#: src/prefs.ui:2039 src/prefs.ui:2099
#: src/prefs.ui:2100 src/prefs.ui:2160
msgid "Select your background image"
msgstr "Sélectionnez votre image darrière-plan"
#: src/prefs.ui:2194
#: src/prefs.ui:2255
msgid "Run commands"
msgstr "Lancer des commandes"
#: src/prefs.ui:2207
#: src/prefs.ui:2268
msgid ""
"<small>You can set custom commands that will be run when the time of the day "
"changes.</small>"
@@ -451,15 +483,15 @@ msgstr ""
"<small>Vous pouvez définir des commandes personnalisées qui seront lancées "
"quand le moment du jour change.</small>"
#: src/prefs.ui:2269 src/prefs.ui:2423
#: src/prefs.ui:2330 src/prefs.ui:2484
msgid "Commands"
msgstr "Commandes"
#: src/prefs.ui:2324
#: src/prefs.ui:2385
msgid "notify-send \"Hello sunshine!\""
msgstr "notify-send \"Bonjour!\""
#: src/prefs.ui:2383
#: src/prefs.ui:2444
msgid "notify-send \"Hello moonshine!\""
msgstr "notify-send \"Bonsoir\""
+86 -54
View File
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Night Theme Switcher 32\n"
"Project-Id-Version: Night Theme Switcher 34\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-03 20:16+0200\n"
"POT-Creation-Date: 2020-08-05 08:43+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,11 +17,11 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/prefs.js:212 src/prefs.ui:644
#: src/prefs.js:227 src/prefs.ui:644
msgid "Choose"
msgstr ""
#: src/prefs.js:324
#: src/prefs.js:347
msgid "Default"
msgstr ""
@@ -40,8 +40,16 @@ msgid ""
"preferences."
msgstr ""
#: src/modules/TimerOndemand.js:162
msgid "Switch to night theme"
msgstr ""
#: src/modules/TimerOndemand.js:162
msgid "Switch to day theme"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:6
#: src/prefs.ui:755
#: src/prefs.ui:816
msgid "Switch GTK variants"
msgstr ""
@@ -122,7 +130,7 @@ msgid "Disable automatic shell theme variants detection"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56
#: src/prefs.ui:1443
#: src/prefs.ui:1504
msgid "Switch icon variants"
msgstr ""
@@ -155,7 +163,7 @@ msgid "The icon theme to restore when the extension is disabled"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76
#: src/prefs.ui:1689
#: src/prefs.ui:1750
msgid "Switch cursor variants"
msgstr ""
@@ -211,79 +219,87 @@ msgstr ""
msgid "The key combination that will toggle time in on-demand mode"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:121
msgid "Use manual time source"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:122
msgid "Disable automatic time source detection"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126
msgid "Sunrise time"
msgid "On-demand button placement"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127
msgid "When the day starts"
msgid "Where the on-demand button will be placed"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
msgid "Sunset time"
msgid "Use manual time source"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
msgid "When the day ends"
msgid "Disable automatic time source detection"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136
msgid "Enable commands"
msgid "Sunrise time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137
msgid "Commands will be spawned on time change"
msgid "When the day starts"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:141
#: src/prefs.ui:2308
msgid "Sunrise command"
msgid "Sunset time"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:142
msgid "The command to spawn at sunrise"
msgid "When the day ends"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:146
#: src/prefs.ui:2367
msgid "Sunset command"
msgid "Enable commands"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:147
msgid "The command to spawn at sunset"
msgid "Commands will be spawned on time change"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:151
msgid "Enable backgrounds"
#: src/prefs.ui:2369
msgid "Sunrise command"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:152
msgid "Background will be changed on time change"
msgid "The command to spawn at sunrise"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:156
#: src/prefs.ui:2022
msgid "Day background"
#: src/prefs.ui:2428
msgid "Sunset command"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:157
msgid "Path to the day background"
msgid "The command to spawn at sunset"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:161
#: src/prefs.ui:2082
msgid "Night background"
msgid "Enable backgrounds"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:162
msgid "Background will be changed on time change"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:166
#: src/prefs.ui:2083
msgid "Day background"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:167
msgid "Path to the day background"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:171
#: src/prefs.ui:2143
msgid "Night background"
msgstr ""
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:172
msgid "Path to the night background"
msgstr ""
@@ -350,15 +366,31 @@ msgstr ""
msgid "Clear"
msgstr ""
#: src/prefs.ui:707
#: src/prefs.ui:713
msgid "Button location"
msgstr ""
#: src/prefs.ui:728
msgid "None"
msgstr ""
#: src/prefs.ui:729
msgid "Top bar"
msgstr ""
#: src/prefs.ui:730
msgid "System menu"
msgstr ""
#: src/prefs.ui:768
msgid "Schedule"
msgstr ""
#: src/prefs.ui:827 src/prefs.ui:902 src/prefs.ui:1171 src/prefs.ui:1246
#: src/prefs.ui:888 src/prefs.ui:963 src/prefs.ui:1232 src/prefs.ui:1307
msgid "Manual variants"
msgstr ""
#: src/prefs.ui:840
#: src/prefs.ui:901
msgid ""
"<small>You can manually set variants if the extension cannot automatically "
"detect the day and night variants of your GTK theme. Please <a href="
@@ -366,23 +398,23 @@ msgid ""
"\">submit a request</a> to get your theme supported.</small>"
msgstr ""
#: src/prefs.ui:941 src/prefs.ui:1285 src/prefs.ui:1531 src/prefs.ui:1777
#: src/prefs.ui:1002 src/prefs.ui:1346 src/prefs.ui:1592 src/prefs.ui:1838
msgid "Day variant"
msgstr ""
#: src/prefs.ui:997 src/prefs.ui:1341 src/prefs.ui:1587 src/prefs.ui:1833
#: src/prefs.ui:1058 src/prefs.ui:1402 src/prefs.ui:1648 src/prefs.ui:1894
msgid "Night variant"
msgstr ""
#: src/prefs.ui:1050
#: src/prefs.ui:1111
msgid "GTK theme"
msgstr ""
#: src/prefs.ui:1099
#: src/prefs.ui:1160
msgid "Switch Shell variants"
msgstr ""
#: src/prefs.ui:1184
#: src/prefs.ui:1245
msgid ""
"<small>You can manually set variants if the extension cannot automatically "
"detect the day and night variants of your GNOME Shell theme. Please <a href="
@@ -390,52 +422,52 @@ msgid ""
"\">submit a request</a> to get your theme supported.</small>"
msgstr ""
#: src/prefs.ui:1394
#: src/prefs.ui:1455
msgid "Shell theme"
msgstr ""
#: src/prefs.ui:1492 src/prefs.ui:1738
#: src/prefs.ui:1553 src/prefs.ui:1799
msgid "Variants"
msgstr ""
#: src/prefs.ui:1640
#: src/prefs.ui:1701
msgid "Icon theme"
msgstr ""
#: src/prefs.ui:1886
#: src/prefs.ui:1947
msgid "Cursor theme"
msgstr ""
#: src/prefs.ui:1935
#: src/prefs.ui:1996
msgid "Switch backgrounds"
msgstr ""
#: src/prefs.ui:1983 src/prefs.ui:2139
#: src/prefs.ui:2044 src/prefs.ui:2200
msgid "Backgrounds"
msgstr ""
#: src/prefs.ui:2039 src/prefs.ui:2099
#: src/prefs.ui:2100 src/prefs.ui:2160
msgid "Select your background image"
msgstr ""
#: src/prefs.ui:2194
#: src/prefs.ui:2255
msgid "Run commands"
msgstr ""
#: src/prefs.ui:2207
#: src/prefs.ui:2268
msgid ""
"<small>You can set custom commands that will be run when the time of the day "
"changes.</small>"
msgstr ""
#: src/prefs.ui:2269 src/prefs.ui:2423
#: src/prefs.ui:2330 src/prefs.ui:2484
msgid "Commands"
msgstr ""
#: src/prefs.ui:2324
#: src/prefs.ui:2385
msgid "notify-send \"Hello sunshine!\""
msgstr ""
#: src/prefs.ui:2383
#: src/prefs.ui:2444
msgid "notify-send \"Hello moonshine!\""
msgstr ""
+8
View File
@@ -243,6 +243,14 @@ const Preferences = class {
};
this.settings.connect('changed::nightthemeswitcher-ondemand-keybinding', () => updateScheduleOndemandShortcutClearButtonVisibility());
updateScheduleOndemandShortcutClearButtonVisibility();
const scheduleOndemandButtonPlacementCombo = this.builder.get_object('prefs_schedule_ondemand_button_placement_combo');
this.settings.bind(
'ondemand-button-placement',
scheduleOndemandButtonPlacementCombo,
'active-id',
Gio.SettingsBindFlags.DEFAULT
);
}
_connectGtkThemePreferences() {
+61
View File
@@ -679,6 +679,67 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">16</property>
<property name="margin_end">16</property>
<property name="margin_top">16</property>
<property name="margin_bottom">16</property>
<property name="spacing">30</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Button location</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="prefs_schedule_ondemand_button_placement_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<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>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
@@ -116,6 +116,16 @@
<summary>Key combination to toggle time</summary>
<description>The key combination that will toggle time in on-demand mode</description>
</key>
<key name="ondemand-button-placement" type="s">
<choices>
<choice value="none"/>
<choice value="panel"/>
<choice value="menu"/>
</choices>
<default>"panel"</default>
<summary>On-demand button placement</summary>
<description>Where the on-demand button will be placed</description>
</key>
<key name="manual-time-source" type="b">
<default>false</default>
<summary>Use manual time source</summary>
+11
View File
@@ -270,3 +270,14 @@ function isBindingValid({ mask, keycode, keyval }) {
function isAccelValid({ mask, keyval }) {
return Gtk.accelerator_valid(keyval, mask) || (keyval === Gdk.KEY_Tab && mask !== 0);
}
/**
* Find the position of a menu item in the Shell aggregate menu.
* @param {*} menuItem The desired menu item.
* @returns {number} The position of the menu item, `-1` if not found.
*/
function findShellAggregateMenuItemPosition(menuItem) {
const menu = imports.ui.main.panel.statusArea.aggregateMenu.menu;
const items = menu._getMenuItems();
return items.indexOf(menuItem);
}