3

I'm trying to assign Spotify to a specific workspace but with no luck.

My i3 config file looks like this

#Startup-programs 
exec firefox 
exec spotify

assign [class="Spotify"] $ws4   
assign [class="Firefox"] $ws2

xprop on Spotify gives me this output

_NET_WM_ICON(CARDINAL) = 
WM_CLASS(STRING) = "spotify", "Spotify"
WM_NAME(STRING) = "Spotify"
_NET_WM_NAME(UTF8_STRING) = "Spotify"
_NET_WM_DESKTOP(CARDINAL) = 0
WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x0
XdndProxy(WINDOW): window id # 0x1a00002
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified location: 0, 0
        window gravity: Static
_NET_WM_PID(CARDINAL) = 27058
WM_LOCALE_NAME(STRING) = "it_IT.UTF-8"
WM_CLIENT_MACHINE(STRING) = "placobravo"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING

At startup both firefox and spotify loads, but only firefox gets placed in its right workspace, and I really can't get what's going on since I'm using the exactly same syntax. I already tried using a different workspace but it doesn't work.


After a bit more of searching I've found a solution in another post

https://github.com/i3/i3/issues/2060

  • 1
    You could try using [instance="spotify"] instead. It might be that the class name "Spotify" does not get assigned until after the window was already created. – Adaephon Jun 7 '18 at 6:45
  • 1
    This didnt work, but I found a solution. I've updated the post – user293588 Jun 7 '18 at 9:33
  • 1
    This behavior is documented exactly on the docs now. And the question has been answered (though improperly in the question itself) – Evan Carroll Nov 24 '18 at 22:38
  • Which is at: i3wm.org/docs/userguide.html#assign_workspace: Another known issue is with Spotify, which doesn’t set the class hints when mapping the window, meaning you’ll have to use a for_window rule to assign Spotify to a specific workspace. – Anne van Rossum Apr 2 at 18:11
4

(Taken exactly from question). Simply use

for_window [class="Spotify"] move to workspace $ws4

This is also in the the Arch i3 Wiki

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy