Cannot assign workspace for visual-studio-code-bin

Hello everyone,
I want to assign workspace for visual studio code which I had installed from aur. While using xprop it shows this:

		window state: Normal
		icon window: 0x0
		program specified location: 6, 30
		program specified minimum size: 400 by 270
		program specified maximum size: 2147483647 by 2147483647
WM_NAME(UTF8_STRING) = "Get Started - Visual Studio Code"
_NET_WM_NAME(UTF8_STRING) = "Get Started - Visual Studio Code"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x1, 0x0, 0x0
XdndAware(ATOM) = BITMAP
WM_WINDOW_ROLE(STRING) = "browser-window"
WM_CLASS(STRING) = "code", "Code"

Here is my config

# bind program to workspace and focus to them on startup:
assign [class="Xfce4-terminal"] $ws1
assign [class="Google-chrome"] $ws2
assign [class="Thunar"] $ws3
assign [class="Gedit"] $ws4
assign [class="Visual Studio Code"] $ws5

But it isn’t working. When I install code-oss it works but for visual studio code downloaded form aur it doesn’t work.
I have tried "code" as well as "Code"
But none is working.
Can I assign workspace in any other way?

1 Like

Try this (works for me):

assign [class="(?i)code"] $ws5
assign [class="code"] $ws5

should work. Or as @Kichiyaki pointed out, it can be case insensitive with (?i) option.

Next thing you need somewhere in the config is definition of ws.

set $ws5 5

And do not forget to restart your i3. You can use a shortcut defined in the config or from the terminal.

i3-msg restart

If it still doesn’t work you could try to modify config with some regex.

assign [class="^code$" title="^.*Visual.Studio.Code.*$"] $ws5

Or if it still doesn’t work the problem is in the way how this software creates windows. For example this issue clearly states that some Firefox window changes its parameters during startup and therefore assign method doesn’t work on it.

You will have to determine correct value during the startup. Or use for_window ... move operation which is not optimal.


Thank you. It worked for me too.

Thank you @Kichiyaki 's suggestion worked for me. Thank you very much. :heart:

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