Spotify Single Instance (Linux App Alternative)


The Spotify app for Linux seems to trigger a cascading failure with Cinnamon on my machine, where it balloons up sucking up all my ram and cpu power. Great! So let’s switch it to a single instance app using Chromium.

We can bind a keyboard shortcut to:

one-classname-instance "open.spotify.com__browse.Chromium-browser" "/usr/bin/chromium-browser --app=https://open.spotify.com/browse"

Where one-classname-instance looks something like this:

#!/bin/bash
CLASSNAME=$1
PROGNAME=$2
if [ -z "$CLASSNAME" ]; then
	echo Your options...
	wmctrl -xl
	exit 1
fi
if [ -z "`wmctrl -xl | grep -i \"$CLASSNAME\"`" ]; then
	$2 &
else
	wmctrl -xa $CLASSNAME
fi