(deflisten net
  :initial '{"wifi":{"connected":false,"enabled":false,"icon":"󰤮","ssid":""},"ethernet":{"connected":false},"usb":{"connected":false}}'
  "scripts/net/net")

(deflisten bluetooth
  :initial '{"powered":false,"connected":false,"device":""}'
  "scripts/net/bluetooth")

(defwidget net-mod []
  (module
    (eventbox
      :onclick "(sleep 0.1 && scripts/panel-toggle net)"
    (box :orientation "v"
      (label
        :class "net-icon ${net.ethernet.connected ? 'net-active' : 'net-dim'}"
        :tooltip {net.ethernet.connected ? "Ethernet: Connected" : "Ethernet: Disconnected"}
        :text "󰈀")
      (label
        :visible {net.usb.connected}
        :class "net-icon net-active"
        :tooltip "USB: Connected"
        :text "󰌷")
      (label
        :class "net-icon ${net.wifi.connected ? 'net-active' : 'net-dim'}"
        :tooltip {net.wifi.connected ? "WiFi: ${net.wifi.ssid}" : "WiFi: Disconnected"}
        :text {net.wifi.icon})
      (label
        :class "net-icon ${bluetooth.connected ? 'blt-connected' : bluetooth.powered ? 'blt-on' : 'net-dim'}"
        :tooltip {bluetooth.connected ? "Bluetooth: ${bluetooth.device}" : bluetooth.powered ? "Bluetooth: On" : "Bluetooth: Off"}
        :text {bluetooth.connected ? "󰂱" : bluetooth.powered ? "󰂯" : "󰂲"})))))
