mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
AudioService: properly filter outputs with no inputs
AudioCard & OSD: use said detection
This commit is contained in:
@@ -511,6 +511,9 @@ Variants {
|
||||
if (!inputAudioInitialized) {
|
||||
return
|
||||
}
|
||||
if (!AudioService.hasInput) {
|
||||
return
|
||||
}
|
||||
showOSD("inputVolume")
|
||||
}
|
||||
|
||||
@@ -518,6 +521,9 @@ Variants {
|
||||
if (!inputAudioInitialized) {
|
||||
return
|
||||
}
|
||||
if (!AudioService.hasInput) {
|
||||
return
|
||||
}
|
||||
showOSD("inputVolume")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,19 @@ import qs.Widgets
|
||||
NBox {
|
||||
id: root
|
||||
|
||||
property real localOutputVolume: AudioService.volume || 0
|
||||
property real localOutputVolume: 0
|
||||
property bool localOutputVolumeChanging: false
|
||||
|
||||
property real localInputVolume: AudioService.inputVolume || 0
|
||||
property real localInputVolume: 0
|
||||
property bool localInputVolumeChanging: false
|
||||
|
||||
Component.onCompleted: {
|
||||
var vol = AudioService.volume
|
||||
localOutputVolume = (vol !== undefined && !isNaN(vol)) ? vol : 0
|
||||
var inputVol = AudioService.inputVolume
|
||||
localInputVolume = (inputVol !== undefined && !isNaN(inputVol)) ? inputVol : 0
|
||||
}
|
||||
|
||||
// Timer to debounce volume changes
|
||||
Timer {
|
||||
interval: 100
|
||||
@@ -31,11 +38,32 @@ NBox {
|
||||
}
|
||||
|
||||
// Connections to update local volumes when AudioService changes
|
||||
Connections {
|
||||
target: AudioService
|
||||
function onVolumeChanged() {
|
||||
if (!localOutputVolumeChanging) {
|
||||
var vol = AudioService.volume
|
||||
localOutputVolume = (vol !== undefined && !isNaN(vol)) ? vol : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: AudioService.sink?.audio ? AudioService.sink?.audio : null
|
||||
function onVolumeChanged() {
|
||||
if (!localOutputVolumeChanging) {
|
||||
localOutputVolume = AudioService.volume
|
||||
var vol = AudioService.volume
|
||||
localOutputVolume = (vol !== undefined && !isNaN(vol)) ? vol : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: AudioService
|
||||
function onInputVolumeChanged() {
|
||||
if (!localInputVolumeChanging) {
|
||||
var vol = AudioService.inputVolume
|
||||
localInputVolume = (vol !== undefined && !isNaN(vol)) ? vol : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +72,8 @@ NBox {
|
||||
target: AudioService.source?.audio ? AudioService.source?.audio : null
|
||||
function onVolumeChanged() {
|
||||
if (!localInputVolumeChanging) {
|
||||
localInputVolume = AudioService.inputVolume
|
||||
var vol = AudioService.inputVolume
|
||||
localInputVolume = (vol !== undefined && !isNaN(vol)) ? vol : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user