80 lines
2.8 KiB
Plaintext

(deflisten system-data
`~/.config/eww/modules/system.py`)
(defpoll reboot-needed :interval "10s"
:initial false
`~/.config/eww/modules/reboot.sh`)
(defwidget reboot [align]
(box :orientation "h"
:halign align
:class "module reboot"
:space-evenly false
:spacing 0
:visible {reboot-needed}
(button :onclick "~/.local/bin/i3-reboot"
:timeout "60s"
" reboot required")))
(defwidget memory [align]
(box :orientation "h"
:halign align
:class "module memory"
:space-evenly false
:spacing 0
' ${round(EWW_RAM["used_mem"]/1024/1024, 2)} GiB'))
(defwidget cpu [align]
(box :orientation "h"
:halign align
:class "module cpu"
:space-evenly false
:spacing 0
' ${system-data["cpu"]}%'))
(defwidget wlan-dev [align device]
(box :orientation "h"
:halign align
:class "module wlan-dev network ${system-data['network'][device]['online'] ? 'online' : 'offline'} ${system-data['network'][device]['connecting'] ? 'connecting' : ''}"
:space-evenly false
:spacing 0
""
(revealer :transition "slideright"
:reveal {!system-data["network"][device]["online"] && !system-data["network"][device]["connecting"]}
:duration "500ms"
" offline")
(revealer :transition "slideright"
:reveal {system-data["network"][device]["connecting"]}
:duration "500ms"
" connecting...")
(revealer :transition "slideright"
:reveal {system-data["network"][device]["online"] && system-data["network"][device]["ip4_addr"] != ""}
:duration "500ms"
' ${system-data["wifi"]["ssid"]}')
))
(defwidget lan-dev [align device]
(box :orientation "h"
:halign align
:class "module lan-dev network ${system-data['network'][device]['online'] ? 'online' : 'offline'} ${system-data['network'][device]['connecting'] ? 'connecting' : ''}"
:space-evenly false
:spacing 0
(revealer :transition "none"
:reveal {!system-data["network"][device]["online"] && !system-data["network"][device]["connecting"]}
"")
(revealer :transition "none"
:reveal {system-data["network"][device]["online"] || system-data["network"][device]["connecting"]}
"")
(revealer :transition "slideright"
:reveal {!system-data["network"][device]["online"] && !system-data["network"][device]["connecting"]}
:duration "500ms"
" offline")
(revealer :transition "slideright"
:reveal {system-data["network"][device]["connecting"]}
:duration "500ms"
" connecting...")
(revealer :transition "slideright"
:reveal {system-data["network"][device]["online"] && system-data["network"][device]["ip4_addr"] != ""}
:duration "500ms"
' ${system-data["network"][device]["ip4_addr"]}')
))