Skip to content

Commit 95e0689

Browse files
authored
day-progress@chmodmasx v1.0.3: Improved display (#8173)
1 parent 0cf2a21 commit 95e0689

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

day-progress@chmodmasx/files/day-progress@chmodmasx/applet.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ DayProgressApplet.prototype = {
153153
this.menuManager.addMenu(this.menu);
154154

155155
// Menu items
156-
this.menuElapsedContainer = new PopupMenu.PopupBaseMenuItem({ reactive: false });
156+
this.menuElapsedContainer = new PopupMenu.PopupBaseMenuItem({ reactive: false, style_class: "day-progress-label"});
157157
this.elapsedLabel = new St.Label({
158158
text: _("Elapsed"),
159159
x_align: Clutter.ActorAlign.START,
@@ -164,7 +164,7 @@ DayProgressApplet.prototype = {
164164
this.menuElapsedContainer.addActor(this.elapsedLabel);
165165
this.menuElapsedContainer.addActor(this.elapsedValue);
166166

167-
this.menuRemainingContainer = new PopupMenu.PopupBaseMenuItem({ reactive: false });
167+
this.menuRemainingContainer = new PopupMenu.PopupBaseMenuItem({ reactive: false, style_class: "day-progress-label" });
168168
this.remainingLabel = new St.Label({
169169
text: _("Remaining"),
170170
x_align: Clutter.ActorAlign.START,
@@ -278,14 +278,18 @@ DayProgressApplet.prototype = {
278278
let elapsedMinutes = Math.floor((percentElapsedOfPeriod * duration * 24 * 60) % 60);
279279
let remainingHours = Math.floor(percentRemainingOfPeriod * duration * 24);
280280
let remainingMinutes = Math.floor((percentRemainingOfPeriod * duration * 24 * 60) % 60);
281+
let percentElapsed = Math.round(percentElapsedOfPeriod * 100);
282+
let percentRemaining = Math.round(percentRemainingOfPeriod * 100);
281283

282-
if (elapsedHours < 10) elapsedHours = " " + elapsedHours; else elapsedHours = "" + elapsedHours;
283-
if (elapsedMinutes < 10) elapsedMinutes = " " + elapsedMinutes; else elapsedMinutes = "" + elapsedMinutes;
284-
if (remainingHours < 10) remainingHours = " " + remainingHours; else remainingHours = "" + remainingHours;
285-
if (remainingMinutes < 10) remainingMinutes = " " + remainingMinutes; else remainingMinutes = "" + remainingMinutes;
284+
elapsedHours = " ".repeat((elapsedHours < 10) ? 1 : 0) + elapsedHours;
285+
elapsedMinutes = " ".repeat((elapsedMinutes < 10) ? 1 : 0) + elapsedMinutes;
286+
remainingHours = " ".repeat((remainingHours < 10) ? 1 : 0) + remainingHours;
287+
remainingMinutes = " ".repeat((remainingMinutes < 10) ? 1 : 0) + remainingMinutes;
288+
percentElapsed = " ".repeat((percentElapsed < 10) ? 1 : 0) + percentElapsed;
289+
percentRemaining = " ".repeat((percentRemaining < 10) ? 1 : 0) + percentRemaining;
286290

287-
this.elapsedValue.text = elapsedHours + 'h ' + elapsedMinutes + 'm | ' + Math.round(percentElapsedOfPeriod * 100) + '%';
288-
this.remainingValue.text = remainingHours + 'h ' + remainingMinutes + 'm | ' + Math.round(percentRemainingOfPeriod * 100) + '%';
291+
this.elapsedValue.text = elapsedHours + 'h ' + elapsedMinutes + 'm | ' + percentElapsed + '%';
292+
this.remainingValue.text = remainingHours + 'h ' + remainingMinutes + 'm | ' + percentRemaining + '%';
289293

290294
this._updateTooltip();
291295
},

day-progress@chmodmasx/files/day-progress@chmodmasx/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"uuid": "day-progress@chmodmasx",
33
"name": "Day Progress",
44
"description": "Displays a customizable progress pie chart in the panel to help you track your day time.",
5-
"version": "1.0.2",
5+
"version": "1.0.3",
66
"cinnamon-version": ["6.4"],
77
"author": "chmodmasx"
88
}

day-progress@chmodmasx/files/day-progress@chmodmasx/stylesheet.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.day-progress-label {
22
font-weight: bold;
3+
font-family: monospace;
4+
text-align: end;
35
}
46

57
.pie {

0 commit comments

Comments
 (0)