diff --git a/src/extension.js b/src/extension.js index 828b492..188a2be 100644 --- a/src/extension.js +++ b/src/extension.js @@ -399,6 +399,11 @@ const TeaTime = new Lang.Class({ this._logo.setColor(this._primaryColor, this._secondaryColor); this._graphicalTimer.setColor(this._primaryColor, this._secondaryColor); + + // forward (possible) scaling style change to child + let scaling = Utils.getGlobalDisplayScaleFactor(); + this._logo.setScaling(scaling); + this._graphicalTimer.setScaling(scaling); } }); diff --git a/src/icon.js b/src/icon.js index dd5f072..313e28b 100644 --- a/src/icon.js +++ b/src/icon.js @@ -26,8 +26,9 @@ const TwoColorIcon = new Lang.Class({ reactive: true, style: 'padding: 0px 2px' }); - this.set_width(size); - this.set_height(size); + this._base_size = size; + this.setScaling(Utils.getGlobalDisplayScaleFactor()); + this._drawingObject = drawingObject; this.connect('repaint', Lang.bind(this, this._drawIcon)); @@ -51,6 +52,12 @@ const TwoColorIcon = new Lang.Class({ this._secundaryColor = secundary; this.queue_repaint(); }, + setScaling: function (newScale) { + this._default_scale = newScale; + this.set_width(this._base_size * this._default_scale); + this.set_height(this._base_size * this._default_scale); + this.queue_repaint(); + }, setStatus: function (newStatus) { this._customStatus = newStatus; this.queue_repaint(); diff --git a/src/utils.js b/src/utils.js index 78f211b..868c60c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -9,6 +9,7 @@ const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Config = imports.misc.config; const Gst = imports.gi.Gst; +const St = imports.gi.St; const TEATIME_STEEP_TIMES_KEY = 'steep-times'; const TEATIME_FULLSCREEN_NOTIFICATION_KEY = 'fullscreen-notification'; @@ -138,3 +139,7 @@ function setCairoColorFromClutter(cr, c) { let s = 1.0 / 255; cr.setSourceRGBA(s * c.red, s * c.green, s * c.blue, s * c.alpha); } + +function getGlobalDisplayScaleFactor() { + return St.ThemeContext.get_for_stage(global.stage).scale_factor; +}