diff --git a/src/app.js b/src/app.js index fe3f2e2c..9ce377da 100644 --- a/src/app.js +++ b/src/app.js @@ -1,4 +1,4 @@ -const { Gio, GObject, Gtk } = imports.gi; +const { Gio, GObject, Gdk, Gtk } = imports.gi; const { AppBase } = imports.src.appBase; const { Widget } = imports.src.widget; const Debug = imports.src.debug; @@ -43,6 +43,22 @@ class ClapperApp extends AppBase this._openFilesAsync(files).then(() => this.activate()).catch(debug); } + _onIconThemeChanged(gtkSettings) + { + super._onIconThemeChanged(gtkSettings); + + const display = Gdk.Display.get_default(); + if(!display) return; + + const iconTheme = Gtk.IconTheme.get_for_display(display); + if(!iconTheme) return; + + const { headerBar } = this.active_window.child.revealerTop; + if(!headerBar) return; + + headerBar._onIconThemeChanged(iconTheme); + } + _onWindowMap(window) { window.disconnect(this.mapSignal); diff --git a/src/appBase.js b/src/appBase.js index b0a9f0fe..d24cc263 100644 --- a/src/appBase.js +++ b/src/appBase.js @@ -1,4 +1,4 @@ -const { Gio, GLib, GObject, Gdk, Gtk } = imports.gi; +const { Gio, GLib, GObject, Gtk } = imports.gi; const Debug = imports.src.debug; const FileOps = imports.src.fileOps; const Misc = imports.src.misc; @@ -131,16 +131,5 @@ class ClapperAppBase extends Gtk.Application } else if(hasAdwIcons) window.remove_css_class('adwicons'); - - const display = Gdk.Display.get_default(); - if(!display) return; - - const iconTheme = Gtk.IconTheme.get_for_display(display); - if(!iconTheme) return; - - const { headerBar } = window.child.revealerTop; - if(!headerBar) return; - - headerBar._onIconThemeChanged(iconTheme); } }); diff --git a/src/headerbar.js b/src/headerbar.js index d41a519f..497b13e9 100644 --- a/src/headerbar.js +++ b/src/headerbar.js @@ -28,4 +28,12 @@ class ClapperHeaderBar extends HeaderBarBase { this.root.fullscreen(); } + + _onIconThemeChanged(iconTheme) + { + super._onIconThemeChanged(iconTheme); + + const { controlsRevealer } = this.root.child; + this._updateFloatIcon(!controlsRevealer.reveal_child); + } }); diff --git a/src/headerbarBase.js b/src/headerbarBase.js index 65c7f9fc..63ce1e9c 100644 --- a/src/headerbarBase.js +++ b/src/headerbarBase.js @@ -245,16 +245,11 @@ class ClapperHeaderBarBase extends Gtk.Box _onIconThemeChanged(iconTheme) { - /* Those icons are relatively new, - * so check if theme has them */ + /* Those icons are new, so check if theme has them */ this.hasPipIcons = ( iconTheme.has_icon('pip-in-symbolic') && iconTheme.has_icon('pip-out-symbolic') ); - - const { controlsRevealer } = this.root.child; - - this._updateFloatIcon(!controlsRevealer.reveal_child); } });