Skip to content

Commit e21ac00

Browse files
diskspace@schorschii: Free space color setting, circle background color setting Closes #1386 (#1593)
* add free space color setting * fill circle background setting * german translation
1 parent 5ec94c9 commit e21ac00

17 files changed

Lines changed: 397 additions & 97 deletions

File tree

diskspace@schorschii/files/diskspace@schorschii/desklet.js

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ MyDesklet.prototype = {
4949
this.settings.bindProperty(Settings.BindingDirection.IN, "text-color", "text_color", this.on_setting_changed);
5050
this.settings.bindProperty(Settings.BindingDirection.IN, "design", "design", this.on_setting_changed);
5151
this.settings.bindProperty(Settings.BindingDirection.IN, "draw-free-space", "draw_free_space", this.on_setting_changed);
52+
this.settings.bindProperty(Settings.BindingDirection.IN, "fill-circle-background", "fill_circle_background", this.on_setting_changed);
53+
this.settings.bindProperty(Settings.BindingDirection.IN, "fill-circle-background-color", "fill_circle_background_color", this.on_setting_changed);
5254
this.settings.bindProperty(Settings.BindingDirection.IN, "circle-color", "circle_color", this.on_setting_changed);
55+
this.settings.bindProperty(Settings.BindingDirection.IN, "circle-color-free-space", "circle_color_free_space", this.on_setting_changed);
5356
this.settings.bindProperty(Settings.BindingDirection.IN, "use-own-circle-color", "use_own_circle_color", this.on_setting_changed);
5457
this.settings.bindProperty(Settings.BindingDirection.IN, "filesystem", "filesystem", this.on_setting_changed);
5558
this.settings.bindProperty(Settings.BindingDirection.IN, "type", "type", this.on_setting_changed);
@@ -200,7 +203,7 @@ MyDesklet.prototype = {
200203
// canvas setup
201204
let canvas = new Clutter.Canvas();
202205
canvas.set_size(absoluteSize * global.ui_scale, absoluteSize * global.ui_scale);
203-
canvas.connect("draw", function (canvas, cr, width, height) {
206+
canvas.connect("draw", (canvas, cr, width, height) => {
204207
cr.save();
205208
cr.setOperator(Cairo.Operator.CLEAR);
206209
cr.paint();
@@ -213,9 +216,25 @@ MyDesklet.prototype = {
213216
let start = 0 - offset;
214217
let end = ((use*(Math.PI*2))/size) - offset;
215218

219+
const free_space_colors = this.circle_color_free_space.match(/\((.*?)\)/)[1].split(","); // get contents inside brackets: "rgb(...)"
220+
const free_space_color_r = this.use_own_circle_color ? parseInt(free_space_colors[0])/255 : 1;
221+
const free_space_color_g = this.use_own_circle_color ? parseInt(free_space_colors[1])/255 : 1;
222+
const free_space_color_b = this.use_own_circle_color ? parseInt(free_space_colors[2])/255 : 1;
223+
const free_space_color_a = this.use_own_circle_color ? (free_space_colors.length >= 4 ? parseFloat(free_space_colors[3]) : 1.0) : 0.2;
224+
216225
if(design == "thin") {
226+
if(this.fill_circle_background) {
227+
const bg_fill_colors = this.fill_circle_background_color.match(/\((.*?)\)/)[1].split(",");
228+
const bg_fill_r = parseInt(bg_fill_colors[0])/255;
229+
const bg_fill_g = parseInt(bg_fill_colors[1])/255;
230+
const bg_fill_b = parseInt(bg_fill_colors[2])/255;
231+
const bg_fill_a = bg_fill_colors.length >= 4 ? parseFloat(bg_fill_colors[3]) : 1.0;
232+
cr.setSourceRGBA(bg_fill_r, bg_fill_g, bg_fill_b, bg_fill_a);
233+
cr.arc(0, 0, 0.45 - (0.045 / 2), 0, Math.PI*2);
234+
cr.fill();
235+
}
217236
if(drawFreeSpace) {
218-
cr.setSourceRGBA(1, 1, 1, 0.2);
237+
cr.setSourceRGBA(free_space_color_r, free_space_color_g, free_space_color_b, free_space_color_a);
219238
cr.setLineWidth(0.045);
220239
cr.arc(0, 0, 0.45, 0, Math.PI*2);
221240
cr.stroke();
@@ -229,7 +248,7 @@ MyDesklet.prototype = {
229248
}
230249
} else if(design == "compact") {
231250
if(drawFreeSpace) {
232-
cr.setSourceRGBA(1, 1, 1, 0.2);
251+
cr.setSourceRGBA(free_space_color_r, free_space_color_g, free_space_color_b, free_space_color_a);
233252
cr.setLineWidth(0.4);
234253
cr.arc(0, 0, 0.2, 0, Math.PI*2);
235254
cr.stroke();
@@ -241,8 +260,18 @@ MyDesklet.prototype = {
241260
cr.stroke();
242261
}
243262
} else { // classic design
263+
if(this.fill_circle_background) {
264+
const bg_fill_colors = this.fill_circle_background_color.match(/\((.*?)\)/)[1].split(",");
265+
const bg_fill_r = parseInt(bg_fill_colors[0])/255;
266+
const bg_fill_g = parseInt(bg_fill_colors[1])/255;
267+
const bg_fill_b = parseInt(bg_fill_colors[2])/255;
268+
const bg_fill_a = bg_fill_colors.length >= 4 ? parseFloat(bg_fill_colors[3]) : 1.0;
269+
cr.setSourceRGBA(bg_fill_r, bg_fill_g, bg_fill_b, bg_fill_a);
270+
cr.arc(0, 0, 0.4 - (0.19 / 2), 0, Math.PI*2);
271+
cr.fill();
272+
}
244273
if(drawFreeSpace) {
245-
cr.setSourceRGBA(1, 1, 1, 0.2);
274+
cr.setSourceRGBA(free_space_color_r, free_space_color_g, free_space_color_b, free_space_color_a);
246275
cr.setLineWidth(0.19);
247276
cr.arc(0, 0, 0.4, 0, Math.PI*2);
248277
cr.stroke();

diskspace@schorschii/files/diskspace@schorschii/po/ca.po

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgstr ""
77
"Project-Id-Version: \n"
88
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/"
99
"issues\n"
10-
"POT-Creation-Date: 2025-07-31 12:29-0400\n"
10+
"POT-Creation-Date: 2025-10-15 00:30+0200\n"
1111
"PO-Revision-Date: 2025-09-29 03:41+0200\n"
1212
"Last-Translator: Daniel <d3vf4n (at) tutanota (dot) com>\n"
1313
"Language-Team: \n"
@@ -22,26 +22,26 @@ msgstr ""
2222
"X-Poedit-SearchPath-1: settings-schema.json\n"
2323

2424
#. settings-schema.json->type->options
25-
#. desklet.js:275 desklet.js:361
25+
#. desklet.js:304 desklet.js:390
2626
msgid "RAM"
2727
msgstr "RAM"
2828

2929
#. settings-schema.json->type->options
30-
#. desklet.js:277 desklet.js:363
30+
#. desklet.js:306 desklet.js:392
3131
msgid "Swap"
3232
msgstr "Memòria d'intercanvi"
3333

3434
#. settings-schema.json->type->options
35-
#. desklet.js:279
35+
#. desklet.js:308
3636
msgid "Filesystem"
3737
msgstr "Sistema de fitxers"
3838

39-
#. desklet.js:306
39+
#. desklet.js:335
4040
msgid "Not Found"
4141
msgstr "No s'ha trobat"
4242

4343
#. metadata.json->name
44-
#. desklet.js:365
44+
#. desklet.js:394
4545
msgid "Disk Space"
4646
msgstr "Espai de disc"
4747

@@ -183,6 +183,18 @@ msgstr "Oculta les decoracions"
183183
msgid "Draw free/unused space (gray)"
184184
msgstr "Dibuixa l'espai lliure o no utilitzat (gris)"
185185

186+
#. settings-schema.json->fill-circle-background->description
187+
msgid "Fill circle background"
188+
msgstr ""
189+
190+
#. settings-schema.json->fill-circle-background->tooltip
191+
msgid "Fill the inside of the circle with color."
192+
msgstr ""
193+
194+
#. settings-schema.json->fill-circle-background-color->description
195+
msgid "Background fill color"
196+
msgstr ""
197+
186198
#. settings-schema.json->use-own-circle-color->description
187199
msgid "Use a custom circle color"
188200
msgstr "Utilitza un color de cercle personalitzat"
@@ -191,6 +203,11 @@ msgstr "Utilitza un color de cercle personalitzat"
191203
msgid "Circle color"
192204
msgstr "Color del cercle"
193205

206+
#. settings-schema.json->circle-color-free-space->description
207+
#, fuzzy
208+
msgid "Circle color for free space"
209+
msgstr "Color del cercle"
210+
194211
#. settings-schema.json->text-color->description
195212
msgid "Text color"
196213
msgstr "Color del text"

diskspace@schorschii/files/diskspace@schorschii/po/da.po

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ msgstr ""
33
"Project-Id-Version: \n"
44
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/"
55
"issues\n"
6-
"POT-Creation-Date: 2025-07-31 12:29-0400\n"
6+
"POT-Creation-Date: 2025-10-15 00:30+0200\n"
77
"PO-Revision-Date: 2023-12-08 07:38+0100\n"
88
"Last-Translator: Alan Mortensen <alanmortensen.am@gmail.com>\n"
99
"Language-Team: Dansk-gruppen <dansk@dansk-gruppen.dk>\n"
@@ -18,26 +18,26 @@ msgstr ""
1818
"X-Poedit-SearchPath-1: settings-schema.json\n"
1919

2020
#. settings-schema.json->type->options
21-
#. desklet.js:275 desklet.js:361
21+
#. desklet.js:304 desklet.js:390
2222
msgid "RAM"
2323
msgstr "RAM"
2424

2525
#. settings-schema.json->type->options
26-
#. desklet.js:277 desklet.js:363
26+
#. desklet.js:306 desklet.js:392
2727
msgid "Swap"
2828
msgstr "Swap"
2929

3030
#. settings-schema.json->type->options
31-
#. desklet.js:279
31+
#. desklet.js:308
3232
msgid "Filesystem"
3333
msgstr "Filsystem"
3434

35-
#. desklet.js:306
35+
#. desklet.js:335
3636
msgid "Not Found"
3737
msgstr "Ikke fundet"
3838

3939
#. metadata.json->name
40-
#. desklet.js:365
40+
#. desklet.js:394
4141
msgid "Disk Space"
4242
msgstr "Diskplads"
4343

@@ -178,6 +178,18 @@ msgstr "Skjul dekorering"
178178
msgid "Draw free/unused space (gray)"
179179
msgstr "Vis ledig/ubrugt plads (grå)"
180180

181+
#. settings-schema.json->fill-circle-background->description
182+
msgid "Fill circle background"
183+
msgstr ""
184+
185+
#. settings-schema.json->fill-circle-background->tooltip
186+
msgid "Fill the inside of the circle with color."
187+
msgstr ""
188+
189+
#. settings-schema.json->fill-circle-background-color->description
190+
msgid "Background fill color"
191+
msgstr ""
192+
181193
#. settings-schema.json->use-own-circle-color->description
182194
msgid "Use a custom circle color"
183195
msgstr "Brug en tilpasset farve til cirklen"
@@ -186,6 +198,11 @@ msgstr "Brug en tilpasset farve til cirklen"
186198
msgid "Circle color"
187199
msgstr "Cirkelfarve"
188200

201+
#. settings-schema.json->circle-color-free-space->description
202+
#, fuzzy
203+
msgid "Circle color for free space"
204+
msgstr "Cirkelfarve"
205+
189206
#. settings-schema.json->text-color->description
190207
msgid "Text color"
191208
msgstr "Tekstfarve"

diskspace@schorschii/files/diskspace@schorschii/po/de.po

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,41 @@ msgstr ""
33
"Project-Id-Version: \n"
44
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/"
55
"issues\n"
6-
"POT-Creation-Date: 2025-07-31 12:29-0400\n"
7-
"PO-Revision-Date: 2018-02-15 18:58+0100\n"
6+
"POT-Creation-Date: 2025-10-15 00:30+0200\n"
7+
"PO-Revision-Date: 2025-10-15 00:34+0200\n"
88
"Last-Translator: \n"
99
"Language-Team: \n"
1010
"Language: de\n"
1111
"MIME-Version: 1.0\n"
1212
"Content-Type: text/plain; charset=UTF-8\n"
1313
"Content-Transfer-Encoding: 8bit\n"
14-
"X-Generator: Poedit 1.8.7.1\n"
15-
"X-Poedit-Basepath: ..\n"
1614
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
15+
"X-Generator: Poedit 3.4.2\n"
16+
"X-Poedit-Basepath: ..\n"
1717
"X-Poedit-SearchPath-0: desklet.js\n"
1818
"X-Poedit-SearchPath-1: settings-schema.json\n"
1919

2020
#. settings-schema.json->type->options
21-
#. desklet.js:275 desklet.js:361
21+
#. desklet.js:304 desklet.js:390
2222
msgid "RAM"
2323
msgstr "Arbeitsspeicher"
2424

2525
#. settings-schema.json->type->options
26-
#. desklet.js:277 desklet.js:363
26+
#. desklet.js:306 desklet.js:392
2727
msgid "Swap"
2828
msgstr "Swap-Speicher"
2929

3030
#. settings-schema.json->type->options
31-
#. desklet.js:279
31+
#. desklet.js:308
3232
msgid "Filesystem"
3333
msgstr "Dateisystem"
3434

35-
#. desklet.js:306
35+
#. desklet.js:335
3636
msgid "Not Found"
3737
msgstr "Nicht gef."
3838

3939
#. metadata.json->name
40-
#. desklet.js:365
40+
#. desklet.js:394
4141
msgid "Disk Space"
4242
msgstr "Speicherplatzanzeige"
4343

@@ -179,6 +179,18 @@ msgstr "Dekorationen verstecken"
179179
msgid "Draw free/unused space (gray)"
180180
msgstr "Zeichne freien/unbenutzten Speicherplatz (grau)"
181181

182+
#. settings-schema.json->fill-circle-background->description
183+
msgid "Fill circle background"
184+
msgstr "Kreishintergrund ausfüllen"
185+
186+
#. settings-schema.json->fill-circle-background->tooltip
187+
msgid "Fill the inside of the circle with color."
188+
msgstr "Fülle das Innere des Kreises mit Farbe."
189+
190+
#. settings-schema.json->fill-circle-background-color->description
191+
msgid "Background fill color"
192+
msgstr "Hintergrundfüllfarbe"
193+
182194
#. settings-schema.json->use-own-circle-color->description
183195
msgid "Use a custom circle color"
184196
msgstr "Kreisfarbe selbst festlegen"
@@ -187,6 +199,10 @@ msgstr "Kreisfarbe selbst festlegen"
187199
msgid "Circle color"
188200
msgstr "Kreisfarbe"
189201

202+
#. settings-schema.json->circle-color-free-space->description
203+
msgid "Circle color for free space"
204+
msgstr "Kreisfarbe für freien Bereich"
205+
190206
#. settings-schema.json->text-color->description
191207
msgid "Text color"
192208
msgstr "Textfarbe"

diskspace@schorschii/files/diskspace@schorschii/po/diskspace@schorschii.pot

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: diskspace@schorschii 1.18\n"
99
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/"
1010
"issues\n"
11-
"POT-Creation-Date: 2025-07-31 12:29-0400\n"
11+
"POT-Creation-Date: 2025-10-15 00:30+0200\n"
1212
"PO-Revision-Date: \n"
1313
"Last-Translator: \n"
1414
"Language-Team: \n"
@@ -18,26 +18,26 @@ msgstr ""
1818
"Content-Transfer-Encoding: 8bit\n"
1919

2020
#. settings-schema.json->type->options
21-
#. desklet.js:275 desklet.js:361
21+
#. desklet.js:304 desklet.js:390
2222
msgid "RAM"
2323
msgstr ""
2424

2525
#. settings-schema.json->type->options
26-
#. desklet.js:277 desklet.js:363
26+
#. desklet.js:306 desklet.js:392
2727
msgid "Swap"
2828
msgstr ""
2929

3030
#. settings-schema.json->type->options
31-
#. desklet.js:279
31+
#. desklet.js:308
3232
msgid "Filesystem"
3333
msgstr ""
3434

35-
#. desklet.js:306
35+
#. desklet.js:335
3636
msgid "Not Found"
3737
msgstr ""
3838

3939
#. metadata.json->name
40-
#. desklet.js:365
40+
#. desklet.js:394
4141
msgid "Disk Space"
4242
msgstr ""
4343

@@ -175,6 +175,18 @@ msgstr ""
175175
msgid "Draw free/unused space (gray)"
176176
msgstr ""
177177

178+
#. settings-schema.json->fill-circle-background->description
179+
msgid "Fill circle background"
180+
msgstr ""
181+
182+
#. settings-schema.json->fill-circle-background->tooltip
183+
msgid "Fill the inside of the circle with color."
184+
msgstr ""
185+
186+
#. settings-schema.json->fill-circle-background-color->description
187+
msgid "Background fill color"
188+
msgstr ""
189+
178190
#. settings-schema.json->use-own-circle-color->description
179191
msgid "Use a custom circle color"
180192
msgstr ""
@@ -183,6 +195,10 @@ msgstr ""
183195
msgid "Circle color"
184196
msgstr ""
185197

198+
#. settings-schema.json->circle-color-free-space->description
199+
msgid "Circle color for free space"
200+
msgstr ""
201+
186202
#. settings-schema.json->text-color->description
187203
msgid "Text color"
188204
msgstr ""

0 commit comments

Comments
 (0)