My *nix world

X11 volume control

In Ubuntu I had a volume control applet that allows me to change the volume or to toggle the volume (mute/unmute). There are many plugins/applets capable of doing this (on almost any Linux DM) but if you are like me then you will prefer to keep your desktop as lightweight as possible. Instead of loading an special applet at session start-up just to change the volume few times (if no time at all) per day I think that the following solution will give you the same results without keeping your RAM and CPU occupied by a resident daemon which you are not using at all (or maybe just few times per day):

  • create a simple bash script (eg: volumctrl) that will handle the volume control stuff
  • create a keyboard shortcut (eg: keyboard function key Raise Volume or any other that suit to you) that we will use for raising the volume; point the shortcut to our script with the following parameter: volumctrl ">"
  • create a keyboard shortcut (eg: keyboard function key Lower Volume or any other that suit to you) that we will use for lowering the volume; point the shortcut to our script with the following parameter: volumctrl "
  • create a keyboard shortcut (eg: keyboard function key Mute Volume or any other that suit to you) that we will use for toggling the volume (mute/unmute); point the shortcut to our script with the following parameter: volumctrl ""

Note: to make it working you will need the "amixer - command-line mixer for ALSA soundcard driver" otherwise you have to adapt the script based on other command-line tool you might use.

So anytime you press any of the above keyboard shortcuts the volume will be increasing, decreasing or toggled to mute/unmute. Also a notification balloon will inform you about this:

volume control
When muting the volume the balloon will looks like:

volume control
Important: The icons shown above depends on your DM (mine comes from Xfce Tango icon set) but you can easily adapt the above script to use your preferred icons.

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

 
The following two tabs change content below.
X11 volume control

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
X11 volume control

Latest posts by Eugen Mihailescu (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: