Una vez creado y con permisos de ejecución asignamos la combinación de teclas que deseemos y problema resuelto.
Por si alguien tiene alguna duda vamos a suponer que al script lo hemos llamado volumen.sh y lo hemos guardado en /home/mi usuario/.
Lo primero que vamos a hacer va a ser instalar el binario del que depende el script.
$ sudo apt-get install libnotify-bin
Una vez creado le damos permisos de ejecución y nos dirigimos a Sistema>Preferencias>Combinaciones de teclas una vez allí pulsamos Añadir damos el nombre que queramos a la combinación y en comando ponemos:
Para subir el volumen:
/home/mi usuario/volumen.sh 5+
Para bajar el volumen:
/home/mi usuario/volumen.sh 5-
Para silenciar:
/home/mi usuario/volumen.sh mute
Estos parámetros los podéis modificar en función del porcentaje que necesitéis que suba o baje el volumen con cada pulsación de la combinación.
#!/bin/bash
#uso:
#para subir volumen usa volumen.sh 5+
#para bajar usa volumen.sh 5-
#para silenciar usa volumen.sh mute
#el script necesita un binario que puedes instalar con sudo apt-get install libnotify-bin
function os_not {
let vol=$2+0
if [ $vol -gt 70 ]
then
notify-send " " -i notification-audio-volume-high -h int:value:$1 -h string:x-canonical-private-synchronous:volume &
elif [ $vol -gt 30 ]
then
notify-send " " -i notification-audio-volume-medium -h int:value:$1 -h string:x-canonical-private-synchronous:volume &
elif [ $vol -gt 0 ]
then
notify-send " " -i notification-audio-volume-low -h int:value:$1 -h string:x-canonical-private-synchronous:volume &
elif [ $2 = "0" ]
then
notify-send " " -i notification-audio-volume-muted -h int:value:$1 -h string:x-canonical-private-synchronous:volume &
fi
}
volume=`amixer get Master | grep "Front Left:" | awk '{print ""$4""}'`
limite=`amixer get Master | grep "Limits:" | awk '{print ""$5""}'`
volume_level=`expr $volume "*" 100 "/" $limite`
mute_state=`amixer get Master | grep "Front Left:" | awk '{print ""$7""}'`
if [ $1 = "mute" ]
then
if [ $mute_state = '[on]' ]
then
amixer sset Master mute &
notify-send " " -i notification-audio-volume-muted -h int:value:$volume_level -h string:x-canonical-private-synchronous:volume &
else
amixer sset Master unmute &
os_not $volume_level $volume
fi
else
amixer sset Master $1 &
os_not $volume_level $1
fi
let vol=$2+0
if [ $vol -gt 70 ]
then
notify-send " " -i notification-audio-volume-high -h int:value:$1 -h string:x-canonical-private-synchronous:volume &
elif [ $vol -gt 30 ]
then
notify-send " " -i notification-audio-volume-medium -h int:value:$1 -h string:x-canonical-private-synchronous:volume &
elif [ $vol -gt 0 ]
then
notify-send " " -i notification-audio-volume-low -h int:value:$1 -h string:x-canonical-private-synchronous:volume &
elif [ $2 = "0" ]
then
notify-send " " -i notification-audio-volume-muted -h int:value:$1 -h string:x-canonical-private-synchronous:volume &
fi
}
volume=`amixer get Master | grep "Front Left:" | awk '{print ""$4""}'`
limite=`amixer get Master | grep "Limits:" | awk '{print ""$5""}'`
volume_level=`expr $volume "*" 100 "/" $limite`
mute_state=`amixer get Master | grep "Front Left:" | awk '{print ""$7""}'`
if [ $1 = "mute" ]
then
if [ $mute_state = '[on]' ]
then
amixer sset Master mute &
notify-send " " -i notification-audio-volume-muted -h int:value:$volume_level -h string:x-canonical-private-synchronous:volume &
else
amixer sset Master unmute &
os_not $volume_level $volume
fi
else
amixer sset Master $1 &
os_not $volume_level $1
fi
buenisimo..pero estoy flojo..no tenes el script completo?.. gracias.
ResponderEliminarEl script completo es ese, no se si a lo que te refieres es a crear uno que haga todos los pasos que describimos en la entrada.
ResponderEliminarSi es esto ultimo me temo que no puedo complacerte, mis conocimientos no llegan tan lejos.
Un saludo.