(defpoll available_networks
    :interval "5s"
    "~/.config/eww/widgets/network/scripts/available_wifi.py"
)

(defpoll devices
    :interval "5s"
    "~/.config/eww/widgets/network/scripts/devices.py"
)

(defpoll wifi_enabled
    :interval "5s"
    "nmcli radio wifi"
)

(defwindow network
    :monitor 0
    :geometry (geometry
        :width "300px"
        :height "500px"
        :anchor "bottom right"
    )
    :stacking "fg"
    (eventbox :onhoverlost "eww close network"
        (network-menu)
    )
)

(defwidget network-menu []
    (box
        :orientation "v"
        :class "network-menu"
        :space-evenly false

        (scroll
            :height 200
           (literal :content devices)
        )

        (scroll
            :vexpand true
            (box
                :orientation "v"
                :spacing 8
                (literal :content available_networks)
            )
        )
    )
)