195 lines
5.6 KiB
Plaintext

(deflisten network--data
`~/.config/eww/modules/network/network.py`)
(defwidget network--wlan [device]
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 0
(label :class "offline"
:visible {network--data["network"][device]["offline"]}
:text "offline")
(label :visible {network--data["network"][device]["connecting"]}
:class "highlight"
:text "connecting...")
(label :visible {network--data["network"][device]["online"]}
:class "special"
:text "${network--data['wifi']['ssid']}")))
(defwidget network--lan [device]
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 0
(label :class "offline"
:visible {network--data["network"][device]["offline"]}
:text "offline")
(label :visible {network--data["network"][device]["connecting"]}
:class "highlight"
:text "connecting...")
(label :visible {network--data["network"][device]["online"] && !network--data.network[device].connecting}
:class "special"
:text "${network--data['network'][device]['ip4_addr']}/${network--data['network'][device]['ip4_prefix']}")))
(defwidget network--proxy-vpn [device ?required]
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 0
:visible {network--data["network"][device]["exists"] || required}
(label :class "highlight"
:text "- insecure"
:visible {! network--data["network"][device]["exists"]})
(label :class "green"
:text "- secured"
:visible {network--data["network"][device]["exists"]})))
(defwidget proxy-network [device]
(box :orientation "v"
:halign "start"
:space-evenly false
:spacing 0
(label :class "green"
:text "connected"
:visible {network--data.network[device].exists})
(label :class "offline"
:text "offline"
:visible {!network--data.network[device].exists})
"proxy vpn"))
(defwidget vpn-network []
(box :orientation "v"
:halign "start"
:space-evenly false
:spacing 0
(label :class "highlight"
:text "offline"
:visible {! network--data["network"]["ezrinet"]["exists"] || ! network--data["connected"]})
(label :class "green"
:text "connected"
:visible {network--data["network"]["ezrinet"]["exists"] && network--data["connected"]})
"personal network"))
(defwidget network []
(box :orientation "v"
:halign "start"
:space-evenly false
:spacing 0
(box :orientation "h"
:halign "center"
:space-evenly false
:spacing 10
(network--lan :device "insight")
(network--proxy-vpn :device "wg-mullvad" :required {!network--data.trusted}))
"communications"))
(defwidget network-details []
(box :orientation "v"
:halign "start"
:class "module"
:space-evenly false
:spacing 5
:width 200
(box :orientation "h"
:halign "center"
:class "nebula"
:spacing 10
:space-evenly false
(label :text "Comms"
:class "medium special"))
(centerbox :orientation "h"
:halign "start"
:class "nebula"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
"Status:")
""
(box :halign "end"
(label :text "Online"
:class "green"
:visible {network--data.connected})
(label :text "Offline"
:class "highlight"
:visible {!network--data.connected})))
(centerbox :orientation "h"
:halign "start"
:class "nebula"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
"VPN:")
""
(box :halign "end"
(label :text "Connected"
:class "green"
:visible {network--data.network.ezrinet.online && network--data.connected})
(label :text "Offline"
:class "highlight"
:visible {!network--data.network.ezrinet.exists})))
(centerbox :orientation "h"
:halign "start"
:class "nebula"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
"Proxy:")
""
(box :halign "end"
(label :text "Connected"
:class "green"
:visible {network--data.network.wg-mullvad.online})
(label :text "Offline"
:class "highlight"
:visible {!network--data.network.wg-mullvad.exists})))
(centerbox :orientation "h"
:halign "start"
:class "nebula"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
"Wi-Fi:")
""
(box :halign "end"
(label :text {network--data.wifi.ssid}
:limit-width 12
:class "green"
:visible {network--data.wifi.connected})
(label :text "Offline"
:class "offline"
:visible {!network--data.wifi.connected})))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:class "nebula"
:space-evenly false
(box :valign "start"
:halign "start"
"Addrs:")
""
(box :valign "start"
:halign "end"
:visible {network--data.connected}
:orientation "v"
(for addr in {network--data.ip4_addrs}
(box :class "special"
:halign "end"
{addr}))
(box :visible {!network--data.connected}
:class "offline"
"none")))
;; (box :orientation "h"
;; :halign "start"
;; :class "nebula"
;; :spacing 10
;; :space-evenly false
;; (label :text "Addr:")
;; (label :text {network--data.network[device].ip4_addr}
;; :class "medium special"))))
))