How to deal with a missing app_id in Sway

Piotr Stojanow's avatar
Name

Piotr Stojanow

Twitter
@piotrstojanow

In Sway, some apps have no app_id even though they are Wayland native. For example, Spotify’s app_id isn’t set correctly.

One way to fix this is to create a desktop file in your applications directory:

nvim ~/.local/share/applications/spotify.desktop

And set the StartupWMClass option:

[Desktop Entry]
Type=Application
Name=Spotify
GenericName=Music Player
Icon=spotify-client
Exec=spotify
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;Player;AudioVideo;
StartupWMClass=spotify

Next, we can configure the app according to our needs in the Sway config:

for_window [class="Spotify"] move to scratchpad