From 873e724bf2b6a256b1cb1930ea002543068a250d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Mon, 6 Sep 2021 14:29:16 +0200 Subject: [PATCH 1/2] Comply with GJS packaging spec According to spec, package name should always be set to main package name in DBus name format --- bin/com.github.rafostar.Clapper.Subprocess.in | 17 ----------------- bin/com.github.rafostar.Clapper.in | 6 ++---- bin/meson.build | 3 +-- 3 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 bin/com.github.rafostar.Clapper.Subprocess.in diff --git a/bin/com.github.rafostar.Clapper.Subprocess.in b/bin/com.github.rafostar.Clapper.Subprocess.in deleted file mode 100644 index b4621a03..00000000 --- a/bin/com.github.rafostar.Clapper.Subprocess.in +++ /dev/null @@ -1,17 +0,0 @@ -#!@GJS@ - -/* pkg init enforces the imports path to the folder - * named after the pkg name, but I would prefer to have - * the bundled subprocess stored in the same directory */ -imports.searchPath.unshift('@datadir@/@PACKAGE_NAME@'); - -const Package = imports.package; - -Package.init({ - name: '@PACKAGE_NAME@.@ID_POSTFIX@', - version: '@PACKAGE_VERSION@', - prefix: '@prefix@', - libdir: '@libdir@', - datadir: '@datadir@', -}); -Package.run(imports.src.main@ID_POSTFIX@); diff --git a/bin/com.github.rafostar.Clapper.in b/bin/com.github.rafostar.Clapper.in index 22533e35..4b54cfa8 100644 --- a/bin/com.github.rafostar.Clapper.in +++ b/bin/com.github.rafostar.Clapper.in @@ -1,12 +1,10 @@ #!@GJS@ -const Package = imports.package; - -Package.init({ +imports.package.init({ name: '@PACKAGE_NAME@', version: '@PACKAGE_VERSION@', prefix: '@prefix@', libdir: '@libdir@', datadir: '@datadir@', }); -Package.run(imports.src.main); +imports.package.run(imports.src.main@ID_POSTFIX@); diff --git a/bin/meson.build b/bin/meson.build index 468aa626..4e1bc8fa 100644 --- a/bin/meson.build +++ b/bin/meson.build @@ -2,7 +2,6 @@ clapper_apps = ['', 'Remote', 'Daemon'] foreach id_postfix : clapper_apps app_postfix = (id_postfix != '') ? '.' + id_postfix : '' - template_type = (id_postfix != '') ? '.Subprocess' : '' bin_conf = configuration_data() bin_conf.set('GJS', find_program('gjs').path()) @@ -14,7 +13,7 @@ foreach id_postfix : clapper_apps bin_conf.set('datadir', join_paths(get_option('prefix'), get_option('datadir'))) configure_file( - input: 'com.github.rafostar.Clapper' + template_type + '.in', + input: 'com.github.rafostar.Clapper.in', output: 'com.github.rafostar.Clapper' + app_postfix, configuration: bin_conf, install: true, From 8733610a9b8112ffcc47feb1d2d5b6288598bc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Mon, 6 Sep 2021 15:27:37 +0200 Subject: [PATCH 2/2] Move revealers access away from base classes Those should not appear in base classes, as they are available in main app only --- src/app.js | 18 +++++++++++++++++- src/appBase.js | 13 +------------ src/headerbar.js | 8 ++++++++ src/headerbarBase.js | 7 +------ 4 files changed, 27 insertions(+), 19 deletions(-) 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); } });