summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-15 22:02:01 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-15 22:02:01 +1100
commit434efd32701399ee1e74d91f23c54463460f05ce (patch)
treef004ca56ab013141a50534e75417ae34b65786e0 /modules
parentbar: network and bluetooth actions (diff)
downloadcaelestia-shell-434efd32701399ee1e74d91f23c54463460f05ce.tar.gz
caelestia-shell-434efd32701399ee1e74d91f23c54463460f05ce.tar.bz2
caelestia-shell-434efd32701399ee1e74d91f23c54463460f05ce.zip
bar: fix bluetooth tooltip
Diffstat (limited to 'modules')
-rw-r--r--modules/bar.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/bar.tsx b/modules/bar.tsx
index 6821b94..9374b51 100644
--- a/modules/bar.tsx
+++ b/modules/bar.tsx
@@ -309,18 +309,21 @@ const Bluetooth = () => (
execAsync("uwsm app -- blueman-manager").catch(console.error);
}}
setup={self => {
+ const bluetooth = AstalBluetooth.get_default();
const tooltipText = Variable("");
const update = () => {
- const devices = AstalBluetooth.get_default()
- .get_devices()
- .filter(d => d.connected);
+ const devices = bluetooth.get_devices().filter(d => d.connected);
tooltipText.set(
devices.length > 0
? `Connected devices: ${devices.map(d => d.alias).join(", ")}`
: "No connected devices"
);
};
- self.hook(AstalBluetooth.get_default(), "notify", update); // TODO: fix not updating
+ bluetooth.get_devices().forEach(d => self.hook(d, "notify::connected", update));
+ self.hook(bluetooth, "device-added", (_, device) => {
+ self.hook(device, "notify::connected", update);
+ update();
+ });
update();
setupCustomTooltip(self, bind(tooltipText));
}}