Merge branch 'fix/flicker-on-unlock' into 'master'
Fix flicker on unlock (Fix #5) Closes #5 See merge request rmnvgr/nightthemeswitcher-gnome-shell-extension!11
This commit is contained in:
+12
-2
@@ -18,6 +18,7 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
const { extensionUtils } = imports.misc;
|
const { extensionUtils } = imports.misc;
|
||||||
const { Gio } = imports.gi;
|
const { Gio } = imports.gi;
|
||||||
|
const { main } = imports.ui;
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
const config = Me.imports.config;
|
const config = Me.imports.config;
|
||||||
@@ -26,6 +27,8 @@ const { log_debug } = Me.imports.utils;
|
|||||||
|
|
||||||
const { Variants } = Me.imports.modules.Variants;
|
const { Variants } = Me.imports.modules.Variants;
|
||||||
|
|
||||||
|
const State = new Map();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The Themer communicates with the system to get the current theme or set a new
|
The Themer communicates with the system to get the current theme or set a new
|
||||||
@@ -52,7 +55,11 @@ var Themer = class {
|
|||||||
disable() {
|
disable() {
|
||||||
log_debug('Disabling Themer...');
|
log_debug('Disabling Themer...');
|
||||||
this._stop_listening_to_theme_changes();
|
this._stop_listening_to_theme_changes();
|
||||||
this.reset_theme();
|
// GNOME Shell disables extensions when locking the screen. We'll only reset the theme if the user disables the extension.
|
||||||
|
State.set('last_disabled_on_screen_lock', main.screenShield.locked);
|
||||||
|
if ( !State.get('last_disabled_on_screen_lock') ) {
|
||||||
|
this.reset_theme();
|
||||||
|
}
|
||||||
log_debug('Themer disabled.');
|
log_debug('Themer disabled.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +91,7 @@ var Themer = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset_theme() {
|
reset_theme() {
|
||||||
this.set_variant('original');
|
this.current = State.get('original_theme');
|
||||||
log_debug('Theme has been reset to the user\'s original variant.')
|
log_debug('Theme has been reset to the user\'s original variant.')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +107,9 @@ var Themer = class {
|
|||||||
_update_variants() {
|
_update_variants() {
|
||||||
if ( this.current ) {
|
if ( this.current ) {
|
||||||
this.variants = Variants.guess_from(this.current);
|
this.variants = Variants.guess_from(this.current);
|
||||||
|
if ( !State.get('last_disabled_on_screen_lock') ) {
|
||||||
|
State.set('original_theme', this.variants.get('original'));
|
||||||
|
}
|
||||||
log_debug('Variants updated: ' + this.variants);
|
log_debug('Variants updated: ' + this.variants);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user