From b404eb2f561100a05977cae579a442774b9c8e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Wed, 24 Mar 2021 20:36:08 +0100 Subject: [PATCH] Increase play/pause icon size only on Adwaita theme Adwaita theme has unusually small media constrols icons, but other popular themes do not. Instead increasing those icons on every theme do it only for Adwaita where problem occurs. --- css/styles.css | 4 ++-- src/appBase.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/css/styles.css b/css/styles.css index b6c403e0..f6565d07 100644 --- a/css/styles.css +++ b/css/styles.css @@ -88,10 +88,10 @@ radio { .tvmode .playercontrols { -gtk-icon-size: 24px; } -.playbackicon { +.adwicons .playbackicon { -gtk-icon-size: 20px; } -.tvmode .playbackicon { +.adwicons.tvmode .playbackicon { -gtk-icon-size: 28px; } .labelbutton { diff --git a/src/appBase.js b/src/appBase.js index 3faeffce..09b7783b 100644 --- a/src/appBase.js +++ b/src/appBase.js @@ -74,7 +74,9 @@ class ClapperAppBase extends Gtk.Application Gio.SettingsBindFlags.GET ); this._onThemeChanged(gtkSettings); + this._onIconThemeChanged(gtkSettings); gtkSettings.connect('notify::gtk-theme-name', this._onThemeChanged.bind(this)); + gtkSettings.connect('notify::gtk-icon-theme-name', this._onIconThemeChanged.bind(this)); this.windowShowSignal = this.active_window.connect( 'show', this._onWindowShow.bind(this) @@ -110,4 +112,20 @@ class ClapperAppBase extends Gtk.Application gtkSettings.gtk_theme_name = parsedTheme; debug(`set theme: ${parsedTheme}`); } + + _onIconThemeChanged(gtkSettings) + { + const iconTheme = gtkSettings.gtk_icon_theme_name; + const window = this.active_window; + const hasAdwIcons = window.has_css_class('adwicons'); + + if(iconTheme === 'Adwaita') { + if(!hasAdwIcons) + window.add_css_class('adwicons'); + } + else { + if(hasAdwIcons) + window.remove_css_class('adwicons'); + } + } });