To activate the volume controls on the keyboard, I had to open
~/.config/openbox/trisquel-mini-rc.xml
look for
  </keyboard>

and add the contents of attachment1 above that line:
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>~/.local/share/volume.sh toggle</command>
      </action>
    </keybind>
    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>~/.local/share/volume.sh up 5%</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>~/.local/share/volume.sh down 5%</command>
      </action>
    </keybind>

then, create a file named ~/.local/share/volume.sh:
touch ~/.local/share/volume.sh
chmod +x ~/.local/share/volume.sh

open the file and put the following:
#!/bin/bash

# Check that amixer exists or exit
[[ -z `which amixer` ]] && exit 1

case "$1" in
[uU] | [uU][pP])
        echo "Volume up by $2";
        amixer set Master "$2"+;
;;
[dD] | [dD][oO][wW][nN])
        echo "Volume up by $2";
        amixer set Master "$2"-;
;;
[mM] | [mM][uU][tT][eE])
        echo "Muting";
        amixer set Master mute;
;;
[uU][nN] | [uU][nN][mM][uU][tT][eE])
        echo "Unmuting all";
        for i in {Master,Headphone,PCM,Speaker}; do
                amixer set "$i" unmute;
        done;
;;
[tT] | [tT][oO][gG][gG][lL][eE])
        echo "Toggling all according to Master";
        # Get the status of the Master control
        M=$(amixer get Master | grep 'dB.*\[o' | awk '{print $NF}' | tr -d 
'[]');
        for i in {Master,Headphone,PCM,Speaker}; do
                # If the master is on, mute it (set on)
                if [[ $M == "on" ]]; then
                        amixer set "$i" mute;
                # If the master is off, unmute it (set off)
                elif [[ $M == "off" ]]; then
                        amixer set "$i" unmute;
                fi;
        done;
;;
esac

then run openbox --reconfigure

and I would like to see these changes in the next release of Trisquel!_* please.

I was not able to post my comment (possibly due to xml.) The attachment shows a way to solve the issue with the keyboard bindings to the volume controls.

Reply via email to