How to Add a Music Visualizer to Your Linux Desktop

Robert Washbourne - 4 months ago - themes

A great way to add some flair to your desktop is to use a music visualizer, such as cava. However, these visualizers usually run in a terminal, and putting them on the desktop is a bit tricky. I do it here by creating a transparent terminal on the desktop, using it as a transparent terminal wallpaper, and playing cava there.

Installation

Cava (Console-based Audio Visualizer for ALSA) can be installed from the AUR on Arch Linux with the following:

yaourt -S cava  

On Ubuntu, you can use

sudo add-apt-repository ppa:tehtotalpwnage/ppa  
sudo apt-get update  
sudo apt-get install cava  

On other distros, you can install manually or use the guide from cava's github.

Edit ~/.config/cava/config and set the sensitivity.

The easy way1

Tilda is a versatile and powerful terminal, if not slow. On Arch, install with

sudo pacman -S tilda  

On Ubuntu, use

sudo apt-get install tilda  

On other distros, or if the package does not work, install from source.

Run Tilda. You should find a black window.

To get it to our specifications, right click on the window and select preferences.

Under the General tab, uncheck "Always on Top".

Under Appearance, make the terminal fullscreen, or ~500px high on the bottom of your desktop. Check "Enable Transparency" and make the "Level of Transparency" 100%.

Under the Colors tab, chose "Green on Black" or "Personalize".

Under Scrolling you must select "Disabled".

At this point you should have something like this:

Run cava in tilda to get a desktop music visual.

Fixing Openbox

In Openbox, tilda will obscure other windows. Add this to your RC file:

<application name="tilda">  
<layer>below</layer>  
</application>  

The harder, better way

Tilda may be buggy on some systems, so you can use the terminal that comes with your desktop.

gnome-terminal

Install gnome-terminal-transparency using your distro's package manager.

Open gnome-terminal and add a new profile, dc1.

Then go to preferences, remove "show menubar by default", and make the terminal fully transparent.

Now add the following command to startup, or add an alias:

gnome-terminal -e "cava" --window-with-profile=dc1 --role=dc1; sleep 0.3; wmctrl -i -r "$(wmctrl -l | grep "cava" | tail -1 | cut -f1 -d' ')" -e 10,0,594,1920,500  

This starts gnome-terminal with Cava, then sets the size to cover the screen. Modify with to your screen size.

Now we need to layer the gnome terminal window on the bottom.

To "layer" windows on Unity and Gnome, we can use something called Devilspie and wmctrl.

On Arch, use the following to install Devilspie:

pacman -S devilspie  

On Ubuntu, use

sudo apt-get install devilspie  

Now that devilspie is installed, we need to add a rule for gnome-terminal windows.

Create hidden config directory for devilspie:

mkdir ~/.devilspie  

Then create a config file (we use Cava because it renames the window):

nano ~/.devilspie/dc1.ds  
--------------------------
(if
(matches (window_role) "dc1")
(begin
(stick)
(below)
(undecorate)
(skip_pager)
(skip_tasklist)
(wintype "dock")
)
)

Customize the geometry to your liking.

On Openbox, this is of course easier:

<application role="dc1">  
  <position>
    <x>center</x>
    <y>center</y>
  </position>
  <maximized>false</maximized>
  <shade>no</shade>
  <layer>below</layer>
  <decor>no</decor>
  <skip_pager>yes</skip_pager>
  <skip_taskbar>yes</skip_taskbar>
</application>  

You could also use xfce-terminal or gnome-terminal as an alternative to Tilda.

xfce-terminal

Use the default xfce terminal and wmctrl to put it on the desktop.

#!/bin/bash
xfce4-terminal -e "cava" --hide-borders --hide-toolbar --hide-menubar --title=desktopconsole --geometry=130x44+0+0 &  
sleep 0.3  
wmctrl -r desktopconsole -b add,below,sticky  
wmctrl -r desktopconsole -b add,skip_taskbar,skip_pager  

Finishing up

This looks pretty cool under a transparent dock, or with a fullscreen window:

Youtube video

  1. Thank you Arch wiki for tilda guide.

Subscribe to DevPy
Get a post every few weeks, no spam.