Skip to content

Commit

Permalink
Add Dot running indicator style
Browse files Browse the repository at this point in the history
  • Loading branch information
proninyaroslav committed Aug 21, 2024
1 parent e81ef20 commit fca3ac3
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 139 deletions.
1 change: 1 addition & 0 deletions Settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,7 @@
<item translatable="yes">Ciliora</item>
<item translatable="yes">Metro</item>
<item translatable="yes">Binary</item>
<item translatable="yes">Dot</item>
</items>
</object>
</child>
Expand Down
38 changes: 38 additions & 0 deletions appIconIndicators.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const RunningIndicatorStyle = Object.freeze({
CILIORA: 6,
METRO: 7,
BINARY: 8,
DOT: 9,
});

const MAX_WINDOWS_CLASSES = 4;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -673,6 +679,38 @@ class RunningIndicatorBinary extends RunningIndicatorDots {
}
}

class RunningIndicatorDot extends RunningIndicatorDots {
_computeStyle() {
super._computeStyle();

this._radius = Math.max(this._width / 26, this._borderWidth / 2);
// don't draw dot directly on inset
this._padding = 0.1
}

_drawIndicator(cr) {
if (!this._source.running) {
return;
}

cr.setLineWidth(this._borderWidth);
Utils.cairoSetSourceColor(cr, this._borderColor);

// draw for 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
*/
Expand Down
Loading

0 comments on commit fca3ac3

Please sign in to comment.