From 7552a772bf3078c569733ff11617aeadbb706d50 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Thu, 9 Oct 2025 17:15:02 -0700 Subject: [PATCH] New backup 2025-10-09 17:15:02 --- de/home/.config/eww/eww.scss | 6 +++ .../.config/eww/modules/home/mcstatus.yuck | 40 ++++++++++++++----- de/home/.config/eww/scripts/home/mcstatus | 22 ++++++++++ 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/de/home/.config/eww/eww.scss b/de/home/.config/eww/eww.scss index 54d3c60..e7a7d26 100644 --- a/de/home/.config/eww/eww.scss +++ b/de/home/.config/eww/eww.scss @@ -147,6 +147,12 @@ revealer.home { 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; } + .mc_server { + background-repeat: no-repeat; + background-position: center; + background-size: cover; + margin: 10px; + } .weather { color: $home-button-fg-color; padding: 8px; diff --git a/de/home/.config/eww/modules/home/mcstatus.yuck b/de/home/.config/eww/modules/home/mcstatus.yuck index 226c629..e7cadc4 100644 --- a/de/home/.config/eww/modules/home/mcstatus.yuck +++ b/de/home/.config/eww/modules/home/mcstatus.yuck @@ -16,19 +16,37 @@ (defwidget mcstatus [json] (box :orientation 'v' - (for server in json - (box - :class 'mc_server' - :style 'background-image: url("/home/${USER}/.cache/mcstatus/${server.status.name}.png");' - :orientation 'v' - (label - :text "${server.address}" - ) - (label - :text "${replace(server.status.motd,'§.','')}" - :truncate true + :space-evenly false + (box + :orientation 'v' + :space-evenly true + (for server in json + (box + :orientation 'h' + :space-evenly false + (box + :class 'mc_server' + :width 75 + :height 75 + :style 'background-image: url("${server.icon_path}");' + ) + (box + :orientation 'v' + (label + :text "${server.address}" + ) + (label + :text "${replace(server.status.motd,'§.','')}" + :truncate true + ) + ) ) ) ) + (button + (label + :text "reload now" + ) + ) ) ) diff --git a/de/home/.config/eww/scripts/home/mcstatus b/de/home/.config/eww/scripts/home/mcstatus index e69de29..fdace21 100755 --- a/de/home/.config/eww/scripts/home/mcstatus +++ b/de/home/.config/eww/scripts/home/mcstatus @@ -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}"