[HowTo] Minimize Spotify App Window directly to tray |20190816

Spotify AUR app does not support tray at all. There is a solution.

  1. Install KDocker from AUR:
yay -S kdocker
  1. Create simple script (I already installed spotify-adblock-git and preloading properly lib in this script code):

spotify-kdocker

#!/usr/bin/env bash
if [ "$(id -u)" = "0" ]; then
    echo "This script must be run as normal user" 1>&2
    exit 1
else

APP="/opt/spotify/spotify"
 
if ps ax | grep -v grep | grep $APP > /dev/null
    then
        echo "$APP application running, everything is fine" 1>&2
    else
        env LD_PRELOAD=/usr/lib/spotify-adblock.so spotify --force-device-scale-factor=1.2 &
        kdocker -n Spotify -i /usr/share/icons/hicolor/64x64/apps/spotify.png -q 
    fi
fi

Changelog spotify-kdocker launcher code

  • 20190816 :: prevent launch as root and prevent launch second instance of main spotify window.

Set EXE bit and Launch script spotify-kdocker.

Behavior

During launch spotify-kdocker main spotify window will appear for a while and next minimized to tray. Cick on Spotify Icon in tray for restore main window AND again minimize to tray if you need. Global Media Hotkeys works like a charm no matter where window app is. :wink:

6 Likes

Forum kindly sponsored by Bytemark