mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
@@ -137,6 +137,7 @@
|
||||
},
|
||||
"audio": {
|
||||
"volumeStep": 5,
|
||||
"volumeOverdrive": false,
|
||||
"cavaFrameRate": 60,
|
||||
"visualizerType": "linear",
|
||||
"mprisBlacklist": [],
|
||||
|
||||
@@ -261,6 +261,7 @@ Singleton {
|
||||
// audio
|
||||
property JsonObject audio: JsonObject {
|
||||
property int volumeStep: 5
|
||||
property bool volumeOverdrive: false
|
||||
property int cavaFrameRate: 60
|
||||
property string visualizerType: "linear"
|
||||
property list<string> mprisBlacklist: []
|
||||
|
||||
@@ -93,7 +93,7 @@ Item {
|
||||
icon: getIcon()
|
||||
compact: (Settings.data.bar.density === "compact")
|
||||
autoHide: false // Important to be false so we can hover as long as we want
|
||||
text: Math.floor(AudioService.inputVolume * 100)
|
||||
text: Math.round(AudioService.inputVolume * 100)
|
||||
suffix: "%"
|
||||
forceOpen: displayMode === "alwaysShow"
|
||||
forceClose: displayMode === "alwaysHide"
|
||||
|
||||
@@ -79,7 +79,7 @@ Item {
|
||||
rightOpen: BarService.getPillDirection(root)
|
||||
icon: getIcon()
|
||||
autoHide: false // Important to be false so we can hover as long as we want
|
||||
text: Math.floor(AudioService.volume * 100)
|
||||
text: Math.round(AudioService.volume * 100)
|
||||
suffix: "%"
|
||||
forceOpen: displayMode === "alwaysShow"
|
||||
forceClose: displayMode === "alwaysHide"
|
||||
|
||||
+5
-1
@@ -70,7 +70,11 @@ Loader {
|
||||
// Get progress bar color
|
||||
function getProgressColor() {
|
||||
if (osdType === OSD.Type.Volume) {
|
||||
return isMuted ? Color.mError : Color.mPrimary
|
||||
if (isMuted)
|
||||
return Color.mError
|
||||
if (currentVolume > 1.0)
|
||||
return Color.mError
|
||||
return Color.mPrimary
|
||||
} else {
|
||||
return Color.mPrimary
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@ ColumnLayout {
|
||||
NValueSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
to: Settings.data.audio.volumeOverdrive ? 2.0 : 1.0
|
||||
to: Settings.data.audio.volumeOverdrive ? 1.5 : 1.0
|
||||
value: localVolume
|
||||
stepSize: 0.01
|
||||
text: Math.floor(AudioService.volume * 100) + "%"
|
||||
text: Math.round(AudioService.volume * 100) + "%"
|
||||
onMoved: {
|
||||
localVolume = value
|
||||
}
|
||||
@@ -91,10 +91,10 @@ ColumnLayout {
|
||||
NValueSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
to: 1.0
|
||||
to: Settings.data.audio.volumeOverdrive ? 1.5 : 1.0
|
||||
value: AudioService.inputVolume
|
||||
stepSize: 0.01
|
||||
text: Math.floor(AudioService.inputVolume * 100) + "%"
|
||||
text: Math.round(AudioService.inputVolume * 100) + "%"
|
||||
onMoved: value => AudioService.setInputVolume(value)
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,19 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// Raise maximum volume above 100%
|
||||
ColumnLayout {
|
||||
spacing: Style.marginS * scaling
|
||||
Layout.fillWidth: true
|
||||
|
||||
NToggle {
|
||||
label: "Allow volume overdrive"
|
||||
description: "Allow raising volume above 100%."
|
||||
checked: Settings.data.audio.volumeOverdrive
|
||||
onToggled: checked => Settings.data.audio.volumeOverdrive = checked
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginXL * scaling
|
||||
|
||||
@@ -96,7 +96,7 @@ Singleton {
|
||||
if (sink?.ready && sink?.audio) {
|
||||
// Clamp it accordingly
|
||||
sink.audio.muted = false
|
||||
sink.audio.volume = Math.max(0, Math.min(1, newVolume))
|
||||
sink.audio.volume = Math.max(0, Math.min(Settings.data.audio.volumeOverdrive ? 1.5 : 1.0, newVolume))
|
||||
//Logger.log("AudioService", "SetVolume", sink.audio.volume);
|
||||
} else {
|
||||
Logger.warn("AudioService", "No sink available")
|
||||
@@ -115,7 +115,7 @@ Singleton {
|
||||
if (source?.ready && source?.audio) {
|
||||
// Clamp it accordingly
|
||||
source.audio.muted = false
|
||||
source.audio.volume = Math.max(0, Math.min(1, newVolume))
|
||||
source.audio.volume = Math.max(0, Math.min(Settings.data.audio.volumeOverdrive ? 1.5 : 1.0, newVolume))
|
||||
} else {
|
||||
Logger.warn("AudioService", "No source available")
|
||||
}
|
||||
@@ -131,9 +131,15 @@ Singleton {
|
||||
|
||||
function setAudioSink(newSink: PwNode): void {
|
||||
Pipewire.preferredDefaultAudioSink = newSink
|
||||
// Volume is changed by the sink change
|
||||
root._volume = newSink?.audio?.volume ?? 0
|
||||
root._muted = !!newSink?.audio?.muted
|
||||
}
|
||||
|
||||
function setAudioSource(newSource: PwNode): void {
|
||||
Pipewire.preferredDefaultAudioSource = newSource
|
||||
// Volume is changed by the source change
|
||||
root._inputVolume = newSource?.audio?.volume ?? 0
|
||||
root._inputMuted = !!newSource?.audio?.muted
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user