Dotfiles/wayland/.local/bin/hypr-status.sh

28 lines
665 B
Bash
Executable File

#!/bin/sh
# --- Gather Data ---
# 1. Hyprland Version
if [ -r "$HOME/.cache/hyprland-version" ]; then
HYPR_VER="$(cat "$HOME/.cache/hyprland-version")"
else
HYPR_VER="hyprland"
fi
# 3. Load Average
LOADAVG="$(cut -d' ' -f1 /proc/loadavg)"
# 5. Date
DATE="$(date '+%Y-%m-%d %a %H:%M')"
# --- Output to Yambar ---
# We use the unicode vertical bar '│' (U+2502) to be safe from parsing errors.
# We also append a newline explicitly.
printf "hstatus|string| %s │ %s │ %s\n" \
"$HYPR_VER" "$LOADAVG" "$DATE"
# FORCE FLUSH: This is likely why you saw {hstatus} before.
# Some shells buffer printf. This ensures it sends immediately.
echo ""