mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
Add dark theme support #13
This commit is contained in:
@@ -21,6 +21,8 @@ class ClapperApp extends Gtk.Application
|
||||
playlist: [],
|
||||
};
|
||||
Object.assign(this, defaults, opts);
|
||||
|
||||
this.doneFirstActivate = false;
|
||||
}
|
||||
|
||||
vfunc_startup()
|
||||
@@ -70,9 +72,9 @@ class ClapperApp extends Gtk.Application
|
||||
{
|
||||
super.vfunc_activate();
|
||||
|
||||
this.windowShowSignal = this.active_window.connect(
|
||||
'show', this._onWindowShow.bind(this)
|
||||
);
|
||||
if(!this.doneFirstActivate)
|
||||
this._onFirstActivate();
|
||||
|
||||
this.active_window.present();
|
||||
}
|
||||
|
||||
@@ -81,6 +83,22 @@ class ClapperApp extends Gtk.Application
|
||||
super.run(arr || []);
|
||||
}
|
||||
|
||||
_onFirstActivate()
|
||||
{
|
||||
let gtkSettings = Gtk.Settings.get_default();
|
||||
settings.bind(
|
||||
'dark-theme', gtkSettings,
|
||||
'gtk_application_prefer_dark_theme',
|
||||
Gio.SettingsBindFlags.GET
|
||||
);
|
||||
|
||||
this.windowShowSignal = this.active_window.connect(
|
||||
'show', this._onWindowShow.bind(this)
|
||||
);
|
||||
|
||||
this.doneFirstActivate = true;
|
||||
}
|
||||
|
||||
_onWindowShow(window)
|
||||
{
|
||||
window.disconnect(this.windowShowSignal);
|
||||
|
Reference in New Issue
Block a user