From b6803aa269ac112c58e54be7ac91d2b8e9834932 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Tue, 19 May 2026 19:59:27 -0400 Subject: [PATCH] Fix bluetooth --- config/systemd/user/bt-agent.service | 19 +++++++++++++++++++ install/config/hardware/bluetooth.sh | 7 +++++++ install/omarchy-base.packages | 3 +++ migrations/1779232736.sh | 20 ++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 config/systemd/user/bt-agent.service create mode 100644 migrations/1779232736.sh diff --git a/config/systemd/user/bt-agent.service b/config/systemd/user/bt-agent.service new file mode 100644 index 00000000..d44a441e --- /dev/null +++ b/config/systemd/user/bt-agent.service @@ -0,0 +1,19 @@ +[Unit] +Description=Bluetooth pairing agent (auto-accept) +Documentation=man:bt-agent(1) +# bluez must be reachable on the system bus before we can register. +After=dbus.socket +Requires=dbus.socket + +[Service] +Type=simple +# NoInputNoOutput auto-accepts pair requests. Safe because the adapter +# is only `pairable: true` when the user explicitly opens the omarchy +# bluetoothPanel and starts scanning; outside that window bluez refuses +# inbound pair attempts at a lower layer. +ExecStart=/usr/bin/bt-agent -c NoInputNoOutput +Restart=on-failure +RestartSec=2 + +[Install] +WantedBy=graphical-session.target diff --git a/install/config/hardware/bluetooth.sh b/install/config/hardware/bluetooth.sh index 2187b1d7..e76d03de 100644 --- a/install/config/hardware/bluetooth.sh +++ b/install/config/hardware/bluetooth.sh @@ -6,3 +6,10 @@ sudo sed -i 's/^#\?AutoEnable=.*/AutoEnable=false/' /etc/bluetooth/main.conf mkdir -p ~/.config/wireplumber/wireplumber.conf.d/ cp "$OMARCHY_PATH/default/wireplumber/wireplumber.conf.d/bluetooth-a2dp-autoconnect.conf" ~/.config/wireplumber/wireplumber.conf.d/ + +# Quickshell.Bluetooth has no Agent API, so the omarchy-shell bluetoothPanel +# can't answer the auth prompts bluez issues during pair(). bt-agent registers +# a NoInputNoOutput agent on the system bus so pair() actually completes. +mkdir -p ~/.config/systemd/user/ +cp "$OMARCHY_PATH/config/systemd/user/bt-agent.service" ~/.config/systemd/user/ +systemctl --user enable bt-agent.service diff --git a/install/omarchy-base.packages b/install/omarchy-base.packages index d5eec352..05696f53 100644 --- a/install/omarchy-base.packages +++ b/install/omarchy-base.packages @@ -9,6 +9,9 @@ asdcontrol avahi bash-completion bat +bluez +bluez-tools +bluez-utils bolt brightnessctl btop diff --git a/migrations/1779232736.sh b/migrations/1779232736.sh new file mode 100644 index 00000000..c554d7fb --- /dev/null +++ b/migrations/1779232736.sh @@ -0,0 +1,20 @@ +echo "Install bluetooth pairing agent for the shell bluetoothPanel" + +# Hold bluez explicit so a future cascade-remove (e.g. uninstalling a TUI +# that listed it as a dep) doesn't take it down with it. Idempotent if it +# already is. +omarchy-cmd-present pacman && sudo pacman -D --asexplicit bluez >/dev/null 2>&1 || true + +# Quickshell.Bluetooth exposes pair()/trust()/connect() but no Agent surface, +# so the bluetoothPanel can't answer the auth prompts bluez issues during +# pair(). Without an org.bluez.Agent1 registered, pair() stalls at the +# confirmation step and the device ends up half-paired (Paired:no, +# Trusted:yes), then connect attempts fail with br-connection-key-missing. +# bluez-tools' bt-agent fills that gap; bluez-utils provides bluetoothctl +# for manual recovery. +omarchy-pkg-add bluez-utils bluez-tools + +mkdir -p ~/.config/systemd/user/ +cp "$OMARCHY_PATH/config/systemd/user/bt-agent.service" ~/.config/systemd/user/ +systemctl --user daemon-reload +systemctl --user enable --now bt-agent.service