Among many new features in GNOME 3, the most exciting one is the ability to build extensions. Here’s how it’s done…

Building LUD Volume Control Extender

Step 06

Now that we are acquainted with the basics of GNOME extensions, it’s time to build our LUD Volume Control Extender.

Let’s start with the libraries we will be using:

extension.js

Clutter is a popular GNOME UI toolkit:

const Clutter = imports.gi.Clutter;

In the following statement we are importing GNOME Volume Control library:

const Gvc = imports.gi.Gvc;

Standard GNOME Widgets:

const St = imports.gi.St;

Provide support for pop-up menus:

const PopupMenu = imports.
ui.popupMenu;

Steo 07

Building the UI

Instead of designing our own volume control, we will be relying on the one provided by GNOME Shell. We will be using the same icon and for the most part we will also keep all its existing functionality.

Step 10

After making the changes, press Alt+F2, then type ‘r’ in the console and hit Enter to restart GNOME Shell. This will reload the extension with the latest changes.

You will notice that there are no new icons this time. Click on the Volume icon and you will notice some subtle differences.

You will notice that there is now a small arrow after Volume which, when clicked, allows you to switch to various audio output devices (if available).

You now have the ability to see which applications are using the sound output, and you get the volume controls for each of them. You can also mute individual applications using the ON/OFF toggle.

Changing GNOME

As you can see, with the LUD Volume Control Extender we have made a significant change in the existing GNOME Shell volume control. It almost feels like it is not an extension, but something which is actually built into the GNOME system. That is the beauty of GNOME Shell extensions, and they exist for a very good reason. When GNOME 3 was released, a lot of people hated the way it worked but still liked the elegance and simplicity that it offered. So they wanted a way to make changes to the GNOME Shell while keeping the overall experience intact. GNOME Shell extensions provided that way.