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:

_NET_WM_DESKTOP(CARDINAL) = 2
_NET_WM_STATE(ATOM) = 
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
_NET_WM_USER_TIME(CARDINAL) = 5725066
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		program specified location: 6, 30
		program specified minimum size: 400 by 270
		program specified maximum size: 2147483647 by 2147483647
_NET_WM_ICON(CARDINAL) = 
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
_NET_WM_BYPASS_COMPOSITOR(CARDINAL) = 2
WM_WINDOW_ROLE(STRING) = "browser-window"
WM_CLASS(STRING) = "code", "Code"
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_PID(CARDINAL) = 143307
WM_CLIENT_MACHINE(STRING) = "linux"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING, _NET_WM_SYNC_REQUEST 

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
3 Likes
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.

2 Likes

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.