refactor(bluetooth): resolve device icons from GTK icon theme

_check_icon_to_type now queries Gtk.IconTheme for the icon name
(with -symbolic suffix) before falling back to a hardcoded mapping.
_get_icon_for_device simplified since type property now returns
GTK icon names directly.
This commit is contained in:
sankalp committed 2026-07-12 19:07:41 +05:45
1 parent 15e64df428
commit 01aac24f7e
2 files changed
+25 -22

No files matched your search

+1 -11
View File
@@ -143,19 +143,9 @@ class BluetoothDeviceSlot(Box):
self.device.emit("changed")
def _get_icon_for_device(self, device) -> str:
dtype = getattr(device, "type", None) or getattr(
return getattr(device, "type", None) or getattr(
device, "icon_name", "bluetooth"
)
return {
"Headset": "audio-headset-symbolic",
"Headphones": "audio-headphones-symbolic",
"Speaker": "audio-speakers-symbolic",
"Keyboard": "input-keyboard-symbolic",
"Mouse": "input-mouse-symbolic",
"Joypad": "input-gaming-symbolic",
"Phone": "phone-symbolic",
"Printer": "printer-symbolic",
}.get(dtype, dtype + "-symbolic" if not dtype.endswith("-symbolic") else dtype)
def destroy(self):
"""Clean up device signal connections to prevent memory leaks."""