diff --git a/src/extension.js b/src/extension.js index ba84770..d66efb1 100644 --- a/src/extension.js +++ b/src/extension.js @@ -54,7 +54,7 @@ const TeaTimeFullscreenNotification = new Lang.Class({ // a table imitating a vertical box layout to hold the texture and // a label underneath it - this._layout = new St.BoxLayout({vertical:true, y_align:Clutter.ActorAlign.CENTER}); + this._layout = new St.BoxLayout({ vertical: true, y_align: Clutter.ActorAlign.CENTER }); this._bin.set_child(this._layout); // find all the textures @@ -145,7 +145,7 @@ const TeaTime = new Lang.Class({ Extends : PanelMenu.Button, _init : function() { - this.parent(0.0, "TeaTime"); + this.parent(null, "TeaTime"); this._settings = Utils.getSettings(); @@ -158,6 +158,7 @@ const TeaTime = new Lang.Class({ this._graphicalTimer = new Icon.TwoColorIcon(24, Icon.Pie); this.actor.add_actor(this._logo); + this.actor.add_style_class_name('panel-status-button'); this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged)); this._idleTimeout = null; diff --git a/src/icon.js b/src/icon.js index 7978aeb..08441d2 100644 --- a/src/icon.js +++ b/src/icon.js @@ -22,7 +22,7 @@ const TwoColorIcon = new Lang.Class({ Extends: St.DrawingArea, _init : function(size, drawingObject) { - this.parent({ reactive : true }); + this.parent({ reactive : true, style: 'padding: 0px 2px' }); this.set_width(size); this.set_height(size); this._drawingObject = drawingObject; @@ -53,21 +53,23 @@ const TwoColorIcon = new Lang.Class({ this.queue_repaint(); }, _drawIcon: function() { - let cr = this.get_context(); - let orWdt = this._drawingObject.width; + let cr = this.get_context(); + let orWdt = this._drawingObject.width; let orHgt = this._drawingObject.height; - let[width, height] = this.get_surface_size(); + let[width, height] = this.get_surface_size(); cr.save(); - // layout object in box + // layout object in box if (orWdt/orHgt > width/height) { // take full width and center vertically - cr.scale(width/orWdt, width/orWdt); - cr.translate(0, (orWdt-orHgt)*0.5); + cr.translate(0, height * 0.5); + cr.scale(width/orWdt, width/orWdt); + cr.translate(0, (height*width/orWdt - orHgt) * 0.5); } else { - cr.scale(height/orHgt, height/orHgt) - cr.translate(-(orWdt-orHgt)*0.5, 0);; + cr.translate(width * 0.5, 0); + cr.scale(height/orHgt, height/orHgt); + cr.translate((width*height/orHgt - orWdt) * 0.5, 0); } this._drawingObject.draw(cr, this._customStatus, this._primaryColor, this._secundaryColor);