Skip to content

Bluetooth applet displays raw BLE Name instead of Alias — devices with generic names (e.g. "net") show incorrectly #1330

@JohnnyElvis

Description

@JohnnyElvis

Description

The Bluetooth applet displays the raw org.bluez.Device1.Name D-Bus property instead of org.bluez.Device1.Alias for discovered devices. This means BLE devices that advertise a generic name (e.g., Midea smart air conditioners broadcasting Name = "net") show the unhelpful raw name even when a user-friendly Alias has been set via the BlueZ D-Bus API.

The bluer crate (which cosmic-applet-bluetooth uses) explicitly documents this in its source code at bluer/src/device.rs, in the define_properties! macro for the Name property:

"This value is only present for completeness. It is better to always use the Alias property when displaying the devices name."

"If the Alias property is unset, it will reflect this value which makes it more convenient."

And for the Alias property:

"The name alias for the remote device. The alias can be used to have a different friendly name for the remote device. In case no alias is set, it will return the remote device name."

The Alias property is strictly superior for display purposes — it returns the user-set alias if present, and automatically falls back to Name if no alias is set. There is zero regression risk.

Root Cause

In cosmic-applet-bluetooth/src/bluetooth.rs, the BluerDevice::from_device() method reads Name:

// from_device() in BluerDevice impl
let (mut name, is_paired, is_trusted, is_connected, battery_percent, icon) = futures::join!(
    device
        .name()  // ← reads org.bluez.Device1.Name (raw BLE advertisement data)
        .map(|res| res.ok().flatten().unwrap_or(device.address().to_string())),
    // ...
);

This should use device.alias() instead, which reads org.bluez.Device1.Alias.

In the bluer crate's D-Bus property definitions:

  • name()dbus: (INTERFACE, "Name", String, OPTIONAL) — returns Result<Option<String>>
  • alias()dbus: (INTERFACE, "Alias", String, MANDATORY) — returns Result<String>

Since Alias is MANDATORY in the BlueZ D-Bus spec, .flatten() is not needed when switching to alias().

Note: The same bug exists in cosmic-settings — filed as pop-os/cosmic-settings#1880.

Steps to Reproduce

  1. Have a BLE device that advertises a generic name (e.g., a Midea smart AC that broadcasts Name = "net")
  2. Set a custom alias via BlueZ D-Bus:
    busctl call org.bluez /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX \
      org.freedesktop.DBus.Properties Set ssv org.bluez.Device1 Alias s "My AC"
  3. Verify alias is set:
    busctl get-property org.bluez /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX \
      org.bluez.Device1 Alias
    # → s "My AC"
    busctl get-property org.bluez /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX \
      org.bluez.Device1 Name
    # → s "net"
  4. Open the Bluetooth applet → shows "net" instead of "My AC"

Expected Behavior

The Bluetooth applet should display the Alias property, which shows the user-friendly name when set, and falls back to Name when no alias exists (per BlueZ API documentation).

Environment

  • OS: Fedora 43
  • COSMIC Desktop: Latest from Fedora repos
  • Bluetooth adapter: Realtek RTL8852AU (USB, btusb driver)
  • BLE devices: Midea smart ACs (OUI: 54-B8-74, BC-04-35, B0-78-39) advertising Name = "net"

Suggested Fix

In cosmic-applet-bluetooth/src/bluetooth.rs, change device.name() to device.alias() in from_device():

- device
-     .name()
-     .map(|res| res.ok().flatten().unwrap_or(device.address().to_string())),
+ device
+     .alias()
+     .map(|res| res.ok().unwrap_or(device.address().to_string())),

This is a one-line change with zero regression risk since Alias falls back to Name when unset.


This bug was analysed with the assistance of Claude Opus 4.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions