New backup 2025-10-09 17:15:02
This commit is contained in:
parent
682d634196
commit
7552a772bf
3 changed files with 57 additions and 11 deletions
|
@ -147,6 +147,12 @@ revealer.home {
|
||||||
border-radius: $home-widget-border-radius;
|
border-radius: $home-widget-border-radius;
|
||||||
box-shadow: inset 0 0 0px 2px $home-widget-border-color, 0px 0px 9px 0px $home-widget-bg-color;
|
box-shadow: inset 0 0 0px 2px $home-widget-border-color, 0px 0px 9px 0px $home-widget-bg-color;
|
||||||
}
|
}
|
||||||
|
.mc_server {
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
background-size: cover;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
.weather {
|
.weather {
|
||||||
color: $home-button-fg-color;
|
color: $home-button-fg-color;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
|
|
@ -16,10 +16,21 @@
|
||||||
(defwidget mcstatus [json]
|
(defwidget mcstatus [json]
|
||||||
(box
|
(box
|
||||||
:orientation 'v'
|
:orientation 'v'
|
||||||
|
:space-evenly false
|
||||||
|
(box
|
||||||
|
:orientation 'v'
|
||||||
|
:space-evenly true
|
||||||
(for server in json
|
(for server in json
|
||||||
|
(box
|
||||||
|
:orientation 'h'
|
||||||
|
:space-evenly false
|
||||||
(box
|
(box
|
||||||
:class 'mc_server'
|
:class 'mc_server'
|
||||||
:style 'background-image: url("/home/${USER}/.cache/mcstatus/${server.status.name}.png");'
|
:width 75
|
||||||
|
:height 75
|
||||||
|
:style 'background-image: url("${server.icon_path}");'
|
||||||
|
)
|
||||||
|
(box
|
||||||
:orientation 'v'
|
:orientation 'v'
|
||||||
(label
|
(label
|
||||||
:text "${server.address}"
|
:text "${server.address}"
|
||||||
|
@ -32,3 +43,10 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(button
|
||||||
|
(label
|
||||||
|
:text "reload now"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cache_path="${HOME}/.cache/mcstatus"
|
||||||
|
mcstatus_cache="${cache_path}/mcstatus.json"
|
||||||
|
mkdir -p "${cache_path}"
|
||||||
|
server_list=("mc.pogmom.me" "mc.pogmom.me")
|
||||||
|
|
||||||
|
update_cache_json(){
|
||||||
|
|
||||||
|
for s in "${server_list[@]}";do
|
||||||
|
mcstatus "${s}" json | jq '. += {"address":"'"${s}"'","icon_path":"'"${cache_path}/${s}"'.png"}'
|
||||||
|
done | jq -n '[inputs]' | tee "${mcstatus_cache}" >/dev/null
|
||||||
|
jq -rc '.[] | "\(.address) \(.status.icon)"' ~/.cache/mcstatus.json | while read name icon;do
|
||||||
|
echo "${icon/*base64,/}" | base64 --decode > "${cache_path}/${name}.png"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ ! $(find "${mcstatus_cache}" -cmin -60 -print 2>/dev/null) ]]; then
|
||||||
|
update_cache_json
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat "${mcstatus_cache}"
|
Loading…
Add table
Reference in a new issue