Unifying eww configs
This commit is contained in:
347
.config/eww/modules/network.yuck
Normal file
347
.config/eww/modules/network.yuck
Normal file
@@ -0,0 +1,347 @@
|
||||
;; -*-lisp-*-
|
||||
(deflisten network--data
|
||||
`~/.config/eww/scripts/network.py`)
|
||||
|
||||
(defvar network--show-details false)
|
||||
|
||||
(defwidget network--interface
|
||||
[device]
|
||||
(box :orientation "v"
|
||||
:halign "center"
|
||||
:space-evenly false
|
||||
:spacing 0
|
||||
(label :class "offline"
|
||||
:visible {!device.online}
|
||||
:text "offline")
|
||||
(label :visible {device.online}
|
||||
:class "special"
|
||||
:text "${device.addresses[0].address}/${device.addresses[0].prefixlen}")))
|
||||
|
||||
(defwidget network-big--online
|
||||
[]
|
||||
(box :orientation "h"
|
||||
:halign "start"
|
||||
:valign "center"
|
||||
:space-evenly false
|
||||
:spacing 10
|
||||
(label :class "medium green nebula"
|
||||
:visible {network--data.online}
|
||||
:text "online")
|
||||
(label :class "medium offline nebula"
|
||||
:visible {network--data.offline}
|
||||
:text "offline")
|
||||
(label :class "medium highlight nebula"
|
||||
:visible {network--data.configuring}
|
||||
:text "configuring")))
|
||||
|
||||
(defwidget network-big--lan
|
||||
[device]
|
||||
(label :visible {network--data
|
||||
[device]
|
||||
.online}
|
||||
:class ""
|
||||
:text "${network--data.interfaces[device].addresses[0].address}/${network--data.interfaces[device].addresses[0].prefixlen}"))
|
||||
|
||||
(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 {!device.online}
|
||||
:text "offline")
|
||||
(label :visible {device.online}
|
||||
:class {network--data.last_update.unix < clock--data.unix - 30 ? "highlight" : "special"}
|
||||
:text "${device.addresses[0].address}/${device.addresses[0].prefixlen}")))
|
||||
|
||||
(defwidget network--secure
|
||||
[]
|
||||
(box :orientation "h"
|
||||
:halign "start"
|
||||
:space-evenly false
|
||||
:spacing 0
|
||||
(label :class "highlight"
|
||||
:text "- insecure"
|
||||
:visible {!
|
||||
network--data.secure })
|
||||
(label :class "green"
|
||||
:text "- secured via ${network--data.secure_msg}"
|
||||
:visible {network--data.secure})))
|
||||
|
||||
(defwidget vpn-network
|
||||
[]
|
||||
(box :orientation "v"
|
||||
:halign "start"
|
||||
:space-evenly false
|
||||
:spacing 0
|
||||
:visible {network--data
|
||||
!=
|
||||
''}
|
||||
(label :class "highlight"
|
||||
:text "offline"
|
||||
:visible {!
|
||||
network--data.interfaces.ezrinet.online })
|
||||
(label :class "green"
|
||||
:text "connected"
|
||||
:visible {network--data.interfaces.ezrinet.online})
|
||||
"personal network"))
|
||||
|
||||
(defwidget network
|
||||
[]
|
||||
(button :onclick "eww update network--show-details=${!network--show-details}"
|
||||
(box :orientation "v"
|
||||
:halign "start"
|
||||
:space-evenly false
|
||||
:spacing 0
|
||||
:visible {network--data != ''}
|
||||
(box :orientation "h"
|
||||
:halign "center"
|
||||
:space-evenly false
|
||||
:spacing 10
|
||||
(network--lan :device {network--data.default_interface}))
|
||||
"communications")))
|
||||
|
||||
(defwidget network--public-ip
|
||||
[]
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:width 200
|
||||
(box :halign "start"
|
||||
"public ip:")
|
||||
""
|
||||
(box :halign "end"
|
||||
:spacing 0
|
||||
:space-evenly false
|
||||
(label :class "highlight"
|
||||
:text "offline"
|
||||
:visible {!network--data.online})
|
||||
(label :class "highlight"
|
||||
:text "no response"
|
||||
:visible {network--data.online && !network--data.have_public_ip})
|
||||
(label :class "special"
|
||||
:text {network--data.public_ip.ip}
|
||||
:visible {network--data.online && network--data.have_public_ip}))))
|
||||
|
||||
(defwidget network--default-route
|
||||
[]
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:width 200
|
||||
(box :halign "start"
|
||||
"route on:")
|
||||
""
|
||||
(box :halign "end"
|
||||
:spacing 0
|
||||
:space-evenly false
|
||||
(label :class "highlight"
|
||||
:text "offline"
|
||||
:visible {!network--data.online})
|
||||
(label :class "highlight"
|
||||
:text "no route"
|
||||
:visible {network--data.online && !network--data.have_default_route})
|
||||
(label :class "special"
|
||||
:text {network--data.default_route}
|
||||
:visible {network--data.online && network--data.have_default_route}))))
|
||||
|
||||
(defwidget network--gateway
|
||||
[]
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:width 200
|
||||
(box :halign "start"
|
||||
"gateway:")
|
||||
""
|
||||
(box :halign "end"
|
||||
:spacing 0
|
||||
:space-evenly false
|
||||
(label :class "highlight"
|
||||
:text "no response"
|
||||
:visible {!network--data.have_gateway})
|
||||
(label :class "special"
|
||||
:text {network--data.gateway}
|
||||
:visible {network--data.have_gateway}))))
|
||||
|
||||
(defwidget network--status-summary
|
||||
[]
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:width 200
|
||||
(box :halign "start"
|
||||
"status:")
|
||||
""
|
||||
(box :halign "end"
|
||||
:spacing 0
|
||||
:space-evenly false
|
||||
(label :class "highlight"
|
||||
:text "offline"
|
||||
:visible {!network--data.online})
|
||||
(label :class "special"
|
||||
:text "online"
|
||||
:visible {network--data.online && !network--data.secure})
|
||||
(label :class "green"
|
||||
:text {network--data.secure_msg == "usu" ? "vpn online" : "secure"}
|
||||
:visible {network--data.online && network--data.secure}))))
|
||||
|
||||
|
||||
(defwidget network-detail
|
||||
[]
|
||||
(box :orientation "v"
|
||||
:halign "start"
|
||||
:space-evenly false
|
||||
:spacing 0
|
||||
(network--status-summary)
|
||||
(network--public-ip)
|
||||
(network--default-route)
|
||||
(network--gateway)
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:width 200
|
||||
(box :halign "start"
|
||||
"last update:")
|
||||
""
|
||||
(box :halign "end"
|
||||
:spacing 0
|
||||
:space-evenly false
|
||||
(label :class {network--data.last_update.unix < clock--data.unix - 30 ? "highlight" : "special"}
|
||||
:text "${network--data.last_update.month}-${network--data.last_update.day} ${network--data.last_update.hour}:${network--data.last_update.minute}:${network--data.last_update.second}")))
|
||||
))
|
||||
|
||||
(defwidget network-sidebar-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 :class "medium special"
|
||||
:text "Comms"))
|
||||
(box :orientation "h"
|
||||
:halign "center"
|
||||
:class "nebula"
|
||||
:spacing 10
|
||||
:space-evenly false
|
||||
(label :class "nebula green"
|
||||
:text "Online"
|
||||
:visible {network--data.online})
|
||||
(label :class "nebula highlight"
|
||||
:text "Offline"
|
||||
:visible {!network--data.online}))
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:spacing 10
|
||||
:width 200
|
||||
:space-evenly false
|
||||
(box :halign "start"
|
||||
:class "nebula"
|
||||
"Route On:")
|
||||
""
|
||||
(box :halign "end"
|
||||
(label :text "No Route"
|
||||
:class "highlight"
|
||||
:visible {network--data.online && !network--data.have_default_route})
|
||||
(label :text "${network--data.default_route}"
|
||||
:class "special"
|
||||
:visible {network--data.online && network--data.have_default_route})))
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:spacing 10
|
||||
:width 200
|
||||
:space-evenly false
|
||||
(box :halign "start"
|
||||
:valign "start"
|
||||
:class "nebula"
|
||||
"Address:")
|
||||
""
|
||||
(box :halign "end"
|
||||
:orientation "v"
|
||||
(label :text "${network--data.default_interface.addresses[0].address}"
|
||||
:class "special")
|
||||
(label :text "/${network--data.default_interface.addresses[0].prefixlen}"
|
||||
:halign "end"
|
||||
:class "special")))
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:spacing 10
|
||||
:width 200
|
||||
:space-evenly false
|
||||
(box :halign "start"
|
||||
:class "nebula"
|
||||
"Public IP:")
|
||||
""
|
||||
(box :halign "end"
|
||||
(label :text "Offline"
|
||||
:class "highlight"
|
||||
:visible {!network--data.have_public_ip})
|
||||
(label :text {network--data.public_ip.ip}
|
||||
:class "special"
|
||||
:visible {network--data.have_public_ip})))
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:spacing 10
|
||||
:width 200
|
||||
:space-evenly false
|
||||
(box :halign "start"
|
||||
:class "nebula"
|
||||
"Gateway:")
|
||||
""
|
||||
(box :halign "end"
|
||||
(label :text "Error"
|
||||
:class "highlight nebula"
|
||||
:visible {!network--data.have_gateway})
|
||||
(label :text {network--data.gateway}
|
||||
:class "special"
|
||||
:visible {network--data.have_gateway})))
|
||||
(centerbox :orientation "h"
|
||||
:halign "start"
|
||||
:class "nebula"
|
||||
:spacing 10
|
||||
:width 200
|
||||
:space-evenly false
|
||||
(box :halign "start"
|
||||
"VPN:")
|
||||
""
|
||||
(box :halign "end"
|
||||
(label :text "Offline"
|
||||
:class "highlight"
|
||||
:visible {!network--data.interfaces.ezrinet.online})
|
||||
(label :text "Online"
|
||||
:class "green"
|
||||
:visible {network--data.interfaces.ezrinet.online})))
|
||||
|
||||
))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user