bluetui
- title
- bluetui
- type
- toolbox
- summary
- Terminal Bluetooth manager for Linux that doubles as a Bluetooth HID remote for Smart TVs
- tags
- python, tui, bluetooth, linux, watchlist
- language
- Python
- license
- GPL-3.0
- created
- 2026-05-02
- updated
- 2026-05-02
Terminal Bluetooth manager for Linux written in Python. Sits on top of BlueZ via the system D-Bus, no sudo required (PolicyKit handles authorization). The headline feature isn't the device list โ it's that the same app turns the laptop into a real Bluetooth HID remote control for Smart TVs, registering as a HID device the way a stock Android-TV / Tizen / WebOS remote does.
Architecture
Built on Textual for the TUI and dbus-next for async D-Bus. The repo is organized into one module per BlueZ surface:
bluetui/
โโโ bluez.py # BluezManager โ wraps BlueZ ObjectManager over D-Bus
โโโ agent.py # org.bluez.Agent1 โ PIN/passkey/confirm dialogs
โโโ audio.py # pactl auto-routing for PulseAudio + PipeWire
โโโ classic_hid.py # Classic-BT HID Device profile (TV remote)
โโโ hid_remote.py # BLE HID over GATT (legacy, kept for testing)
โโโ remote_screen.py # virtual-remote UI screen
โโโ widgets.py # AdapterBar, DeviceList
โโโ modals.py # Confirm/Pin/Info/Help/MediaControl dialogs
Device list groups by status (connected / paired / nearby), shows RSSI bars and battery percentage, and includes the standard pair / forget / trust / block / scan / power-toggle operations bound to single keys.
Bluetooth HID remote
The distinctive feature. Most "PC as TV remote" projects either drive an IR blaster or speak the WiFi-based Android TV Remote v2 protocol. bluetui does neither โ it pretends to be a Bluetooth HID device and the TV pairs with it like it would pair with the OEM's own remote.
Implementation, per the README:
- Registers
org.bluez.Profile1with UUID0x1124(HID) - Builds an SDP record with a HID descriptor containing Consumer Control (Report ID 1) + Keyboard (Report ID 2)
- Opens raw L2CAP sockets on PSM 17 (Control) and PSM 19 (Interrupt) via
socket.AF_BLUETOOTH+BTPROTO_L2CAP - For pairing: agent switches to
NoInputNoOutputso JustWorks goes through automatically - After connect, force-disconnects A2DP/AVRCP/HSP profiles so TV audio doesn't drop into the laptop's speakers
Tested on TCL Android TV. Should work with any Samsung / LG / Sony TV that supports the BT HID-host profile, but coverage is "most but not all" โ the README is upfront that some sets don't accept HID over Bluetooth at all.
AVRCP and audio routing
When a paired audio device connects, bluetui auto-routes the system default sink to it via pactl (works on PulseAudio and PipeWire). Plays / pauses / skips via AVRCP. Volume goes through the system mixer rather than AVRCP-absolute-volume โ the README notes that's a deliberate ergonomic choice. The auto-routing has a known race with BlueZ that the app retries automatically.
Requirements
- Linux with BlueZ โฅ 5.50 (Debian 11+, Ubuntu 20.04+, current Arch)
- Python โฅ 3.9
bluetoothdrunning- For audio routing:
pulseaudioorpipewire-pulse+pactl - For the emoji icons: a monospace font with
๐บ ๐ง โจglyphs (JetBrains Mono / Fira Code Nerd / DejaVu Sans Mono)
Install:
git clone https://github.com/HelpFreedom/TUI_bluetooth.git
cd TUI_bluetooth
pip3 install --user -r requirements.txt
./bluetui.sh
(README example uses bluetui.git and cd bluetui โ the repo's actual name is TUI_bluetooth. The packaging is informal: requirements.txt + a shell wrapper, no pyproject.toml, no PyPI release.)
Hot keys: j/k move, Enter connect, p pair, f forget, t trust, b block, s scan, o power, i info, m AVRCP, r open TV remote, ? help, q quit.
Watchlist status
On the watchlist because the project is brand new โ repo created 2026-05-01 (one day before this page), zero stars, single author, no tagged releases, no test suite visible, only the Russian README, install path is pip3 install --user -r requirements.txt rather than a packaged distribution. The TV-remote HID work is real and unusual; whether it stays maintained is the open question. Re-check 2026-08-02 to see if anyone else lands a PR, the README gets translated, the install path tightens, and TV compatibility expands beyond the TCL Android TV the author tested on.
Repo
github.com/HelpFreedom/TUI_bluetooth โ 0 stars, GPL-3.0, Python primary, repo created 2026-05-01, single author. README in Russian.