Compare commits

..

3 Commits

Author SHA1 Message Date
ef78e32394 fix: clean up cpugov scripts and waybar polling
Replace infinite loop with single execution (waybar handles polling
via interval), fix unquoted variables, simplify jq invocation.
2026-03-28 14:31:00 +01:00
f5d94e8bc0 fix: replace manual moongreet/moonset installs with paru repo
The old fallbacks used git clone + makepkg and uv pip install, which
are fragile and bypass the moonarch-pkgbuilds repo. Now sets up the
paru custom repo and installs all three packages via paru -S.
2026-03-28 14:30:09 +01:00
8f248d2a7a HID++ Batterie-Modul für Waybar mit dynamischer Geräteerkennung
Das bisherige battery#keyboard Modul nutzte eine feste hidpp_battery_N
Nummer, die sich bei jedem Boot ändern kann. moonarch-waybar-hidpp
findet den richtigen Eintrag dynamisch per MODEL_NAME Argument.
2026-03-28 00:03:39 +01:00
6 changed files with 111 additions and 82 deletions

View File

@ -49,19 +49,17 @@ value="$(start)"
# Split input. # Split input.
# grab upto first space. # grab upto first space.
choice=${value%%\ *} choice=${value%%\ *}
# graph remainder, minus space.
input=${value:$((${#choice}+1))}
## ##
# Cancelled? bail out # Cancelled? bail out
## ##
if test -z ${choice} if test -z "${choice}"
then then
exit exit
fi fi
# check if choice exists # check if choice exists
if test ${COMMANDS[$choice]+isset} if test "${COMMANDS[$choice]+isset}"
then then
# Execute the choice # Execute the choice
${COMMANDS[$choice]} ${COMMANDS[$choice]}

View File

@ -2,47 +2,40 @@
# ABOUTME: Waybar-Modul das den CPU-Governor als JSON ausgibt. # ABOUTME: Waybar-Modul das den CPU-Governor als JSON ausgibt.
# ABOUTME: Wird von der Waybar custom/cpugov Config referenziert. # ABOUTME: Wird von der Waybar custom/cpugov Config referenziert.
while : CPU_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
do
CPU_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
case $CPU_GOV in case $CPU_GOV in
performance) performance)
CPU_GOV_SHORT=󰓅 CPU_GOV_SHORT=󰓅
;; ;;
balanced) balanced)
CPU_GOV_SHORT=󰾅 CPU_GOV_SHORT=󰾅
;; ;;
powersave) powersave)
CPU_GOV_SHORT=󰌪 CPU_GOV_SHORT=󰌪
;; ;;
userspace) userspace)
CPU_GOV_SHORT=uspace CPU_GOV_SHORT=uspace
;; ;;
ondemand) ondemand)
CPU_GOV_SHORT=ondmnd CPU_GOV_SHORT=ondmnd
;; ;;
conservative) conservative)
CPU_GOV_SHORT=cons CPU_GOV_SHORT=cons
;; ;;
schedutil) schedutil)
CPU_GOV_SHORT=sutil CPU_GOV_SHORT=sutil
;; ;;
*) *)
CPU_GOV_SHORT="?" CPU_GOV_SHORT="?"
;; ;;
esac esac
CPU_GOV_FULL="${CPU_GOV^}" CPU_GOV_FULL="${CPU_GOV^}"
s="text|alt|tooltip|class jq --compact-output -n \
$CPU_GOV_SHORT|$CPU_GOV_FULL|CPU Mode: $CPU_GOV_FULL|cpugov" --arg text "$CPU_GOV_SHORT" \
--arg alt "$CPU_GOV_FULL" \
jq --unbuffered --compact-output -Rn ' --arg tooltip "CPU Mode: $CPU_GOV_FULL" \
( input | split("|") ) as $keys | --arg class "cpugov" \
( inputs | split("|") ) as $vals | '{text: $text, alt: $alt, tooltip: $tooltip, class: $class}'
[[$keys, $vals] | transpose[] | {key:.[0],value:.[1]}] | from_entries
' <<<"$s"
sleep 5
done

View File

@ -0,0 +1,48 @@
#!/usr/bin/bash
# ABOUTME: Waybar-Modul das den Batteriestatus eines HID++ Geräts als JSON ausgibt.
# ABOUTME: Findet den richtigen hidpp_battery_* Eintrag dynamisch per MODEL_NAME (Argument).
if [ -z "$1" ]; then
echo "Usage: moonarch-waybar-hidpp <model_name>" >&2
exit 1
fi
MODEL="$1"
for dev in /sys/class/power_supply/hidpp_battery_*; do
[ -d "$dev" ] || continue
name=$(cat "$dev/model_name" 2>/dev/null)
if [ "$name" = "$MODEL" ]; then
capacity=$(cat "$dev/capacity" 2>/dev/null)
status=$(cat "$dev/status" 2>/dev/null)
if [ -z "$capacity" ]; then
exit 0
fi
class="normal"
if [ "$capacity" -le 20 ]; then
class="critical"
elif [ "$capacity" -le 35 ]; then
class="warning"
fi
if [ "$status" = "Charging" ]; then
text="${capacity}% 󰌌"
else
text="${capacity}% 󰌌"
fi
tooltip="${name}: ${capacity}% (${status})"
jq --compact-output -n \
--arg text "$text" \
--arg tooltip "$tooltip" \
--arg class "$class" \
--argjson percentage "$capacity" \
'{text: $text, tooltip: $tooltip, class: $class, percentage: $percentage}'
exit 0
fi
done
# Gerät nicht gefunden — keine Ausgabe, Waybar versteckt das Modul

