Skip to content

Commit 4b9c62c

Browse files
authored
sound150 v13.9.2: Improves menu display for Cinnamon 6.4 (#8204)
1 parent c7ad809 commit 4b9c62c

File tree

6 files changed

+170
-3
lines changed

6 files changed

+170
-3
lines changed

sound150@claudiux/files/sound150@claudiux/6.4/applet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ class Sound150Applet extends Applet.TextIconApplet {
213213
this.instanceId = instanceId;
214214

215215
this.real_ui_scale = 1.0;
216-
this.menuWidth = 450;
216+
this.menuWidth = 520;
217217
Util.spawnCommandLineAsyncIO(PATH2SCRIPTS + "/get-real-scale.py", (stdout, stderr, exitCode) => {
218218
if (exitCode === 0) {
219219
this.real_ui_scale = parseFloat(stdout);
220-
this.menuWidth = Math.round(450 * this.real_ui_scale);
220+
this.menuWidth = Math.round(520 * this.real_ui_scale);
221221
}
222222
}, {});
223223

sound150@claudiux/files/sound150@claudiux/6.4/lib/volumeSlider.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,86 @@ class VolumeSlider extends PopupMenu.PopupSliderMenuItem {
342342

343343
return this.isMic ? "microphone-sensitivity-" + icon + "-symbolic" : "audio-volume-" + icon + "-symbolic";
344344
}
345+
346+
_sliderRepaint(area) {
347+
const rtl = this.actor.get_direction() === St.TextDirection.RTL;
348+
349+
const cr = area.get_context();
350+
const themeNode = area.get_theme_node();
351+
var [width, height] = area.get_surface_size();
352+
//~ width = Math.trunc(width * this.applet.real_ui_scale);
353+
354+
const handleRadius = themeNode.get_length('-slider-handle-radius');
355+
356+
const sliderWidth = width - 2 * handleRadius;
357+
const sliderHeight = themeNode.get_length('-slider-height');
358+
359+
const sliderBorderWidth = themeNode.get_length('-slider-border-width');
360+
const sliderBorderRadius = Math.min(width, sliderHeight) / 2;
361+
362+
const sliderBorderColor = themeNode.get_color('-slider-border-color');
363+
const sliderColor = themeNode.get_color('-slider-background-color');
364+
365+
const sliderActiveBorderColor = themeNode.get_color('-slider-active-border-color');
366+
const sliderActiveColor = themeNode.get_color('-slider-active-background-color');
367+
368+
const TAU = Math.PI * 2;
369+
370+
const handleX = rtl ?
371+
width - handleRadius - sliderWidth * this._value :
372+
handleRadius + sliderWidth * this._value;
373+
const handleY = height / 2;
374+
375+
let sliderLeftBorderColor = sliderActiveBorderColor;
376+
let sliderLeftColor = sliderActiveColor;
377+
let sliderRightBorderColor = sliderBorderColor;
378+
let sliderRightColor = sliderColor;
379+
if (rtl) {
380+
sliderLeftColor = sliderColor;
381+
sliderLeftBorderColor = sliderBorderColor;
382+
sliderRightColor = sliderActiveColor;
383+
sliderRightBorderColor = sliderActiveBorderColor;
384+
}
385+
386+
cr.arc(sliderBorderRadius + sliderBorderWidth, handleY, sliderBorderRadius, TAU * 1/4, TAU * 3/4);
387+
cr.lineTo(handleX, (height - sliderHeight) / 2);
388+
cr.lineTo(handleX, (height + sliderHeight) / 2);
389+
cr.lineTo(sliderBorderRadius + sliderBorderWidth, (height + sliderHeight) / 2);
390+
Clutter.cairo_set_source_color(cr, sliderLeftColor);
391+
cr.fillPreserve();
392+
Clutter.cairo_set_source_color(cr, sliderLeftBorderColor);
393+
cr.setLineWidth(sliderBorderWidth);
394+
cr.stroke();
395+
396+
cr.arc(width - sliderBorderRadius - sliderBorderWidth, handleY, sliderBorderRadius, TAU * 3/4, TAU * 1/4);
397+
cr.lineTo(handleX, (height + sliderHeight) / 2);
398+
cr.lineTo(handleX, (height - sliderHeight) / 2);
399+
cr.lineTo(width - sliderBorderRadius - sliderBorderWidth, (height - sliderHeight) / 2);
400+
Clutter.cairo_set_source_color(cr, sliderRightColor);
401+
cr.fillPreserve();
402+
Clutter.cairo_set_source_color(cr, sliderRightBorderColor);
403+
cr.setLineWidth(sliderBorderWidth);
404+
cr.stroke();
405+
406+
const color = themeNode.get_foreground_color();
407+
Clutter.cairo_set_source_color(cr, color);
408+
cr.arc(handleX, handleY, handleRadius, 0, TAU);
409+
cr.fill();
410+
411+
// Draw a mark to indicate a certain value
412+
if (this._mark_position > 0) {
413+
const markWidth = 2;
414+
const markHeight = sliderHeight + 4;
415+
const xMark = rtl ?
416+
width - sliderWidth * this._mark_position - markWidth / 2 :
417+
sliderWidth * this._mark_position + markWidth / 2;
418+
const yMark = height / 2 - markHeight / 2;
419+
cr.rectangle(xMark, yMark, markWidth, markHeight);
420+
cr.fill();
421+
}
422+
423+
cr.$dispose();
424+
}
345425
}
346426

347427
module.exports = {

sound150@claudiux/files/sound150@claudiux/6.6/lib/s150PopupMenu.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,7 @@ class Seeker extends Slider.Slider {
12471247
if (this.actor.get_stage() == null || this.destroyed) return;
12481248
const [sliderX, sliderY] = this.actor.get_transformed_position();
12491249
const width = this.actor.width;
1250+
//~ this.actor.width = width * this._applet.real_ui_scale; // ADDED
12501251
let [x, y] = this.tooltip.mousePosition;
12511252
if (this.tooltip) {
12521253
this.tooltip.hide();

sound150@claudiux/files/sound150@claudiux/6.6/lib/volumeSlider.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,88 @@ class VolumeSlider extends PopupMenu.PopupSliderMenuItem {
342342

343343
return this.isMic ? "microphone-sensitivity-" + icon + "-symbolic" : "audio-volume-" + icon + "-symbolic";
344344
}
345+
346+
_sliderRepaint(area) {
347+
const rtl = this.actor.get_direction() === St.TextDirection.RTL;
348+
349+
const cr = area.get_context();
350+
const themeNode = area.get_theme_node();
351+
var [width, height] = area.get_surface_size();
352+
//~ global.log("width1: " + width);
353+
//~ width = Math.trunc(width * this.applet.real_ui_scale);
354+
//~ global.log("width2: " + width);
355+
356+
const handleRadius = themeNode.get_length('-slider-handle-radius');
357+
358+
const sliderWidth = width - 2 * handleRadius;
359+
const sliderHeight = themeNode.get_length('-slider-height');
360+
361+
const sliderBorderWidth = themeNode.get_length('-slider-border-width');
362+
const sliderBorderRadius = Math.min(width, sliderHeight) / 2;
363+
364+
const sliderBorderColor = themeNode.get_color('-slider-border-color');
365+
const sliderColor = themeNode.get_color('-slider-background-color');
366+
367+
const sliderActiveBorderColor = themeNode.get_color('-slider-active-border-color');
368+
const sliderActiveColor = themeNode.get_color('-slider-active-background-color');
369+
370+
const TAU = Math.PI * 2;
371+
372+
const handleX = rtl ?
373+
width - handleRadius - sliderWidth * this._value :
374+
handleRadius + sliderWidth * this._value;
375+
const handleY = height / 2;
376+
377+
let sliderLeftBorderColor = sliderActiveBorderColor;
378+
let sliderLeftColor = sliderActiveColor;
379+
let sliderRightBorderColor = sliderBorderColor;
380+
let sliderRightColor = sliderColor;
381+
if (rtl) {
382+
sliderLeftColor = sliderColor;
383+
sliderLeftBorderColor = sliderBorderColor;
384+
sliderRightColor = sliderActiveColor;
385+
sliderRightBorderColor = sliderActiveBorderColor;
386+
}
387+
388+
cr.arc(sliderBorderRadius + sliderBorderWidth, handleY, sliderBorderRadius, TAU * 1/4, TAU * 3/4);
389+
cr.lineTo(handleX, (height - sliderHeight) / 2);
390+
cr.lineTo(handleX, (height + sliderHeight) / 2);
391+
cr.lineTo(sliderBorderRadius + sliderBorderWidth, (height + sliderHeight) / 2);
392+
Clutter.cairo_set_source_color(cr, sliderLeftColor);
393+
cr.fillPreserve();
394+
Clutter.cairo_set_source_color(cr, sliderLeftBorderColor);
395+
cr.setLineWidth(sliderBorderWidth);
396+
cr.stroke();
397+
398+
cr.arc(width - sliderBorderRadius - sliderBorderWidth, handleY, sliderBorderRadius, TAU * 3/4, TAU * 1/4);
399+
cr.lineTo(handleX, (height + sliderHeight) / 2);
400+
cr.lineTo(handleX, (height - sliderHeight) / 2);
401+
cr.lineTo(width - sliderBorderRadius - sliderBorderWidth, (height - sliderHeight) / 2);
402+
Clutter.cairo_set_source_color(cr, sliderRightColor);
403+
cr.fillPreserve();
404+
Clutter.cairo_set_source_color(cr, sliderRightBorderColor);
405+
cr.setLineWidth(sliderBorderWidth);
406+
cr.stroke();
407+
408+
const color = themeNode.get_foreground_color();
409+
Clutter.cairo_set_source_color(cr, color);
410+
cr.arc(handleX, handleY, handleRadius, 0, TAU);
411+
cr.fill();
412+
413+
// Draw a mark to indicate a certain value
414+
if (this._mark_position > 0) {
415+
const markWidth = 2;
416+
const markHeight = sliderHeight + 4;
417+
const xMark = rtl ?
418+
width - sliderWidth * this._mark_position - markWidth / 2 :
419+
sliderWidth * this._mark_position + markWidth / 2;
420+
const yMark = height / 2 - markHeight / 2;
421+
cr.rectangle(xMark, yMark, markWidth, markHeight);
422+
cr.fill();
423+
}
424+
425+
cr.$dispose();
426+
}
345427
}
346428

347429
module.exports = {

sound150@claudiux/files/sound150@claudiux/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v13.9.2~20260114
2+
* Improves menu display for Cinnamon 6.4.
3+
* Fixes [#8201](https://github.com/linuxmint/cinnamon-spices-applets/issues/8201)
4+
15
### v13.9.1~20260112
26
* Restore this applet for Cinnamon 6.4 (same as v13.8.2).
37
* Fixes [#8183](https://github.com/linuxmint/cinnamon-spices-applets/issues/8183)

sound150@claudiux/files/sound150@claudiux/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"max-instances": "1",
66
"description": "Enhanced sound applet",
77
"hide-configuration": false,
8-
"version": "13.9.1",
8+
"version": "13.9.2",
99
"cinnamon-version": [
1010
"2.8",
1111
"3.0",

0 commit comments

Comments
 (0)