Hi everyone, in this post I will provide a guide on how to program some shortcuts for the XFCE environment that increase, decrease, and mute the volume. (These shortcuts will show a notification when executed).
Hola a todos, en este post escribiré una guía para programar unos atajos para el entorno XFCE que suben, bajan y mutean el volumen. (Los atajos mostrarán una notificación cuando se ejecuten).
⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️ IMPORTANT: these shortcuts are designed to work with PipeWire; to make them work with PulseAudio, you need to change the wpctl command to pactl and install the respective packages.
IMPORTANTE: estos atajos están diseñados para funcionar con PipeWire; para que funcionen con PulseAudio, deben cambiar el comando wpctl por pactl e instalar los paquetes respectivos.
⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️❗⚠️
The first thing you need to do is install these three packages for everything to work correctly /// Lo primero que deben hacer es instalar estos tres paquetes para que todo funcione correctamente:
sudo pacman -S wireplumber
sudo pacman -S libcanberra
sudo pacman -S libnotify
Then, you need to create the following scripts in the terminal /// Luego, deben crear los siguientes scripts desde la terminal:
(for the mute switch /// para el interruptor de muteo)
nano ~/switch-audio.sh(to increase the volume /// para aumentar el volumen)
nano ~/increase-audio.sh(to decrease the volume /// para disminuir el volumen)
nano ~/decrease-audio.sh
When you create each script, paste its corresponding command /// Cuando creen cada script, deben pegar su correspondiente comando:
This code in the mute switch script /// Este código en el script del interruptor de muteo:
#!/bin/bash
# Switch mute (Interruptor de muteo)
wpctl set-mute \@DEFAULT_AUDIO_SINK\@ toggle
# Get the volume status (Obtener el estado del volumen)
volume_info=$(wpctl get-volume \@DEFAULT_AUDIO_SINK\@)
volume=$(echo "$volume_info" | awk '{print $2 * 100}' | xargs printf "%.0f")
muted=$(echo "$volume_info" | grep -o "\[MUTED\]")
# Show notification with an icon from the system (Mostrar notificación con un icono del sistema)
if [ "$muted" ]; then
# Show notification muted (Mostrar notificación silenciada)
notify-send -r 1701 -i "audio-volume-muted-symbolic" " "
else
# Show notification unmuted (Mostrar notificación sin silenciar)
notify-send -r 1701 -i "audio-volume-high-symbolic" "$volume%"
fi
This code in the volume increase script /// Este código en el script de incrementar volumen:
#!/bin/bash
# Volume increase (Incrementar volumen)
wpctl set-volume \@DEFAULT_AUDIO_SINK\@ 5%+
# Get current volume (Obtener el volumen actual)
volume_info=$(wpctl get-volume \@DEFAULT_AUDIO_SINK\@)
volume=$(echo "$volume_info" | awk '{print $2 * 100}' | xargs printf "%.0f")
# Show notification with updated volume (Mostrar notificación con el volumen actualizado)
notify-send -r 1701 -i "audio-volume-high-symbolic" "$volume%"
This code in the volume down script /// Este código en el script de bajar volumen:
#!/bin/bash
# Volume decrease (Disminuir volumen)
wpctl set-volume \@DEFAULT_AUDIO_SINK\@ 5%-
# Get the current volume (Obtener el volumen actual)
volume_info=$(wpctl get-volume \@DEFAULT_AUDIO_SINK\@)
volume=$(echo "$volume_info" | awk '{print $2 * 100}' | xargs printf "%.0f")
# Show notification with updated volume (Mostrar notificación con el volumen actualizado)
notify-send -r 1701 -i "audio-volume-high-symbolic" "$volume%"
Then you need to make the scripts executable /// Luego deben hacer que los scripts sean ejecutables:
chmod +x ~/switch-audio.sh
chmod +x ~/increase-audio.sh
chmod +x ~/decrease-audio.sh
At this point, if you run any of the three scripts from the terminal, you will see that they work, so the next step is to configure them to use a shortcut /// En este punto, si ejecutan cualquiera de los tres scripts desde la terminal, verán que funcionan, así que el siguiente paso es configurarlos para usarlos con un atajo:
1)
Find out the path of the scripts /// Averiguar la ruta de los scripts(run realpath file_name.sh in the terminal to know the exact path /// ejecuten realpath nombre_del_archivo.sh en la terminal para saber la ruta exacta)
2)
Once you have the path, copy it and go to /// Cuando tengan la ruta, cópienla y vayan a:
Applications > Settings > Keyboard and Application Shortcuts /// Aplicaciones > Configuración > Teclado y Atajos de las Aplicaciones
3)
Press 'Add' and enter the path of the command you want, then select the key combination and click 'Accept' (repeat with all the commands) /// Presionen 'Añadir' y pongan la ruta del comando que quieran, luego seleccionen la combinación de teclas y hagan click en 'Aceptar' (repitan con todos los comandos).
Done! The commands to raise, lower, and mute the volume of your system are now configured. I hope it works for you. See you soon.
Listo! Ya están configurados los comandos para subir, bajar y mutear el volumen de tu sistema. Espero que les funcione. Hasta pronto.
[link] [comments]