dotfiles/de/home/.config/eww/modules/bar/bluetooth.yuck
2025-03-12 18:00:02 -07:00

26 lines
998 B
Text

(defvar reveal_bluetooth false)
(defpoll bluetooth_active :initial true
:interval "60s"
'scripts/bar/bt-status')
(defwidget bluetooth []
(revealer-on-hover
:revealvar reveal_bluetooth
:revealvar-name "reveal_bluetooth"
(button :onclick 'blueman-manager'
:class {bluetooth_active ? "active" : ""}
"")
(bluetooth_children :array btDeviceArray)))
(defpoll btDeviceArray :initial "${[{ "name": "dummy", "connected": "no", "icon": " ", "address": "00:00:00:00:00:00" }]}"
:interval "60s"
'scripts/bar/bt-devices')
(defwidget bluetooth_children [array]
(box :class "reveal_children"
:orientation "h"
:space-evenly true
:halign "start"
(for device in array
(button :onclick {(device.connected == "yes") ? 'bluetoothctl disconnect "${device.address}"' : 'bluetoothctl connect "${device.address}"'}
:class {(device.connected == "yes") ? "active" : ""}
"${device.icon}"))))