From 924347dc204056c0df6ce6e963feb8354218ad2e Mon Sep 17 00:00:00 2001 From: Yaroslav Pronin Date: Wed, 28 Aug 2024 10:29:06 +0300 Subject: [PATCH] Add `Dot` running indicator style --- Settings.ui | 1 + appIconIndicators.js | 35 +++++++++++++++++++ ....shell.extensions.dash-to-dock.gschema.xml | 1 + 3 files changed, 37 insertions(+) diff --git a/Settings.ui b/Settings.ui index d6bd65a4f..9a31c5d6e 100644 --- a/Settings.ui +++ b/Settings.ui @@ -2071,6 +2071,7 @@ Ciliora Metro Binary + Dot diff --git a/appIconIndicators.js b/appIconIndicators.js index 888de06fb..c1a34817d 100644 --- a/appIconIndicators.js +++ b/appIconIndicators.js @@ -26,6 +26,7 @@ const RunningIndicatorStyle = Object.freeze({ CILIORA: 6, METRO: 7, BINARY: 8, + DOT: 9, }); const MAX_WINDOWS_CLASSES = 4; @@ -88,10 +89,15 @@ export class AppIconIndicator { case RunningIndicatorStyle.METRO: runningIndicator = new RunningIndicatorMetro(source); break; + case RunningIndicatorStyle.BINARY: runningIndicator = new RunningIndicatorBinary(source); break; + case RunningIndicatorStyle.DOT: + runningIndicator = new RunningIndicatorDot(source); + break; + default: runningIndicator = new RunningIndicatorBase(source); } @@ -673,6 +679,35 @@ class RunningIndicatorBinary extends RunningIndicatorDots { } } +class RunningIndicatorDot extends RunningIndicatorDots { + _computeStyle() { + super._computeStyle(); + + this._radius = Math.max(this._width / 26, this._borderWidth / 2); + } + + _drawIndicator(cr) { + if (!this._source.running) + return; + + cr.setLineWidth(this._borderWidth); + Utils.cairoSetSourceColor(cr, this._borderColor); + + // draw from the bottom case: + cr.translate( + (this._width - 2 * this._radius) / 2, + this._height - this._padding); + cr.newSubPath(); + cr.arc(this._radius, + -this._radius - this._borderWidth / 2, + this._radius, 0, 2 * Math.PI); + + cr.strokePreserve(); + Utils.cairoSetSourceColor(cr, this._bodyColor); + cr.fill(); + } +} + /* * Unity like notification and progress indicators */ diff --git a/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml index ed2c0d424..3a762c331 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml @@ -48,6 +48,7 @@ +