From cf4f48069f24a522f0bab88f3523685bfe8f13da Mon Sep 17 00:00:00 2001 From: bbedward Date: Fri, 7 Aug 2026 18:39:23 -0400 Subject: [PATCH] fix(bluetooth): derive codec from locale-independent profile name in bluez-card-profile.lua fixes #3004 port 1.5 --- quickshell/scripts/bluez-card-profile.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/quickshell/scripts/bluez-card-profile.lua b/quickshell/scripts/bluez-card-profile.lua index 28a09460c..37d87b764 100755 --- a/quickshell/scripts/bluez-card-profile.lua +++ b/quickshell/scripts/bluez-card-profile.lua @@ -29,10 +29,24 @@ local function profile_available(profile) return profile and profile.available ~= "no" end +local codec_profile_prefixes = { + "^a2dp%-sink%-(.+)$", + "^a2dp%-source%-(.+)$", + "^headset%-head%-unit%-(.+)$", + "^headset%-audio%-gateway%-(.+)$", +} + local function codec_from_profile(profile) if not profile then return "" end + local name = profile.name or "" + for _, pattern in ipairs(codec_profile_prefixes) do + local codec = name:match(pattern) + if codec then + return codec:gsub("%-", "_"):upper() + end + end local desc = profile.description or "" local codec = desc:match("[Cc]odec%s+([%w%+%-%._]+)") if not codec then