dotfiles/de/home/.config/eww/modules/home/mcstatus.yuck
2025-10-09 21:00:02 -07:00

64 lines
1.6 KiB
Text

(defpoll servers_status :initial '[{"online": true,"kind":"Java","status":{"players":{"online":0,"max":0,"sample":null},"version":{"name":"version","protocol":0},"motd":"Message of the day","latency":0,"icon":""},"address":"ip.addre.ss"}]'
:interval "21600s"
'scripts/home/mcstatus')
(defvar reveal_mcstatus true)
(defwidget mcstatus_revealer []
(revealer-on-press
:revealvar reveal_mcstatus
:revealvar-name "reveal_mcstatus"
(button
:width 300
:class "revealer-title"
"Minecraft Servers ${reveal_mcstatus ? '' : ''}")
(mcstatus :json servers_status)))
(defwidget mcstatus [json]
(box
:class 'minecraft'
:orientation 'v'
:space-evenly false
(box
:orientation 'v'
:space-evenly true
(for server in json
(box
:class 'server'
:orientation 'h'
:space-evenly false
(box
(box
:class 'icon'
:valign 'center'
:width 75
:height 75
:style 'background-image: url("${server.icon_path}");'
)
)
(box
:class 'details'
:space-evenly false
:orientation 'v'
(label
:class 'title'
:text "${server.address}"
)
(label
:class 'motd'
:text "${replace(server.status.motd,'§.','')}"
:wrap true
:wrap-mode 'word'
; :truncate true
)
)
)
)
)
(button
(label
:class 'button'
:text "reload now"
)
)
)
)