Assign Spotify app to workspace issue

Hello! I’m trying to modify i3 config to have Spotify assigned to a workspace. However, it will not open in the assigned workspace. It opens in whatever workspace I’m in at the time.

Here are the relevant parts of my config file:

# bind program to workspace and focus to them on startup:
assign [class="Alacritty"] $ws1
assign [class="Code"] $ws2
assign [class="(?i)brave"] $ws3
assign [class="Thunar"] $ws4
assign [class="spotify"] $ws5
assign [class="easyeffects"] $ws6

# automatic set focus new window if it opens on another workspace then the current:
for_window [class="Alacritty"] focus
for_window [class="Thunar"] focus
for_window [class="(?i)brave"] focus
for_window [class="Code"] focus
for_window [class="spotify"] focus
for_window [class="easyeffects"] focus

I used xprop to get the class and instance, and it appears the class is “Spotify” and instance “spotify”.

When Spotify opens, is it actually opening as a Electron? Or something like that? I would think VS Code would do the same, but it opens in WS 2 just fine.

Any thoughts or help would be great. Thanks!.. Tom

for_window [class="Spotify"] focus
1 Like

This is an issue with Spotify setting WM_CLASS too late. There are a few workaround scripts posted here. Perhaps you can adjust them, should you need to, for i3.

1 Like

Thanks for pointing me to those solutions!! They had the key, which is that ELECTRON usually sets the class late. And since it is Electron, I just needed to find another Electron app in the i3 issues. Thank you Microsoft Teams!!

Microsoft teams not being assigned to a window. #4788

The solution for Spotify:

for_window [class=Spotify] move window to workspace 5

And yes, @archbtw, you were right, the class needs a capital-S for Spotify. Thanks for catching that!! But focus won’t assign the window. It does focus it after moving, though.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.