From 9824f0474e3278c13ef48af30def05aae3e4b05b Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Tue, 15 Sep 2026 12:16:57 -0400 Subject: [PATCH] fixing airpods for the millionth time --- modules/nixos/desktop/fixes/ABOUTME.md | 10 ++++++---- modules/nixos/desktop/fixes/default.nix | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/modules/nixos/desktop/fixes/ABOUTME.md b/modules/nixos/desktop/fixes/ABOUTME.md index de51200..872c187 100644 --- a/modules/nixos/desktop/fixes/ABOUTME.md +++ b/modules/nixos/desktop/fixes/ABOUTME.md @@ -6,13 +6,15 @@ Various workarounds and fixes for desktop/workstation issues. ``` fixes/ -└── default.nix # skyg.nixos.desktop.fixes.airpod-bluetooth.enabled — AirPods distorted/robotic audio fix +└── default.nix # skyg.nixos.desktop.fixes.airpod-bluetooth.enabled — AirPods HFP mic ``` ## Behaviour ### AirPods Bluetooth Audio Fix + When `skyg.nixos.desktop.fixes.airpod-bluetooth.enabled` is set to `true`: -- WirePlumber's auto-switching behavior is disabled for the AirPods. -- Prevents switching from high-quality A2DP profile to low-quality HFP/HSP mono profile when a mic stream opens. -- Dictates that AirPods stay in A2DP permanently, while meeting/chat apps fall back to the laptop's built-in mic for input. + +- WirePlumber auto-switches AirPods from A2DP to HFP when an app opens a mic. +- Enables native HFP plus mSBC so the AirPods mic shows as an input. +- Call audio is headset quality (mSBC if the buds support it), not A2DP. diff --git a/modules/nixos/desktop/fixes/default.nix b/modules/nixos/desktop/fixes/default.nix index ce2e676..40ab379 100644 --- a/modules/nixos/desktop/fixes/default.nix +++ b/modules/nixos/desktop/fixes/default.nix @@ -5,25 +5,30 @@ in { options = { skyg.nixos.desktop.fixes.airpod-bluetooth = { - enabled = lib.mkEnableOption "Fix robotic/distorted audio with AirPods over Bluetooth"; + enabled = lib.mkEnableOption "AirPods Bluetooth mic via HFP (lower call quality)"; }; }; config = lib.mkIf (cfg.enabled && config.skyg.nixos.desktop.enable) { - # Fix robotic/distorted audio with AirPods over Bluetooth. - # WirePlumber 0.5 (nixpkgs 26.05+) auto-switches BT devices from A2DP to - # HFP whenever any app opens a mic stream (Chromium, Slack, etc.), which - # degrades both speaker and mic quality to 8 kHz CVSD/mSBC and causes the - # robotic sound. Disabling auto-switch keeps AirPods in A2DP permanently; - # meeting apps fall back to the laptop's built-in mic for input. + # Switch AirPods to HFP when a mic is needed so the AirPods mic + # shows as an input. Call audio is HFP (mSBC if supported), not A2DP. services.pipewire.wireplumber.extraConfig = { "51-airpods-bluetooth" = { "monitor.bluez.properties" = { - "bluez5.msbc-support" = false; + "bluez5.enable-msbc" = true; + "bluez5.msbc-support" = true; "bluez5.hfphsp-backend" = "native"; + "bluez5.roles" = [ + "a2dp_sink" + "a2dp_source" + "hsp_hs" + "hsp_ag" + "hfp_hf" + "hfp_ag" + ]; }; "wireplumber.settings" = { - "bluetooth.autoswitch-to-headset-profile" = false; + "bluetooth.autoswitch-to-headset-profile" = true; }; }; };