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 authored and 3v1n0 committed Aug 29, 2024
1 parent 6ab2267 commit 924347d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 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
35 changes: 35 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,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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<value value='6' nick='CILIORA'/>
<value value='7' nick='METRO'/>
<value value='8' nick='BINARY'/>
<value value='9' nick='DOT'/>
</enum>
<schema path="/org/gnome/shell/extensions/dash-to-dock/" id="org.gnome.shell.extensions.dash-to-dock">
<key name="dock-position" enum="org.gnome.shell.extensions.dash-to-dock.position">
Expand Down

0 comments on commit 924347d

Please sign in to comment.