From 1a792dbac6570d0957c2be4899dbbba66117b061 Mon Sep 17 00:00:00 2001 From: M1v1savva Date: Sun, 2 Nov 2025 04:18:42 +0100 Subject: [PATCH 1/2] Fix OSD volume bar when volume amplification is on - Add missing osdMaxValue peoperty to support volume >100% - Replace hardcoded maximumValue with dynamic osdMaxValue - Fixed the issue that involves OSD volume and brightness bars breaking when volume amplification is enabled and the volume is pushed over 100% --- kde/plasma/look-and-feel/Sweet-Mars/contents/osd/Osd.qml | 2 ++ kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/Osd.qml b/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/Osd.qml index 2288ec11..c0b6a490 100644 --- a/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/Osd.qml +++ b/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/Osd.qml @@ -37,6 +37,8 @@ PlasmaCore.Dialog { // Set to true if the value is meant for progress bar, // false for displaying the value as normal text property bool showingProgress: false + // Maximum value of progress bar (overriden for volume amplification) + property int osdMaxValue: 100 mainItem: OsdItem { rootItem: root diff --git a/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml b/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml index ea3c73a1..b2ab3208 100644 --- a/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml +++ b/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml @@ -61,7 +61,7 @@ Item { visible: rootItem.showingProgress minimumValue: 0 - maximumValue: 100 + maximumValue: rootItem.osdMaxValue value: Number(rootItem.osdValue) } From 47ed7a44190aa8b9a51f213fcc53b89d2b16011a Mon Sep 17 00:00:00 2001 From: M1v1savva Date: Sun, 2 Nov 2025 04:53:22 +0100 Subject: [PATCH 2/2] Added percentages in OSD - Now OSD displays a number on top of the bar - Sound volume percentages from 101% to 125% are displayed in orange, 126% to 150% in red (as the quality of sound decreases with sound amplification) --- .../Sweet-Mars/contents/osd/OsdItem.qml | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml b/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml index b2ab3208..0c11ca38 100644 --- a/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml +++ b/kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml @@ -35,6 +35,8 @@ Item { // | | | | // | \----------------/ | // | spacing | + // | percentage | + // | spacing | // | [progressbar/text] | // | spacing | // \--------------------/ @@ -64,7 +66,27 @@ Item { maximumValue: rootItem.osdMaxValue value: Number(rootItem.osdValue) + + PlasmaExtra.Heading { + anchors { + bottom: progressBar.top + bottomMargin: units.smallSpacing + horizontalCenter: parent.horizontalCenter + } + level: 4 + text: Math.round(progressBar.value) + "%" + color: { + if (progressBar.value <= 100) { + return theme.textColor + } else if (progressBar.value <= 125) { + return theme.neutralTextColor + } else { + return theme.negativeTextColor + } + } + } } + PlasmaExtra.Heading { id: label anchors { @@ -73,7 +95,6 @@ Item { right: parent.right margins: Math.floor(units.smallSpacing / 2) } - visible: !rootItem.showingProgress text: rootItem.showingProgress ? "" : (rootItem.osdValue ? rootItem.osdValue : "") horizontalAlignment: Text.AlignHCenter