Icon theme switching
This commit is contained in:
@@ -28,6 +28,7 @@ const { SettingsManager } = Me.imports.modules.SettingsManager;
|
||||
const { Timer } = Me.imports.modules.Timer;
|
||||
const { GtkThemer } = Me.imports.modules.GtkThemer;
|
||||
const { ShellThemer } = Me.imports.modules.ShellThemer;
|
||||
const { IconThemer } = Me.imports.modules.IconThemer;
|
||||
const { CursorThemer } = Me.imports.modules.CursorThemer;
|
||||
const { Backgrounder } = Me.imports.modules.Backgrounder;
|
||||
const { Commander } = Me.imports.modules.Commander;
|
||||
@@ -44,6 +45,7 @@ var settingsManager = null;
|
||||
var timer = null;
|
||||
var gtkThemer = null;
|
||||
var shellThemer = null;
|
||||
var iconThemer = null;
|
||||
var cursorThemer = null;
|
||||
var backgrounder = null;
|
||||
var commander = null;
|
||||
@@ -62,6 +64,7 @@ function enable() {
|
||||
timer = new Timer();
|
||||
gtkThemer = new GtkThemer();
|
||||
shellThemer = new ShellThemer();
|
||||
iconThemer = new IconThemer();
|
||||
cursorThemer = new CursorThemer();
|
||||
backgrounder = new Backgrounder();
|
||||
commander = new Commander();
|
||||
@@ -70,6 +73,7 @@ function enable() {
|
||||
timer.enable();
|
||||
gtkThemer.enable();
|
||||
shellThemer.enable();
|
||||
iconThemer.enable();
|
||||
cursorThemer.enable();
|
||||
backgrounder.enable();
|
||||
commander.enable();
|
||||
@@ -85,6 +89,7 @@ function disable() {
|
||||
|
||||
gtkThemer.disable();
|
||||
shellThemer.disable();
|
||||
iconThemer.disable();
|
||||
cursorThemer.disable();
|
||||
backgrounder.disable();
|
||||
commander.disable();
|
||||
@@ -95,6 +100,7 @@ function disable() {
|
||||
timer = null;
|
||||
gtkThemer = null;
|
||||
shellThemer = null;
|
||||
iconThemer = null;
|
||||
cursorThemer = null;
|
||||
backgrounder = null;
|
||||
commander = null;
|
||||
|
||||
@@ -109,7 +109,6 @@ var CursorThemer = class {
|
||||
}
|
||||
|
||||
_on_cursor_theme_changed(settings, new_theme) {
|
||||
this._save_original_theme();
|
||||
switch (e.timer.time) {
|
||||
case 'day':
|
||||
e.settingsManager.cursor_variant_day = new_theme;
|
||||
@@ -125,10 +124,6 @@ var CursorThemer = class {
|
||||
}
|
||||
|
||||
|
||||
_are_variants_up_to_date() {
|
||||
return ( e.settingsManager.cursor_theme === e.settingsManager.cursor_variant_day || e.settingsManager.cursor_theme === e.settingsManager.cursor_variant_night );
|
||||
}
|
||||
|
||||
_set_variant(time) {
|
||||
log_debug(`Setting the cursor ${time} variant...`);
|
||||
switch (time) {
|
||||
@@ -145,9 +140,6 @@ var CursorThemer = class {
|
||||
}
|
||||
|
||||
_save_original_theme() {
|
||||
if ( this._are_variants_up_to_date() ) {
|
||||
return;
|
||||
}
|
||||
e.settingsManager.cursor_variant_original = e.settingsManager.cursor_theme;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
Night Theme Switcher Gnome Shell extension
|
||||
|
||||
Copyright (C) 2020 Romain Vigier
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const { extensionUtils } = imports.misc;
|
||||
const { main } = imports.ui;
|
||||
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
|
||||
|
||||
/**
|
||||
* The Icon Themer is responsible for changing the icon theme according to the
|
||||
* time.
|
||||
*/
|
||||
var IconThemer = class {
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Icon Themer...');
|
||||
this._watch_status();
|
||||
this._save_original_theme();
|
||||
if ( e.settingsManager.icon_variants_enabled ) {
|
||||
this._connect_settings();
|
||||
this._connect_timer();
|
||||
}
|
||||
log_debug('Icon Themer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Icon Themer...');
|
||||
this._disconnect_timer();
|
||||
this._disconnect_settings();
|
||||
this._reset_original_theme();
|
||||
this._unwatch_status();
|
||||
log_debug('Icon Themer disabled.');
|
||||
}
|
||||
|
||||
|
||||
_watch_status() {
|
||||
log_debug('Watching icon variants status...');
|
||||
this._icon_variants_status_changed_connect = e.settingsManager.connect('icon-variants-status-changed', this._on_icon_variants_status_changed.bind(this));
|
||||
}
|
||||
|
||||
_unwatch_status() {
|
||||
if ( this._icon_variants_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._icon_variants_status_changed_connect);
|
||||
this._icon_variants_status_changed_connect = null;
|
||||
}
|
||||
log_debug('Stopped watching icon variants status.');
|
||||
}
|
||||
|
||||
_connect_settings() {
|
||||
log_debug('Connecting Icon Themer to settings...');
|
||||
this._icon_variant_changed_connect = e.settingsManager.connect('icon-variant-changed', this._on_icon_variant_changed.bind(this));
|
||||
this._icon_theme_changed_connect = e.settingsManager.connect('icon-theme-changed', this._on_icon_theme_changed.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_settings() {
|
||||
if ( this._icon_variant_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._icon_variant_changed_connect);
|
||||
this._icon_variant_changed_connect = null;
|
||||
}
|
||||
if ( this._icon_theme_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._icon_theme_changed_connect);
|
||||
this._icon_theme_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Icon Themer from settings.');
|
||||
}
|
||||
|
||||
_connect_timer() {
|
||||
log_debug('Connecting Icon Themer to Timer...');
|
||||
this._time_changed_connect = e.timer.connect('time-changed', this._on_time_changed.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_timer() {
|
||||
if ( this._time_changed_connect ) {
|
||||
e.timer.disconnect(this._time_changed_connect);
|
||||
this._time_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Icon Themer from Timer.');
|
||||
}
|
||||
|
||||
|
||||
_on_icon_variants_status_changed(settings, enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_icon_variant_changed(settings, changed_variant_time) {
|
||||
if ( changed_variant_time === e.timer.time ) {
|
||||
this._set_variant(changed_variant_time);
|
||||
}
|
||||
}
|
||||
|
||||
_on_icon_theme_changed(settings, new_theme) {
|
||||
switch (e.timer.time) {
|
||||
case 'day':
|
||||
e.settingsManager.icon_variant_day = new_theme;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.icon_variant_night = new_theme;
|
||||
}
|
||||
this._set_variant(e.timer.time);
|
||||
}
|
||||
|
||||
_on_time_changed(timer, new_time) {
|
||||
this._set_variant(new_time);
|
||||
}
|
||||
|
||||
|
||||
_set_variant(time) {
|
||||
log_debug(`Setting the icon ${time} variant...`);
|
||||
switch (time) {
|
||||
case 'day':
|
||||
e.settingsManager.icon_theme = e.settingsManager.icon_variant_day;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.icon_theme = e.settingsManager.icon_variant_night;
|
||||
break;
|
||||
case 'original':
|
||||
e.settingsManager.icon_theme = e.settingsManager.icon_variant_original;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_save_original_theme() {
|
||||
e.settingsManager.icon_variant_original = e.settingsManager.icon_theme;
|
||||
}
|
||||
|
||||
_reset_original_theme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if ( !main.screenShield.locked ) {
|
||||
log_debug('Resetting to the user\'s original icon theme...');
|
||||
this._set_variant('original');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,6 +57,10 @@ var SettingsManager = class {
|
||||
this._shell_variant_day_changed_connect = this._extensionsSettings.connect('changed::shell-variant-day', this._on_shell_variant_day_changed.bind(this));
|
||||
this._shell_variant_night_changed_connect = this._extensionsSettings.connect('changed::shell-variant-night', this._on_shell_variant_night_changed.bind(this));
|
||||
this._shell_variant_original_changed_connect = this._extensionsSettings.connect('changed::shell-variant-original', this._on_shell_variant_original_changed.bind(this));
|
||||
this._icon_variants_status_connect = this._extensionsSettings.connect('changed::icon-variants-enabled', this._on_icon_variants_status_changed.bind(this));
|
||||
this._icon_variant_day_changed_connect = this._extensionsSettings.connect('changed::icon-variant-day', this._on_icon_variant_day_changed.bind(this));
|
||||
this._icon_variant_night_changed_connect = this._extensionsSettings.connect('changed::icon-variant-night', this._on_icon_variant_night_changed.bind(this));
|
||||
this._icon_variant_original_changed_connect = this._extensionsSettings.connect('changed::icon-variant-original', this._on_icon_variant_original_changed.bind(this));
|
||||
this._cursor_variants_status_connect = this._extensionsSettings.connect('changed::cursor-variants-enabled', this._on_cursor_variants_status_changed.bind(this));
|
||||
this._cursor_variant_day_changed_connect = this._extensionsSettings.connect('changed::cursor-variant-day', this._on_cursor_variant_day_changed.bind(this));
|
||||
this._cursor_variant_night_changed_connect = this._extensionsSettings.connect('changed::cursor-variant-night', this._on_cursor_variant_night_changed.bind(this));
|
||||
@@ -70,6 +74,7 @@ var SettingsManager = class {
|
||||
this._nightlight_status_connect = this._colorSettings.connect('changed::night-light-enabled', this._on_nightlight_status_changed.bind(this));
|
||||
this._location_status_connect = this._locationSettings.connect('changed::enabled', this._on_location_status_changed.bind(this));
|
||||
this._gtk_theme_changed_connect = this._interfaceSettings.connect('changed::gtk-theme', this._on_gtk_theme_changed.bind(this));
|
||||
this._icon_theme_changed_connect = this._interfaceSettings.connect('changed::icon-theme', this._on_icon_theme_changed.bind(this));
|
||||
this._cursor_theme_changed_connect = this._interfaceSettings.connect('changed::cursor-theme', this._on_cursor_theme_changed.bind(this));
|
||||
this._background_changed_connect = this._backgroundSettings.connect('changed::picture-uri', this._on_background_changed.bind(this));
|
||||
if ( this._userthemesSettings ) {
|
||||
@@ -86,6 +91,10 @@ var SettingsManager = class {
|
||||
this._extensionsSettings.disconnect(this._shell_variant_day_changed_connect);
|
||||
this._extensionsSettings.disconnect(this._shell_variant_night_changed_connect);
|
||||
this._extensionsSettings.disconnect(this._shell_variant_original_changed_connect);
|
||||
this._extensionsSettings.disconnect(this._icon_variants_status_connect);
|
||||
this._extensionsSettings.disconnect(this._icon_variant_day_changed_connect);
|
||||
this._extensionsSettings.disconnect(this._icon_variant_night_changed_connect);
|
||||
this._extensionsSettings.disconnect(this._icon_variant_original_changed_connect);
|
||||
this._extensionsSettings.disconnect(this._cursor_variants_status_connect);
|
||||
this._extensionsSettings.disconnect(this._cursor_variant_day_changed_connect);
|
||||
this._extensionsSettings.disconnect(this._cursor_variant_night_changed_connect);
|
||||
@@ -99,6 +108,7 @@ var SettingsManager = class {
|
||||
this._colorSettings.disconnect(this._nightlight_status_connect);
|
||||
this._locationSettings.disconnect(this._location_status_connect);
|
||||
this._interfaceSettings.disconnect(this._gtk_theme_changed_connect);
|
||||
this._interfaceSettings.disconnect(this._icon_theme_changed_connect);
|
||||
this._interfaceSettings.disconnect(this._cursor_theme_changed_connect);
|
||||
this._backgroundSettings.disconnect(this._background_changed_connect);
|
||||
if ( this._userthemesSettings ) {
|
||||
@@ -229,6 +239,45 @@ var SettingsManager = class {
|
||||
}
|
||||
}
|
||||
|
||||
/* Icon variants settings */
|
||||
|
||||
get icon_variants_enabled() {
|
||||
return this._extensionsSettings.get_boolean('icon-variants-enabled');
|
||||
}
|
||||
|
||||
get icon_variant_day() {
|
||||
return this._extensionsSettings.get_string('icon-variant-day') || this.icon_theme;
|
||||
}
|
||||
|
||||
set icon_variant_day(value) {
|
||||
if ( value !== this.icon_variant_day ) {
|
||||
this._extensionsSettings.set_string('icon-variant-day', value);
|
||||
log_debug(`The icon day variant has been set to '${value}'.`);
|
||||
}
|
||||
}
|
||||
|
||||
get icon_variant_night() {
|
||||
return this._extensionsSettings.get_string('icon-variant-night') || this.icon_theme;
|
||||
}
|
||||
|
||||
set icon_variant_night(value) {
|
||||
if ( value !== this.icon_variant_night ) {
|
||||
this._extensionsSettings.set_string('icon-variant-night', value);
|
||||
log_debug(`The icon night variant has been set to '${value}'.`);
|
||||
}
|
||||
}
|
||||
|
||||
get icon_variant_original() {
|
||||
return this._extensionsSettings.get_string('icon-variant-original');
|
||||
}
|
||||
|
||||
set icon_variant_original(value) {
|
||||
if ( value !== this.icon_variant_original ) {
|
||||
this._extensionsSettings.set_string('icon-variant-original', value);
|
||||
log_debug(`The icon original variant has been set to '${value}'.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Time source settings */
|
||||
|
||||
@@ -317,7 +366,7 @@ var SettingsManager = class {
|
||||
set gtk_theme(value) {
|
||||
if ( value !== this.gtk_theme ) {
|
||||
this._interfaceSettings.set_string('gtk-theme', value);
|
||||
log_debug(`GTK theme has been set to '${value}.'`);
|
||||
log_debug(`GTK theme has been set to '${value}'.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,6 +390,20 @@ var SettingsManager = class {
|
||||
}
|
||||
|
||||
|
||||
/* Icon theme settings */
|
||||
|
||||
get icon_theme() {
|
||||
return this._interfaceSettings.get_string('icon-theme');
|
||||
}
|
||||
|
||||
set icon_theme(value) {
|
||||
if ( value !== this.icon_theme ) {
|
||||
this._interfaceSettings.set_string('icon-theme', value);
|
||||
log_debug(`Icon theme has been set to '${value}'.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Cursor theme settings */
|
||||
|
||||
get cursor_theme() {
|
||||
@@ -350,7 +413,7 @@ var SettingsManager = class {
|
||||
set cursor_theme(value) {
|
||||
if ( value !== this.cursor_theme ) {
|
||||
this._interfaceSettings.set_string('cursor-theme', value);
|
||||
log_debug(`Cursor theme has been set to '${value}.'`);
|
||||
log_debug(`Cursor theme has been set to '${value}'.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +475,7 @@ var SettingsManager = class {
|
||||
|
||||
_on_cursor_variants_status_changed(settings, changed_key) {
|
||||
log_debug('Cursor variants have been ' + (this.cursor_variants_enabled ? 'ena' : 'disa') + 'bled.');
|
||||
this.emit('cursor-variants-status-changed', this.curso_variants_enabled);
|
||||
this.emit('cursor-variants-status-changed', this.cursor_variants_enabled);
|
||||
}
|
||||
|
||||
_on_cursor_variant_day_changed(settings, changed_key) {
|
||||
@@ -431,6 +494,29 @@ var SettingsManager = class {
|
||||
}
|
||||
|
||||
|
||||
/* Icon variants */
|
||||
|
||||
_on_icon_variants_status_changed(settings, changed_key) {
|
||||
log_debug('Icon variants have been ' + (this.icon_variants_enabled ? 'ena' : 'disa') + 'bled.');
|
||||
this.emit('icon-variants-status-changed', this.icon_variants_enabled);
|
||||
}
|
||||
|
||||
_on_icon_variant_day_changed(settings, changed_key) {
|
||||
log_debug(`Icon day variant has changed to '${this.icon_variant_day}'.`);
|
||||
this.emit('icon-variant-changed', 'day');
|
||||
}
|
||||
|
||||
_on_icon_variant_night_changed(settings, changed_key) {
|
||||
log_debug(`Icon night variant has changed to '${this.icon_variant_night}'.`);
|
||||
this.emit('icon-variant-changed', 'night');
|
||||
}
|
||||
|
||||
_on_icon_variant_original_changed(settings, changed_key) {
|
||||
log_debug(`Icon original variant has changed to '${this.icon_variant_original}'.`);
|
||||
this.emit('icon-variant-changed', 'original');
|
||||
}
|
||||
|
||||
|
||||
/* Time source */
|
||||
|
||||
_on_time_source_changed(settings, changed_key) {
|
||||
@@ -494,6 +580,14 @@ var SettingsManager = class {
|
||||
}
|
||||
|
||||
|
||||
/* Icon theme */
|
||||
|
||||
_on_icon_theme_changed(settings, changed_key) {
|
||||
log_debug(`Cursor theme has changed to '${this.icon_theme}'.`);
|
||||
this.emit('icon-theme-changed', this.icon_theme);
|
||||
}
|
||||
|
||||
|
||||
/* Cursor theme */
|
||||
|
||||
_on_cursor_theme_changed(settings, changed_key) {
|
||||
|
||||
+88
-46
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Night Theme Switcher 7\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-05-29 11:18+0200\n"
|
||||
"PO-Revision-Date: 2020-05-29 11:21+0200\n"
|
||||
"POT-Creation-Date: 2020-05-29 16:45+0200\n"
|
||||
"PO-Revision-Date: 2020-05-29 16:48+0200\n"
|
||||
"Last-Translator: Romain Vigier <romain@romainvigier.fr>\n"
|
||||
"Language-Team: French - France <romain@romainvigier.fr>\n"
|
||||
"Language: fr_FR\n"
|
||||
@@ -52,12 +52,12 @@ msgid "Switch backgrounds"
|
||||
msgstr "Changer les arrière-plans"
|
||||
|
||||
#: src/preferences/Backgrounds.js:44
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:111
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
|
||||
msgid "Day background"
|
||||
msgstr "Arrière-plan diurne"
|
||||
|
||||
#: src/preferences/Backgrounds.js:45
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:116
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136
|
||||
msgid "Night background"
|
||||
msgstr "Arrière-plan nocturne"
|
||||
|
||||
@@ -107,17 +107,17 @@ msgstr ""
|
||||
"Vous pouvez définir des thèmes de curseurs diurnes et nocturnes différents."
|
||||
|
||||
#: src/preferences/CursorTheme.js:44
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:66
|
||||
msgid "Switch cursor variants"
|
||||
msgstr "Changer les variantes de curseur"
|
||||
|
||||
#: src/preferences/CursorTheme.js:45 src/preferences/GtkTheme.js:45
|
||||
#: src/preferences/ShellTheme.js:45
|
||||
#: src/preferences/IconTheme.js:45 src/preferences/ShellTheme.js:45
|
||||
msgid "Day variant"
|
||||
msgstr "Variante diurne"
|
||||
|
||||
#: src/preferences/CursorTheme.js:46 src/preferences/GtkTheme.js:46
|
||||
#: src/preferences/ShellTheme.js:46
|
||||
#: src/preferences/IconTheme.js:46 src/preferences/ShellTheme.js:46
|
||||
msgid "Night variant"
|
||||
msgstr "Variante nocturne"
|
||||
|
||||
@@ -146,6 +146,20 @@ msgstr ""
|
||||
msgid "Manual variants"
|
||||
msgstr "Variantes manuelles"
|
||||
|
||||
#: src/preferences/IconTheme.js:40
|
||||
msgid "Icon theme"
|
||||
msgstr "Thème d’icônes"
|
||||
|
||||
#: src/preferences/IconTheme.js:41
|
||||
msgid "You can set different icon themes for day and night."
|
||||
msgstr ""
|
||||
"Vous pouvez définir des thèmes d’icônes diurnes et nocturnes différents."
|
||||
|
||||
#: src/preferences/IconTheme.js:44
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46
|
||||
msgid "Switch icon variants"
|
||||
msgstr "Changer les variantes d’icônes"
|
||||
|
||||
#: src/preferences/Schedule.js:39
|
||||
msgid "Schedule"
|
||||
msgstr "Horaires"
|
||||
@@ -170,7 +184,7 @@ msgid "Manual time source"
|
||||
msgstr "Source d’horaires manuelle"
|
||||
|
||||
#: src/preferences/Schedule.js:44
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:91
|
||||
msgid "Time source"
|
||||
msgstr "Source d’horaires"
|
||||
|
||||
@@ -276,98 +290,126 @@ 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:47
|
||||
msgid "Enable icon variants switching"
|
||||
msgstr "Activer le changement de variantes d’icônes"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51
|
||||
msgid "Day icon theme"
|
||||
msgstr "Thème d’icônes diurne"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:52
|
||||
msgid "The icon theme to use during daytime"
|
||||
msgstr "Le thème d’icônes à utiliser le jour"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56
|
||||
msgid "Night icon theme"
|
||||
msgstr "Thème d’icônes nocturne"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57
|
||||
msgid "The icon theme to use during nighttime"
|
||||
msgstr "Le thème d’icônes à utiliser la nuit"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61
|
||||
msgid "Original icon theme"
|
||||
msgstr "Thème d’icônes original"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62
|
||||
msgid "The icon theme to restore when the extension is disabled"
|
||||
msgstr "Le thème d’icônes à restaurer quand l’extension est désactivée"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67
|
||||
msgid "Enable cursor variants switching"
|
||||
msgstr "Activer le changement de variantes de curseur"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71
|
||||
msgid "Day cursor theme"
|
||||
msgstr "Thème de curseur diurne"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:52
|
||||
msgid "The cursor theme to use during daytime"
|
||||
msgstr "Le thème de curseur à utiliser le jour"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56
|
||||
msgid "Night cursor theme"
|
||||
msgstr "Thème de curseur nocturne"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57
|
||||
msgid "The cursor theme to use during nighttime"
|
||||
msgstr "Le thème shell à utiliser la nuit"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61
|
||||
msgid "Original cursor theme"
|
||||
msgstr "Thème de curseur original"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62
|
||||
msgid "The cursor theme to restore when the extension is disabled"
|
||||
msgstr "Le thème de curseur à restaurer quand l’extension est désactivée"
|
||||
msgstr "Thème de curseurs diurne"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:72
|
||||
msgid "The cursor theme to use during daytime"
|
||||
msgstr "Le thème de curseurs à utiliser le jour"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76
|
||||
msgid "Night cursor theme"
|
||||
msgstr "Thème de curseurs nocturne"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:77
|
||||
msgid "The cursor theme to use during nighttime"
|
||||
msgstr "Le thème de curseurs à utiliser la nuit"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:81
|
||||
msgid "Original cursor theme"
|
||||
msgstr "Thème de curseurs original"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:82
|
||||
msgid "The cursor theme to restore when the extension is disabled"
|
||||
msgstr "Le thème de curseurs à restaurer quand l’extension est désactivée"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92
|
||||
msgid "The source used to check current time"
|
||||
msgstr "Source utilisée pour vérifier les horaires"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96
|
||||
msgid "Use manual time source"
|
||||
msgstr "Utiliser une source d’horaires manuelle"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:77
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:97
|
||||
msgid "Disable automatic time source detection"
|
||||
msgstr "Désactive la détection automatique de la source d’horaires"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:81
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:101
|
||||
msgid "Sunrise time"
|
||||
msgstr "Heure du lever"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:82
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102
|
||||
msgid "When the day starts"
|
||||
msgstr "Quand le jour se lève"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:86
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:106
|
||||
msgid "Sunset time"
|
||||
msgstr "Heure du coucher"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:87
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:107
|
||||
msgid "When the day ends"
|
||||
msgstr "Quand le jour se couche"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:91
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:111
|
||||
msgid "Enable commands"
|
||||
msgstr "Activer les commandes"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112
|
||||
msgid "Commands will be spawned on time change"
|
||||
msgstr "Les commandes seront lancées au changement d’horaire"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:116
|
||||
msgid "Sunrise command"
|
||||
msgstr "Commande du lever de soleil"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:97
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117
|
||||
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:101
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:121
|
||||
msgid "Sunset command"
|
||||
msgstr "Commande du coucher de soleil"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:122
|
||||
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:106
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126
|
||||
msgid "Enable backgrounds"
|
||||
msgstr "Activer les arrière-plans"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:107
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127
|
||||
msgid "Background will be changed on time change"
|
||||
msgstr "L’arrière-plan changera au changement d’horaire"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
|
||||
msgid "Path to the day background"
|
||||
msgstr "Chemin vers l’arrière-plan diurne"
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137
|
||||
msgid "Path to the night background"
|
||||
msgstr "Chemin vers l’arrière-plan nocturne"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Night Theme Switcher 30\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-05-29 11:18+0200\n"
|
||||
"POT-Creation-Date: 2020-05-29 16:45+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"
|
||||
@@ -45,12 +45,12 @@ msgid "Switch backgrounds"
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/Backgrounds.js:44
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:111
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:131
|
||||
msgid "Day background"
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/Backgrounds.js:45
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:116
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:136
|
||||
msgid "Night background"
|
||||
msgstr ""
|
||||
|
||||
@@ -97,17 +97,17 @@ msgid "You can set different cursor themes for day and night."
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/CursorTheme.js:44
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:66
|
||||
msgid "Switch cursor variants"
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/CursorTheme.js:45 src/preferences/GtkTheme.js:45
|
||||
#: src/preferences/ShellTheme.js:45
|
||||
#: src/preferences/IconTheme.js:45 src/preferences/ShellTheme.js:45
|
||||
msgid "Day variant"
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/CursorTheme.js:46 src/preferences/GtkTheme.js:46
|
||||
#: src/preferences/ShellTheme.js:46
|
||||
#: src/preferences/IconTheme.js:46 src/preferences/ShellTheme.js:46
|
||||
msgid "Night variant"
|
||||
msgstr ""
|
||||
|
||||
@@ -129,6 +129,19 @@ msgstr ""
|
||||
msgid "Manual variants"
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/IconTheme.js:40
|
||||
msgid "Icon theme"
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/IconTheme.js:41
|
||||
msgid "You can set different icon themes for day and night."
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/IconTheme.js:44
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:46
|
||||
msgid "Switch icon variants"
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/Schedule.js:39
|
||||
msgid "Schedule"
|
||||
msgstr ""
|
||||
@@ -147,7 +160,7 @@ msgid "Manual time source"
|
||||
msgstr ""
|
||||
|
||||
#: src/preferences/Schedule.js:44
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:91
|
||||
msgid "Time source"
|
||||
msgstr ""
|
||||
|
||||
@@ -246,97 +259,125 @@ msgid "Disable automatic shell theme variants detection"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:47
|
||||
msgid "Enable cursor variants switching"
|
||||
msgid "Enable icon variants switching"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:51
|
||||
msgid "Day cursor theme"
|
||||
msgid "Day icon theme"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:52
|
||||
msgid "The cursor theme to use during daytime"
|
||||
msgid "The icon theme to use during daytime"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:56
|
||||
msgid "Night cursor theme"
|
||||
msgid "Night icon theme"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:57
|
||||
msgid "The cursor theme to use during nighttime"
|
||||
msgid "The icon theme to use during nighttime"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:61
|
||||
msgid "Original cursor theme"
|
||||
msgid "Original icon theme"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:62
|
||||
msgid "The cursor theme to restore when the extension is disabled"
|
||||
msgid "The icon theme to restore when the extension is disabled"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:67
|
||||
msgid "Enable cursor variants switching"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:71
|
||||
msgid "Day cursor theme"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:72
|
||||
msgid "The source used to check current time"
|
||||
msgid "The cursor theme to use during daytime"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:76
|
||||
msgid "Use manual time source"
|
||||
msgid "Night cursor theme"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:77
|
||||
msgid "Disable automatic time source detection"
|
||||
msgid "The cursor theme to use during nighttime"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:81
|
||||
msgid "Sunrise time"
|
||||
msgid "Original cursor theme"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:82
|
||||
msgid "When the day starts"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:86
|
||||
msgid "Sunset time"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:87
|
||||
msgid "When the day ends"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:91
|
||||
msgid "Enable commands"
|
||||
msgid "The cursor theme to restore when the extension is disabled"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:92
|
||||
msgid "Commands will be spawned on time change"
|
||||
msgid "The source used to check current time"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:96
|
||||
msgid "Sunrise command"
|
||||
msgid "Use manual time source"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:97
|
||||
msgid "The command to spawn at sunrise"
|
||||
msgid "Disable automatic time source detection"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:101
|
||||
msgid "Sunset command"
|
||||
msgid "Sunrise time"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:102
|
||||
msgid "The command to spawn at sunset"
|
||||
msgid "When the day starts"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:106
|
||||
msgid "Enable backgrounds"
|
||||
msgid "Sunset time"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:107
|
||||
msgid "Background will be changed on time change"
|
||||
msgid "When the day ends"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:111
|
||||
msgid "Enable commands"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:112
|
||||
msgid "Path to the day background"
|
||||
msgid "Commands will be spawned on time change"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:116
|
||||
msgid "Sunrise command"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:117
|
||||
msgid "The command to spawn at sunrise"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:121
|
||||
msgid "Sunset command"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:122
|
||||
msgid "The command to spawn at sunset"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:126
|
||||
msgid "Enable backgrounds"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:127
|
||||
msgid "Background will be changed on time change"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:132
|
||||
msgid "Path to the day background"
|
||||
msgstr ""
|
||||
|
||||
#: src/schemas/org.gnome.shell.extensions.nightthemeswitcher.gschema.xml:137
|
||||
msgid "Path to the night background"
|
||||
msgstr ""
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
Night Theme Switcher Gnome Shell extension
|
||||
|
||||
Copyright (C) 2020 Romain Vigier
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const { GdkPixbuf, Gio, Gtk } = imports.gi;
|
||||
const { extensionUtils } = imports.misc;
|
||||
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||
const { get_installed_icon_themes } = Me.imports.utils;
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||
const _ = Gettext.gettext;
|
||||
|
||||
|
||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
||||
if ( shell_minor_version <= 30 ) {
|
||||
extensionUtils.getSettings = Me.imports.convenience.getSettings;
|
||||
}
|
||||
|
||||
|
||||
var IconThemePreferences = class {
|
||||
|
||||
constructor() {
|
||||
const label = _('Icon theme');
|
||||
const description = _('You can set different icon themes for day and night.');
|
||||
const content = new SettingsList();
|
||||
|
||||
content.add_row(new SettingsListRow(_('Switch icon variants'), new IconVariantsEnabledControl()));
|
||||
content.add_row(new SettingsListRow(_('Day variant'), new TimeIconVariantControl('day')));
|
||||
content.add_row(new SettingsListRow(_('Night variant'), new TimeIconVariantControl('night')));
|
||||
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class IconVariantsEnabledControl {
|
||||
|
||||
constructor() {
|
||||
const settings = extensionUtils.getSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('icon-variants-enabled')
|
||||
});
|
||||
settings.bind(
|
||||
'icon-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TimeIconVariantControl {
|
||||
|
||||
constructor(time) {
|
||||
const settings = extensionUtils.getSettings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(get_installed_icon_themes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, theme));
|
||||
settings.bind(
|
||||
`icon-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
settings.bind(
|
||||
'icon-variants-enabled',
|
||||
combo,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ const { BackgroundsPreferences } = Me.imports.preferences.Backgrounds;
|
||||
const { CommandsPreferences } = Me.imports.preferences.Commands;
|
||||
const { CursorThemePreferences } = Me.imports.preferences.CursorTheme;
|
||||
const { GtkThemePreferences } = Me.imports.preferences.GtkTheme;
|
||||
const { IconThemePreferences } = Me.imports.preferences.IconTheme;
|
||||
const { SchedulePreferences } = Me.imports.preferences.Schedule;
|
||||
const { ShellThemePreferences } = Me.imports.preferences.ShellTheme;
|
||||
|
||||
@@ -55,6 +56,9 @@ function buildPrefsWidget() {
|
||||
const shellThemePreferences = new ShellThemePreferences();
|
||||
prefs_widget.append_page(shellThemePreferences.page, shellThemePreferences.label);
|
||||
|
||||
const iconThemePreferences = new IconThemePreferences();
|
||||
prefs_widget.append_page(iconThemePreferences.page, iconThemePreferences.label);
|
||||
|
||||
const cursorThemePreferences = new CursorThemePreferences();
|
||||
prefs_widget.append_page(cursorThemePreferences.page, cursorThemePreferences.label);
|
||||
|
||||
|
||||
@@ -41,6 +41,26 @@
|
||||
<summary>Use manual shell variants</summary>
|
||||
<description>Disable automatic shell theme variants detection</description>
|
||||
</key>
|
||||
<key name="icon-variants-enabled" type="b">
|
||||
<default>false</default>
|
||||
<summary>Switch icon variants</summary>
|
||||
<description>Enable icon variants switching</description>
|
||||
</key>
|
||||
<key name="icon-variant-day" type="s">
|
||||
<default>""</default>
|
||||
<summary>Day icon theme</summary>
|
||||
<description>The icon theme to use during daytime</description>
|
||||
</key>
|
||||
<key name="icon-variant-night" type="s">
|
||||
<default>""</default>
|
||||
<summary>Night icon theme</summary>
|
||||
<description>The icon theme to use during nighttime</description>
|
||||
</key>
|
||||
<key name="icon-variant-original" type="s">
|
||||
<default>""</default>
|
||||
<summary>Original icon theme</summary>
|
||||
<description>The icon theme to restore when the extension is disabled</description>
|
||||
</key>
|
||||
<key name="cursor-variants-enabled" type="b">
|
||||
<default>false</default>
|
||||
<summary>Switch cursor variants</summary>
|
||||
|
||||
@@ -141,6 +141,43 @@ function get_installed_shell_themes() {
|
||||
return themes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the installed icon themes on the system.
|
||||
* @returns {Set} A set containing all the installed icon themes names.
|
||||
*/
|
||||
function get_installed_icon_themes() {
|
||||
const themes = new Set();
|
||||
|
||||
get_resources_dirs_paths('icons').forEach(themes_dir_path => {
|
||||
const themes_dir = Gio.File.new_for_path(themes_dir_path);
|
||||
|
||||
if (themes_dir.query_file_type(Gio.FileQueryInfoFlags.NONE, null) !== Gio.FileType.DIRECTORY) {
|
||||
return;
|
||||
}
|
||||
|
||||
const theme_dirs_enumerator = themes_dir.enumerate_children('', Gio.FileQueryInfoFlags.NONE, null);
|
||||
|
||||
while (true) {
|
||||
let theme_dir_info = theme_dirs_enumerator.next_file(null);
|
||||
|
||||
if (theme_dir_info === null) {
|
||||
break;
|
||||
}
|
||||
|
||||
const theme_dir = theme_dirs_enumerator.get_child(theme_dir_info);
|
||||
const css_file = Gio.File.new_for_path(GLib.build_filenamev([theme_dir.get_path(), 'index.theme']));
|
||||
if (css_file.query_exists(null)) {
|
||||
themes.add(theme_dir.get_basename());
|
||||
}
|
||||
}
|
||||
theme_dirs_enumerator.close(null);
|
||||
});
|
||||
|
||||
themes.delete('default');
|
||||
|
||||
return themes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the installed cursor themes on the system.
|
||||
* @returns {Set} A set containing all the installed cursor themes names.
|
||||
|
||||
Reference in New Issue
Block a user