- Nouveau wob-overlay.py : fenêtre GTK3+GtkLayerShell transparente avec barre arrondie (border-radius 12px), couleur pink pour volume et cyan pour luminosité - Protocole FIFO typé : v:N pour volume, b:N pour luminosité - wob-start.sh lance wob-overlay.py au lieu du binaire wob - wob-volume.sh, wob-brightness.sh, vc-media-popup.py et power-profile.sh mis à jour pour envoyer les messages typés - Correction bug vc-media-popup.py : les deux sliders audio contrôlaient @DEFAULT_AUDIO_SINK@ (mauvaise capture de target)
54 lines
1.7 KiB
Bash
Executable File
54 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# power-profile.sh — profil énergie ACPI → JSON waybar
|
|
# Sans argument : affiche le profil courant en JSON
|
|
# --toggle : cycle vers le profil suivant + applique la luminosité
|
|
|
|
# Luminosité par profil (%)
|
|
BRIGHT_performance=80
|
|
BRIGHT_balanced=60
|
|
BRIGHT_low_power=30 # low-power → clé sans tiret
|
|
|
|
_bright_for() {
|
|
local key="${1//-/_}"
|
|
local var="BRIGHT_${key}"
|
|
echo "${!var:-60}"
|
|
}
|
|
|
|
if [[ "$1" == "--toggle" ]]; then
|
|
CURRENT=$(cat /sys/firmware/acpi/platform_profile 2>/dev/null || echo "balanced")
|
|
case "$CURRENT" in
|
|
performance) NEXT="balanced" ;;
|
|
balanced) NEXT="low-power" ;;
|
|
*) NEXT="performance" ;;
|
|
esac
|
|
|
|
echo "$NEXT" > /sys/firmware/acpi/platform_profile
|
|
|
|
# Appliquer la luminosité du nouveau profil
|
|
BRIGHT=$(_bright_for "$NEXT")
|
|
brightnessctl set "${BRIGHT}%" -q
|
|
|
|
# Feedback overlay
|
|
if [[ -p /tmp/wob.fifo ]]; then
|
|
echo "b:${BRIGHT}" > /tmp/wob.fifo 2>/dev/null || true
|
|
fi
|
|
|
|
# Rafraîchir le module waybar
|
|
pkill -RTMIN+8 waybar
|
|
exit 0
|
|
fi
|
|
|
|
# ── Affichage JSON ────────────────────────────────────────────────────────────
|
|
|
|
PROFILE=$(cat /sys/firmware/acpi/platform_profile 2>/dev/null || echo "unknown")
|
|
|
|
case "$PROFILE" in
|
|
performance) ICON=""; CLASS="performance" ;;
|
|
balanced) ICON=""; CLASS="balanced" ;;
|
|
low-power) ICON=""; CLASS="low-power" ;;
|
|
*) ICON=""; CLASS="unknown" ;;
|
|
esac
|
|
|
|
printf '{"text":"%s","tooltip":"Profil énergie : %s","class":"%s"}\n' \
|
|
"$ICON" "$PROFILE" "$CLASS"
|