Audio notification with amixer

jEsuSdA 8) listas at jesusda.com
Wed Jul 12 21:58:13 CEST 2017


El 11/07/17 a las 16:00, Pétùr escribió:
> Le 02/07/2017 à 20:03, Pétùr a écrit :
>> Hi,
>>
>> I use amixer to change audio volume. I have a notification when I use
>> the multimedia keys of my keyboard but not when I bind the amixer
>> command to another shortcut.
>>
>> For example: "amixer -q set Master 5%+ unmute" is binded both to one of
>> the multimedia key and to Ctrl+PageUp. I have the two shortcuts in xfce
>> settings manager but I only have notifications for the multimedia key.
>>
>> I believe xfce4-volumed is no longer active and that
>> xfce4-pulseaudio-plugin is the new replacement. I have
>> xfce4-pulseaudio-plugin installed.
>>
>> How can I have audio notifications for keyboard shortcuts other than
>> multimedia keys?
>>
>> Pétùr
>>
>
> No one?


If you want to have notification, then try to create a script or a 
command line adding the notify-send instruction.

Something like that:

notify-send " " -h int:value:80 -i audio-volume-high


You can get the actual volume using "amixer get Master". And you can 
extract the volume percent with something like that:

  amixer get Master | awk '$0~/%/{print $5}' | tr -d '[]%'


#!/bin/bash

# So, you can make a script getting the volume:

VOLUME=`amixer get Master | awk '$0~/%/{print $5}' | tr -d '[]%'`

# Calculate the new volume:

NEWVOLUME= `expr $VOLUME + 5`

# Increase the volume:

amixer -q set Master 5%+ unmute

# Notify the change:

notify-send " " -h int:value:$NEWVOLUME -i audio-volume-high

# and thats all!!


I hope to help you. ;)







More information about the Xfce mailing list