Allow disabling GTK and shell variants switching
This commit is contained in:
@@ -45,10 +45,14 @@ var ShellThemer = class {
|
||||
enable() {
|
||||
log_debug('Enabling Shell Themer...');
|
||||
try {
|
||||
this._update_variants();
|
||||
this._set_variant(e.timer.time);
|
||||
this._connect_settings();
|
||||
this._connect_timer();
|
||||
this._watch_status();
|
||||
this._save_original_theme();
|
||||
if ( e.settingsManager.shell_variants_enabled ) {
|
||||
this._update_variants();
|
||||
this._set_variant(e.timer.time);
|
||||
this._connect_settings();
|
||||
this._connect_timer();
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
log_error(e);
|
||||
@@ -60,11 +64,25 @@ var ShellThemer = class {
|
||||
log_debug('Disabling Shell Themer...');
|
||||
this._disconnect_timer();
|
||||
this._disconnect_settings();
|
||||
this._reset_theme();
|
||||
this._reset_original_theme();
|
||||
this._unwatch_status();
|
||||
log_debug('Shell Themer disabled.');
|
||||
}
|
||||
|
||||
|
||||
_watch_status() {
|
||||
log_debug('Watching shell variants status...');
|
||||
this._shell_variants_status_changed_connect = e.settingsManager.connect('shell-variants-status-changed', this._on_shell_variants_status_changed.bind(this));
|
||||
}
|
||||
|
||||
_unwatch_status() {
|
||||
if ( this._shell_variants_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._shell_variants_status_changed_connect);
|
||||
this._shell_variants_status_changed_connect = null;
|
||||
}
|
||||
log_debug('Stopped watching shell variants status.');
|
||||
}
|
||||
|
||||
_connect_settings() {
|
||||
log_debug('Connecting Shell Themer to settings...');
|
||||
this._shell_variant_changed_connect = e.settingsManager.connect('shell-variant-changed', this._on_shell_variant_changed.bind(this));
|
||||
@@ -97,6 +115,11 @@ var ShellThemer = class {
|
||||
}
|
||||
|
||||
|
||||
_on_shell_variants_status_changed(settings, enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_shell_variant_changed(settings, changed_variant_time) {
|
||||
if ( changed_variant_time === e.timer.time ) {
|
||||
this._set_variant(e.timer.time);
|
||||
@@ -166,7 +189,11 @@ var ShellThemer = class {
|
||||
log_debug(`New Shell variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
|
||||
}
|
||||
|
||||
_reset_theme() {
|
||||
_save_original_theme() {
|
||||
e.settingsManager.shell_variant_original = e.settingsManager.shell_theme;
|
||||
}
|
||||
|
||||
_reset_original_theme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if ( !main.screenShield.locked ) {
|
||||
|
||||
Reference in New Issue
Block a user