updated waybar and added settings for cn-mate

This commit is contained in:
2025-03-24 22:39:36 +01:00
parent fec5a5bfb0
commit e49fa372fa
5 changed files with 617 additions and 48 deletions

28
.config/waybar/scripts/alhp.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Retrieve JSON output from alhp.utils.
readonly ALHP_OUTPUT=$(alhp.utils -j)
# Extract "total" as a string and read "packages" into a Bash array.
readonly total=$(echo "$ALHP_OUTPUT" | jq -r '.total | tostring')
readarray -t packages < <(echo "$ALHP_OUTPUT" | jq -r '.packages[]?')
# Initialize default tooltip and class.
tooltip=''
class='good'
# Use arithmetic evaluation to check if total is greater than 0.
if (( total > 0 )); then
class='bad'
fi
# If there are any packages, join them with newline as separator.
if (( ${#packages[@]} > 0 )); then
tooltip=$(IFS=$'\n'; echo "${packages[*]}")
else
tooltip="All good"
fi
# Generate compact JSON output (all in one line) with jq.
jq -nc --arg text "$total" --arg class "$class" --arg tooltip "$tooltip" \
'{text: $text, class: $class, tooltip: $tooltip}'