Thunar Workspace in i3wm

Hello. I’m a long time Linux user (mostly Ubuntu-based distros) and have recently hopped over to EndeavorOS i3WM edition. Took a little while getting used to not having a DE but I now love it. The problem I’m having is with keybindings and dedicated workspaces. When I enter $MOD+enter or $MOD+w, it opens either the terminal in WS1 or Firefox in WS2 and focuses on the correct workspace. When I enter $MOD+n to open the file manager (Thunar), it starts the program in WS3 but does not change focus to that workspace and I must then enter $MOD+3 to get to the file manager. I’ve looked through the i3 config file and everything looks correct.

I’m stumped and would appreciate any help on how I can automatically change focus to WS3 after opening Thunar using the keybinding.

Uncomment line 25 in config, the one that reads:
#for_window [class=Thunar] focus

1 Like

Thanks but I already tried that. By the way, in my i3 config file, this is line 320, not 25. I uncommented this line and restarted i3wm. I then opened Firefox which changed focus to WS2. I then entered $MOD+n to open Thunar and it did not switch focus to WS3. I had to enter $MOD+3 to get to Thunar. I’d appreciate any other suggestions.

hmm I will look into this…

working just fine here
assign [class=“Thunar”] 3
for_window [class=“Thunar”] focus

edit: ups in EOS i3wm default is
assign [class=“Thunar”] $ws3

1 Like

did you save change + reload /restart i3 ?

reload config mod+shift+c
restart i3 mod+shift+r

@joekamprad it work ok ( i on fresh install)

Tried all of the suggestions and still can’t get it to automatically focus to WS3 upon starting Thunar. Any other ideas?

there must be something wrong with your i3wm config file

I’m on the EOS bspwm edition
and have just installed i3wm but not with EOS i3wm config
but have been on github and reviewed EOS i3wm config
everything is as it should be

i3wm documetnation also recommends something like this

for_window [class="Thunar"] move to workspace 3, focus

where you can replace 3 with $ws3 (if defined) or any number workspace you want.

1 Like

i just tested i3wm from eos config
and it works as it should

check line 314 +322

as @vlkon says
it works too

it is default in i3wm config

We use variables to avoid repeating the names in multiple places.

set $ws1 “1:”
set $ws2 “2:”
set $ws3 “3:”
set $ws4 “4:”
set $ws5 “5:”
set $ws6 “6”
set $ws7 “7”
set $ws8 “8”
set $ws9 “9”
set $ws10 “10”

bind program to workspace and focus to them on startup:

assign [class=“Xfce4-terminal”] $ws1
assign [class="(?i)firefox"] $ws2
assign [class=“Thunar”] $ws3
assign [class=“Thunderbird”] $ws4
assign [class=“TelegramDesktop”] $ws5

automatic set focus new window if it opens on another workspace then the current:

for_window [class=Xfce4-terminal] focus
for_window [class=(?i)firefox] focus
for_window [class=Thunar] focus
for_window [class=Thunderbird] focus
for_window [class=TelegramDesktop] focus

yes. he/she possible miss or mistake add thing

it work .I on new install

@EndeavorNewbie you can check config in own time here

The following lines have always been (uncommented) in my config file:

set $ws3 “3:”
assign [class=“Thunar”] $ws3
for_window [class=Thunar] focus

I have reloaded the config using mod+shift+c and then restarted i3 using mod+shift+r without resolution. I have also rebooted several times but I know that is unnecessary if i reload the config and restart i3.

At the suggestion of vlkon, I modified one of the lines as follows and it resolved the problem:

for_window [class=“Thunar”] move to workspace $ws3, focus

I appreciate that the forum helped solve the issue but I wonder why the default syntax doesn’t work for me but works for others?


little of mine config

set $ws1 “1”
set $ws2 “2”
set $ws3 “3”
set $ws4 “4”
set $ws5 “5”
set $ws6 “6”
set $ws7 “7”
set $ws8 “8”
set $ws9 “9”
set $ws10 “10”

assign [class=“Lxappearance|Nitrogen”] 6
assign [class=“Pavucontrol”] 6
assign [class=“Thunar”] 3
for_window [class=“Thunar”] focus

without $ws3 it works and with $ws3 it work


for_window [class=“Thunar”] move to workspace $ws3, focus
for_window [class=“Thunar”] move to workspace 3, focus
works just fine here

Yeah, I’m confused why the slightly different syntax makes a difference. I also have EndeavorOS i3WM installed on my laptop at home and will see if I have the same problem on that system.

It doesn’t work for me neither. Well, sometimes. Perhaps it has something to do with Thunar version or the fact that Thunar wm_class is WM_CLASS(STRING) = "thunar", "Thunar" and i3wm is case sensitive.

Now for example

assign [class="Thunar"] 7
for_window [class="Thunar"] focus

works, but

assign [class="thunar"] 7
for_window [class="thunar"] focus

does not.

So, try

assign [class="[tT]hunar"] $ws3
for_window [class="[tT]hunar"] focus

or a little confusing :grinning:

assign [class="hunar"] $ws3
for_window [class="hunar"] focus

Edit: Or it is possible I am reading the documentation incerrectly. First lower case “thunar” is supposed to be an instance. This should also work

set $ws3 "3:thunar"
assign [class="Thunar" instance="thunar"] $ws3
for_window [class="Thunar"] focus
1 Like


Thanks, I think you are onto something. I’m going to mess around with it tonight.

could be related to the fact we are using i3-gaps… ?
And I know from firefox that it is changing class so it needs [class=(?i)firefox]
Could be checked with xprop command what should look like so: