1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

Better audio device names

This commit is contained in:
bbedward
2025-07-13 14:39:25 -04:00
parent d12d82c43e
commit a9b5e0b09d

View File

@@ -76,6 +76,7 @@ Singleton {
name: "", name: "",
displayName: "", displayName: "",
description: "", description: "",
nick: "",
active: false active: false
} }
} }
@@ -83,10 +84,18 @@ Singleton {
else if (line.startsWith('Name: ') && currentSink) { else if (line.startsWith('Name: ') && currentSink) {
currentSink.name = line.replace('Name: ', '').trim() currentSink.name = line.replace('Name: ', '').trim()
} }
// Get description // Get the Description field (main display name)
else if (line.includes('device.description = ') && currentSink) { else if (line.startsWith('Description: ') && currentSink) {
currentSink.description = line.replace('Description: ', '').trim()
}
// Get device.description as fallback
else if (line.includes('device.description = ') && currentSink && !currentSink.description) {
currentSink.description = line.replace('device.description = ', '').replace(/"/g, '').trim() currentSink.description = line.replace('device.description = ', '').replace(/"/g, '').trim()
} }
// Get node.nick as another fallback option
else if (line.includes('node.nick = ') && currentSink && !currentSink.description) {
currentSink.nick = line.replace('node.nick = ', '').replace(/"/g, '').trim()
}
} }
// Add the last sink // Add the last sink
@@ -97,6 +106,13 @@ Singleton {
// Process display names // Process display names
for (let sink of sinks) { for (let sink of sinks) {
let displayName = sink.description let displayName = sink.description
// If no good description, try nick
if (!displayName || displayName === sink.name) {
displayName = sink.nick
}
// Still no good name? Fall back to smart defaults
if (!displayName || displayName === sink.name) { if (!displayName || displayName === sink.name) {
if (sink.name.includes("analog-stereo")) displayName = "Built-in Speakers" if (sink.name.includes("analog-stereo")) displayName = "Built-in Speakers"
else if (sink.name.includes("bluez")) displayName = "Bluetooth Audio" else if (sink.name.includes("bluez")) displayName = "Bluetooth Audio"
@@ -105,6 +121,7 @@ Singleton {
else if (sink.name.includes("easyeffects")) displayName = "EasyEffects" else if (sink.name.includes("easyeffects")) displayName = "EasyEffects"
else displayName = sink.name else displayName = sink.name
} }
sink.displayName = displayName sink.displayName = displayName
} }