How to: Quick switch Audio Out from taskbar without entering Audio Settings

audio

#1

Hi,

with Ubuntu & Ubuntu Mate there is no option to toggle Audio-Output profiles (e.g. Speaker or Headphones) from tray (taskbar).

You’ll have to access Pulseaudio sound settings then switch to Output tab and then select the audio card and then the audio out profile (headphones, speaker, …).
This is annoying! :face_with_symbols_over_mouth:

There are apps (Audio Output Switcher,…) and extensions to do this, but they require ppa’s or simply switch only audio cards but no audio out profiles. :face_with_raised_eyebrow:
e.g. here.

Here is a simple solution how to add Audio-Output buttons to the tray without installing apps

Simply press the Audio-Out button to switch output devices / profiles :grinning:

HOW TO:
Step 1:

Open Terminal:
pacmd list-cards

It will list all audio devices & profiles (HDMI, speakers, headphones, …) and give each audio-card an index number.
first audio-card 0, second card 1,…

My USB-Audio card (Dell WD15 dock) with Speaker and Headphone output is card 0
It shows two profiles:

  1. Speaker: analog-stereo-speaker
  2. Headset: analog-stereo-headphone+input:analog-stereo-mic

In my case these are the two outputs we want to quick switch. Let’s test them.

Step 2:

Open Audio Settings and switch to the audio-card you want to toggle the outputs.
You can see the active output (e.g. speakers)

Open Terminal and enter command to switch audio-card and profile output:
pacmd set-card-profile AUDIO-INDEX-NUMBER output:PROFILE-NAME

In my case to switch to Speakers:
pacmd set-card-profile 0 output:analog-stereo-speaker

In my case to switch to Headset:
pacmd set-card-profile 0 output:analog-stereo-headphone+input:analog-stereo-mic

Now let’s create the Audio-quick-toggle buttons with starters:

Step 3:

Right click on the desktop and select Create starter…

In Type leave the setting Application.

In Command place the terminal command to switch profile 1,e.g:
pacmd set-card-profile 0 output:analog-stereo-speaker

Create a second starter with the terminal command to switch profile 2, e.g:
pacmd set-card-profile 0 output:analog-stereo-headphone+input:analog-stereo-mic

Not necessary but optional add a delay of 1 second:
/bin/sh -c “/bin/sleep 1; pacmd set-card-profile 0 output:analog-stereo-speaker”
/bin/sh -c “/bin/sleep 1; pacmd set-card-profile 0 output:analog-stereo-headphone+input:analog-stereo-mic”

Add a Name and Comment and save the starters (name them e.g. headset and speaker).
They are placed on the desktop now.
Test them. Double clicking should already switch the audio-output.

Step 4:
Button-Icons:
Search whole system for audio icons (headset, speaker in my case).
Found audio svg icons in /usr/share/icons/mate/scalable/devices

headset-symbolic.svg
audio-speakers-symbolic.svg

Copied them to the desktop and changed icons in starter settings (see 3rd picture).

Step 5:
Place taskbar icons on right place:
Now drag and drop the two buttons to the tray (taskbar) and move them with right click menu.
The icons change back to default starter icons.
So simply right click the tray icons, select Settings and change the icons again in starter settings. They stay sticky now.

Step 6:
You can remove the starters and icons from desktop now or backup them in another place.
Done. :star_struck:

Please add a like if your’re happy now.

pappl


#2

I use indicator-sound-switcher. You still have to go to the panel. But, it provides a simple drop down list right from the panel and you can choose your input and your output with a single click.

See below:

Menu_013


#3

As already mentioned, there are some extensions and ppa’s which may or may not work after updates or dist upgrades. It’s a good choice too.

pappl