From dde0f85e78755fa50902f29a4bca6d29ae345867 Mon Sep 17 00:00:00 2001 From: Robin Seger Date: Mon, 13 Oct 2025 13:50:56 +0200 Subject: feat: configurable max volume (#723) * feat: configurable max volume - Add maxVolume config option to ServiceConfig - Add maxValue property to FilledSlider component - Update OSD sliders to respect maxVolume setting - Update example config in README * fix: remove redundant maxValue prop --- README.md | 1 + config/ServiceConfig.qml | 1 + modules/osd/Content.qml | 2 ++ services/Audio.qml | 4 ++-- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1daa22a..d8be30a 100644 --- a/README.md +++ b/README.md @@ -546,6 +546,7 @@ default, you must create it manually. }, "services": { "audioIncrement": 0.1, + "maxVolume": 1.0, "defaultPlayer": "Spotify", "gpuType": "", "playerAliases": [{ "from": "com.github.th_ch.youtube_music", "to": "YT Music" }], diff --git a/config/ServiceConfig.qml b/config/ServiceConfig.qml index c9752d7..36a51aa 100644 --- a/config/ServiceConfig.qml +++ b/config/ServiceConfig.qml @@ -8,6 +8,7 @@ JsonObject { property string gpuType: "" property int visualiserBars: 45 property real audioIncrement: 0.1 + property real maxVolume: 1.0 property bool smartScheme: true property string defaultPlayer: "Spotify" property list playerAliases: [ diff --git a/modules/osd/Content.qml b/modules/osd/Content.qml index 639de77..619810f 100644 --- a/modules/osd/Content.qml +++ b/modules/osd/Content.qml @@ -46,6 +46,7 @@ Item { icon: Icons.getVolumeIcon(value, root.muted) value: root.volume + to: Config.services.maxVolume onMoved: Audio.setVolume(value) } } @@ -70,6 +71,7 @@ Item { icon: Icons.getMicVolumeIcon(value, root.sourceMuted) value: root.sourceVolume + to: Config.services.maxVolume onMoved: Audio.setSourceVolume(value) } } diff --git a/services/Audio.qml b/services/Audio.qml index bc87d46..71ccb86 100644 --- a/services/Audio.qml +++ b/services/Audio.qml @@ -44,7 +44,7 @@ Singleton { function setVolume(newVolume: real): void { if (sink?.ready && sink?.audio) { sink.audio.muted = false; - sink.audio.volume = Math.max(0, Math.min(1, newVolume)); + sink.audio.volume = Math.max(0, Math.min(Config.services.maxVolume, newVolume)); } } @@ -59,7 +59,7 @@ Singleton { function setSourceVolume(newVolume: real): void { if (source?.ready && source?.audio) { source.audio.muted = false; - source.audio.volume = Math.max(0, Math.min(1, newVolume)); + source.audio.volume = Math.max(0, Math.min(Config.services.maxVolume, newVolume)); } } -- cgit v1.2.3-freya