Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dot running indicator style #2265

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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