Shell script: paVolume

  Last modified on Sunday 14 February 2016

My original intent was to manage sound on Ubuntubook by binding the commands to the multimedia keys in ~/.xbindkeysrc. Instead xbindkeys calls a standalone script I created to control PulseAudio volume (and thus useful beyond just xbindkeys): paVolume

Let's go!

Script requirements: pactl, pamixer, and volnoti.

0. pactl

pactl controls a PulseAudio sound server and is included in pulseaudio-utils:

$ sudo apt-get install pulseaudio-utils

1. pamixer

pamixer is a PulseAudio console mixer. Compile dependencies:

$ sudo apt-get install build-essential libpulse-dev libboost-program-options1.58.0 libboost-program-options-dev

Download source and compile:

$ git clone https://cdemoulins@github.com/cdemoulins/pamixer.git
$ cd pamixer
$ make

No make install. Place the resulting pamixer in PATH (I use ~/bin).

2. volnoti

volnoti is a lightweight volume notification. Compile dependencies:

$ sudo apt-get install libdbus-glib-1-dev libgtk2.0-dev libgdk-pixbuf2.0-dev autoconf automake

Download:

$ git clone git://github.com/davidbrazdil/volnoti.git
$ cd volnoti
$ ./prepare.sh
$ ./configure --prefix=/usr

Apply this fix [1] to the source:

$ cd src
$ rm value-client-stub.h && make value-client-stub.h
$ rm value-daemon-stub.h && make value-daemon-stub.h
$ cd ..

Compile source (and I use checkinstall to make a deb package and install):

$ make
$ sudo checkinstall make install

Start volnoti daemon:

$ volnoti

Configure daemon to auto-start at desktop launch (example: i3 - add to ~/.i3/config):

# Auto-start applications
exec --no-startup-id volnoti -t 2

3. paVolume

Script posted to GitHub. Download and place in PATH. Run paVolume -h for options.

Happy hacking!

More • ubuntulinuxshellprogramming