summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-05 18:20:00 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-05 18:20:00 +1000
commit26171548bff3fdc959af5368a16d61847dc05f22 (patch)
tree102043d9e650cb6a2c0a957d81ecec6ab0bbefa9
parentaudio: clamp volume (diff)
downloadcaelestia-shell-26171548bff3fdc959af5368a16d61847dc05f22.tar.gz
caelestia-shell-26171548bff3fdc959af5368a16d61847dc05f22.tar.bz2
caelestia-shell-26171548bff3fdc959af5368a16d61847dc05f22.zip
config: add audio increment option
-rw-r--r--README.md1
-rw-r--r--config/ServiceConfig.qml1
-rw-r--r--modules/bar/components/ActiveWindow.qml4
-rw-r--r--modules/bar/popouts/Audio.qml4
-rw-r--r--modules/osd/Content.qml4
-rw-r--r--services/Audio.qml9
6 files changed, 17 insertions, 6 deletions
diff --git a/README.md b/README.md
index 58bcd73..fed74e8 100644
--- a/README.md
+++ b/README.md
@@ -225,6 +225,7 @@ All configuration options are in `~/.config/caelestia/shell.json`.
"wallpaperDir": "~/Pictures/Wallpapers"
},
"services": {
+ "audioIncrement": 0.1,
"weatherLocation": "10,10",
"useFahrenheit": false,
"useTwelveHourClock": false
diff --git a/config/ServiceConfig.qml b/config/ServiceConfig.qml
index 5c48fcb..8348330 100644
--- a/config/ServiceConfig.qml
+++ b/config/ServiceConfig.qml
@@ -5,4 +5,5 @@ JsonObject {
property string weatherLocation: "" // A lat,long pair or empty for autodetection, e.g. "37.8267,-122.4233"
property bool useFahrenheit: [Locale.ImperialUSSystem, Locale.ImperialSystem].includes(Qt.locale().measurementSystem)
property bool useTwelveHourClock: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().includes("a")
+ property real audioIncrement: 0.1
}
diff --git a/modules/bar/components/ActiveWindow.qml b/modules/bar/components/ActiveWindow.qml
index ed4c90d..de4202d 100644
--- a/modules/bar/components/ActiveWindow.qml
+++ b/modules/bar/components/ActiveWindow.qml
@@ -25,9 +25,9 @@ Item {
function onWheel(event: WheelEvent): void {
if (event.angleDelta.y > 0)
- Audio.setVolume(Audio.volume + 0.1);
+ Audio.incrementVolume();
else if (event.angleDelta.y < 0)
- Audio.setVolume(Audio.volume - 0.1);
+ Audio.decrementVolume();
}
}
diff --git a/modules/bar/popouts/Audio.qml b/modules/bar/popouts/Audio.qml
index 1d79baa..bb35af8 100644
--- a/modules/bar/popouts/Audio.qml
+++ b/modules/bar/popouts/Audio.qml
@@ -87,9 +87,9 @@ Item {
onWheel: event => {
if (event.angleDelta.y > 0)
- Audio.setVolume(Audio.volume + 0.1);
+ Audio.incrementVolume();
else if (event.angleDelta.y < 0)
- Audio.setVolume(Audio.volume - 0.1);
+ Audio.decrementVolume();
}
StyledSlider {
diff --git a/modules/osd/Content.qml b/modules/osd/Content.qml
index 29b1b39..09a4ca6 100644
--- a/modules/osd/Content.qml
+++ b/modules/osd/Content.qml
@@ -22,9 +22,9 @@ Column {
onWheel: event => {
if (event.angleDelta.y > 0)
- Audio.setVolume(Audio.volume + 0.1);
+ Audio.incrementVolume();
else if (event.angleDelta.y < 0)
- Audio.setVolume(Audio.volume - 0.1);
+ Audio.decrementVolume();
}
FilledSlider {
diff --git a/services/Audio.qml b/services/Audio.qml
index ed2e41b..e156e6e 100644
--- a/services/Audio.qml
+++ b/services/Audio.qml
@@ -1,5 +1,6 @@
pragma Singleton
+import qs.config
import Quickshell
import Quickshell.Services.Pipewire
@@ -35,6 +36,14 @@ Singleton {
}
}
+ function incrementVolume(amount: real): void {
+ setVolume(volume + (amount || Config.services.audioIncrement));
+ }
+
+ function decrementVolume(amount: real): void {
+ setVolume(volume - (amount || Config.services.audioIncrement));
+ }
+
function setAudioSink(newSink: PwNode): void {
Pipewire.preferredDefaultAudioSink = newSink;
}