diff --git a/blueman/main/Manager.py b/blueman/main/Manager.py
index c5f696620..758be915c 100644
--- a/blueman/main/Manager.py
+++ b/blueman/main/Manager.py
@@ -84,6 +84,23 @@ def do_activate(self) -> None:
margin_right = statusbar.get_margin_right()
statusbar.set_margin_right(margin_right + 10)
+ def update_bt_status(state: bool) -> None:
+ if state:
+ icon_name = "bluetooth"
+ tooltip_text = _("Bluetooth is enabled.")
+ else:
+ icon_name = "bluetooth-disabled"
+ tooltip_text = _("Bluetooth is disabled, enable in the Adapter menu.")
+
+ icon = self.builder.get_widget("bt_status_icon", Gtk.Image)
+ icon.set_from_icon_name(icon_name, Gtk.IconSize.MENU)
+ icon.set_tooltip_text(tooltip_text)
+
+ def on_applet_signal(_proxy: AppletService, _sender: str, signal_name: str, params: GLib.Variant) -> None:
+ if signal_name == 'BluetoothStatusChanged':
+ status = params.unpack()[0]
+ update_bt_status(status)
+
def on_dbus_name_vanished(_connection: Gio.DBusConnection, name: str) -> None:
logging.info(name)
@@ -108,6 +125,7 @@ def on_dbus_name_appeared(_connection: Gio.DBusConnection, name: str, owner: str
try:
self.Applet = AppletService()
+ self.Applet.connect('g-signal', on_applet_signal)
except DBusProxyFailed:
print("Blueman applet needs to be running")
bmexit()
@@ -134,6 +152,8 @@ def on_dbus_name_appeared(_connection: Gio.DBusConnection, name: str, owner: str
self.Config.bind("show-toolbar", toolbar, "visible", Gio.SettingsBindFlags.DEFAULT)
self.Config.bind("show-statusbar", statusbar, "visible", Gio.SettingsBindFlags.DEFAULT)
+ update_bt_status(self.Applet.GetBluetoothStatus())
+
Manager.watch_name_owner(on_dbus_name_appeared, on_dbus_name_vanished)
self.window.present_with_time(Gtk.get_current_event_time())
diff --git a/data/ui/manager-main.ui b/data/ui/manager-main.ui
index f2111697a..b5a75847a 100644
--- a/data/ui/manager-main.ui
+++ b/data/ui/manager-main.ui
@@ -582,6 +582,31 @@
2
+
+
+
+ False
+ True
+ 3
+
+
+
+
+
+ False
+ True
+ 5
+ 4
+
+
0