config: add audio increment option
This commit is contained in:
parent
a7990173b4
commit
26171548bf
6 changed files with 17 additions and 6 deletions
|
|
@ -225,6 +225,7 @@ All configuration options are in `~/.config/caelestia/shell.json`.
|
||||||
"wallpaperDir": "~/Pictures/Wallpapers"
|
"wallpaperDir": "~/Pictures/Wallpapers"
|
||||||
},
|
},
|
||||||
"services": {
|
"services": {
|
||||||
|
"audioIncrement": 0.1,
|
||||||
"weatherLocation": "10,10",
|
"weatherLocation": "10,10",
|
||||||
"useFahrenheit": false,
|
"useFahrenheit": false,
|
||||||
"useTwelveHourClock": false
|
"useTwelveHourClock": false
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,5 @@ JsonObject {
|
||||||
property string weatherLocation: "" // A lat,long pair or empty for autodetection, e.g. "37.8267,-122.4233"
|
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 useFahrenheit: [Locale.ImperialUSSystem, Locale.ImperialSystem].includes(Qt.locale().measurementSystem)
|
||||||
property bool useTwelveHourClock: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().includes("a")
|
property bool useTwelveHourClock: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().includes("a")
|
||||||
|
property real audioIncrement: 0.1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ Item {
|
||||||
|
|
||||||
function onWheel(event: WheelEvent): void {
|
function onWheel(event: WheelEvent): void {
|
||||||
if (event.angleDelta.y > 0)
|
if (event.angleDelta.y > 0)
|
||||||
Audio.setVolume(Audio.volume + 0.1);
|
Audio.incrementVolume();
|
||||||
else if (event.angleDelta.y < 0)
|
else if (event.angleDelta.y < 0)
|
||||||
Audio.setVolume(Audio.volume - 0.1);
|
Audio.decrementVolume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,9 @@ Item {
|
||||||
|
|
||||||
onWheel: event => {
|
onWheel: event => {
|
||||||
if (event.angleDelta.y > 0)
|
if (event.angleDelta.y > 0)
|
||||||
Audio.setVolume(Audio.volume + 0.1);
|
Audio.incrementVolume();
|
||||||
else if (event.angleDelta.y < 0)
|
else if (event.angleDelta.y < 0)
|
||||||
Audio.setVolume(Audio.volume - 0.1);
|
Audio.decrementVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledSlider {
|
StyledSlider {
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ Column {
|
||||||
|
|
||||||
onWheel: event => {
|
onWheel: event => {
|
||||||
if (event.angleDelta.y > 0)
|
if (event.angleDelta.y > 0)
|
||||||
Audio.setVolume(Audio.volume + 0.1);
|
Audio.incrementVolume();
|
||||||
else if (event.angleDelta.y < 0)
|
else if (event.angleDelta.y < 0)
|
||||||
Audio.setVolume(Audio.volume - 0.1);
|
Audio.decrementVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
FilledSlider {
|
FilledSlider {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
|
import qs.config
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Services.Pipewire
|
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 {
|
function setAudioSink(newSink: PwNode): void {
|
||||||
Pipewire.preferredDefaultAudioSink = newSink;
|
Pipewire.preferredDefaultAudioSink = newSink;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue