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

Difficulty: ★★☆☆☆

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

  1. Install the KDocker GIT dev release from AUR:

    yay -S kdocker-git
    
  2. Create simple script (I already installed spotify-adblock-git and preloaded properly the 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

    • 20200122 :: switch to kdocker git development. Unable to build stable lastest release.
    • 20190816 :: prevent launch as root and prevent launch second instance of main spotify window.
  3. To set the exexcutable bit execute:

    chmod 755 spotify-kdocker
    

Behavior

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

2 Likes