Notificación al cambiar el volumen o silenciar el micro
Las teclas de audio solo llamaban a wpctl y refrescaban slstatus, sin avisar. Ahora pasan por el script volumen (home/.local/bin), que hace lo mismo y además muestra una notificación con icono y barra de nivel. Se sustituye a sí misma en vez de apilarse. Los clics en VOL de la barra usan el mismo script. Se añade rtkit a install.sh: sin él, cada llamada a wpctl (también las de slstatus cada 2 s) llenaba el log de avisos de RTKit, y el audio no tenía prioridad de tiempo real. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016UdJsHrbkmzhoCb6TthP2m
This commit is contained in:
parent
16125211fe
commit
53498b8cd3
4 changed files with 53 additions and 6 deletions
41
home/.local/bin/volumen
Executable file
41
home/.local/bin/volumen
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
# Cambia el volumen o silencia la salida o el micro (PipeWire), refresca
|
||||
# slstatus y lo muestra en una notificación que se sustituye a sí misma.
|
||||
# Uso: volumen subir|bajar|silenciar|micro
|
||||
|
||||
case $1 in
|
||||
subir) wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+ ;;
|
||||
bajar) wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- ;;
|
||||
silenciar) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;;
|
||||
micro) wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle ;;
|
||||
*) echo "uso: volumen subir|bajar|silenciar|micro" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
pkill -USR1 -x slstatus
|
||||
|
||||
if [ "$1" = micro ]; then
|
||||
if wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep -q MUTED; then
|
||||
icono=microphone-sensitivity-muted texto="Silenciado"
|
||||
else
|
||||
icono=microphone-sensitivity-high texto="Activado"
|
||||
fi
|
||||
exec notify-send -t 2000 -h string:x-dunst-stack-tag:micro \
|
||||
-i "$icono" "Micrófono" "$texto"
|
||||
fi
|
||||
|
||||
# wpctl get-volume da algo como "Volume: 0.35 [MUTED]"
|
||||
estado=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
|
||||
vol=$(echo "$estado" | awk '{ printf "%d", $2 * 100 + 0.5 }')
|
||||
case $estado in
|
||||
*MUTED*) icono=audio-volume-muted texto="Silenciado" ;;
|
||||
*)
|
||||
if [ "$vol" -eq 0 ]; then icono=audio-volume-muted
|
||||
elif [ "$vol" -lt 34 ]; then icono=audio-volume-low
|
||||
elif [ "$vol" -lt 67 ]; then icono=audio-volume-medium
|
||||
else icono=audio-volume-high
|
||||
fi
|
||||
texto="$vol %"
|
||||
;;
|
||||
esac
|
||||
exec notify-send -t 2000 -h string:x-dunst-stack-tag:volumen \
|
||||
-h "int:value:$vol" -i "$icono" "Volumen" "$texto"
|
||||
Loading…
Add table
Add a link
Reference in a new issue