View File

@ -15,23 +15,19 @@
// "group/net", // "group/net",
// "group/sound", // "group/sound",
// "backlight", // "backlight",
// "custom/keyboard",
// "battery", // "battery",
// "battery#keyboard",
// "group/indicators" // "group/indicators"
// ], // ],
// Beispiel: Logitech-Tastatur-Akku anzeigen // Beispiel: HID++ Geräte-Akku anzeigen (z.B. Logitech Tastatur)
// (hidpp_battery_X ggf. anpassen — siehe /sys/class/power_supply/) // moonarch-waybar-hidpp findet den richtigen hidpp_battery_* Eintrag dynamisch
// //
// "battery#keyboard": { // "custom/keyboard": {
// "bat": "hidpp_battery_4", // "exec": "moonarch-waybar-hidpp 'G515 LS TKL'",
// "return-type": "json",
// "interval": 120, // "interval": 120,
// "states": { // "format": "{}",
// "warning": 35, // "exec-on-event": false
// "critical": 20
// },
// "format": "{capacity}% 󰌌",
// "format-charging": "{capacity}% 󰌌",
// "tooltip-format": "Tastatur: {capacity}%"
// } // }
} }

View File

@ -321,7 +321,7 @@
"custom/cpugov": { "custom/cpugov": {
"exec": "moonarch-waybar-cpugov", "exec": "moonarch-waybar-cpugov",
"return-type": "json", "return-type": "json",
"restart-interval": 10, "interval": 5,
"on-click": "moonarch-cpugov" "on-click": "moonarch-cpugov"
}, },
"custom/gpu-usage": { "custom/gpu-usage": {

View File

@ -70,6 +70,24 @@ else
exit 1 exit 1
fi fi
# --- Moonarch custom paru repo einrichten ---
log "Richte Moonarch paru-Repo ein..."
PARU_CONF="$HOME/.config/paru/paru.conf"
mkdir -p "$(dirname "$PARU_CONF")"
if ! grep -q '\[moonarch\]' "$PARU_CONF" 2>/dev/null; then
cat >> "$PARU_CONF" <<'EOCONF'
[moonarch]
Url = https://gitea.moonarch.de/nevaforget/moonarch-pkgbuilds.git
EOCONF
log " + Moonarch-Repo zu paru.conf hinzugefuegt."
else
log " ~ Moonarch-Repo bereits in paru.conf."
fi
paru -Sy --pkgbuilds --noconfirm
paru -S --needed --noconfirm moonset-git moonlock-git moongreet-git
# --- Themes installieren (Cursor etc.) --- # --- Themes installieren (Cursor etc.) ---
log "Installiere Themes..." log "Installiere Themes..."
@ -136,30 +154,6 @@ if [[ ! -f "$HOME/.zshrc" ]]; then
echo "source /etc/zsh/zshrc.moonarch" >> "$HOME/.zshrc" echo "source /etc/zsh/zshrc.moonarch" >> "$HOME/.zshrc"
fi fi
# --- moongreet installieren (Greeter aus Gitea) ---
if ! command -v moongreet &>/dev/null; then
log "Installiere moongreet..."
MOONGREET_TMPDIR=$(mktemp -d)
git clone https://gitea.moonarch.de/nevaforget/greetd-moongreet.git "$MOONGREET_TMPDIR/moongreet"
(cd "$MOONGREET_TMPDIR/moongreet/pkg" && makepkg -si --noconfirm)
rm -rf "$MOONGREET_TMPDIR"
else
log "moongreet bereits installiert."
fi
# --- moonset installieren (Power Menu aus Gitea) ---
if ! command -v moonset &>/dev/null; then
log "Installiere moonset..."
MOONSET_TMPDIR=$(mktemp -d)
git clone https://gitea.moonarch.de/nevaforget/moonset.git "$MOONSET_TMPDIR/moonset"
(cd "$MOONSET_TMPDIR/moonset" && uv pip install --system .)
rm -rf "$MOONSET_TMPDIR"
else
log "moonset bereits installiert."
fi
# --- moonlock systemd user service --- # --- moonlock systemd user service ---
log "Konfiguriere moonlock User-Service..." log "Konfiguriere moonlock User-Service..."