(defvar reveal_bluetooth false)
(defwidget bluetooth []
  (revealer-on-hover
    :revealvar reveal_bluetooth
    :revealvar-name "reveal_bluetooth"
    (button :onclick 'blueman-manager'
            :class {matches(jq(bluetooth_status,'.[].connected'),'yes') ? "active" : ""}
      "")
    (bluetooth_children :array bluetooth_status)))

(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}"))))
