5

How can I configure i3 window manager to open new program (window) started in terminal on a specific workspace?

3 Answers 3

12

This is what you have to put in your ~/.i3/config file:

For example you want Emacs always opened up in work-space 4.

assign [class="Emacs"]   4

How do you get the class info?

Run xprop and click on the window you want to capture. For example while Emacs is running, using another terminal execute xprop and then click on the Emacs window. In the output you will find :

WM_CLASS(STRING) = "emacs", "Emacs"

The first string is the instance and the second one is the class.

Finally restart i3 ($mod+Shift+r ) for the changes to take place.

3

I believe it's answered in i3 User Guide: 4.16. Automatically putting clients on specific workspaces. You can match windows on many criteria - explained in detail here.

For example the following config will always open Firefox on workspace 2:

assign [class="Firefox"] 2

As per second doc I linked in class selectors you can use regular expressions, so you can say that everything that's not your terminal will open on specific workspace.

0

On startup, you use

assign [class="X-terminal-emulator"] 1'
assign [class="Firefox"] 10'
assign [class="Thunderbird"] 9'
assign [title="cmus v2.9.0"] 8'

You can also do that from the command line, notice that the syntax is different:

i3-msg '[class="X-terminal-emulator"]  move to workspace 1'
i3-msg '[class="Firefox"]     move to workspace 10'
i3-msg '[class="Thunderbird"] move to workspace 9'
i3-msg '[title="cmus v2.9.0"] move to workspace 8'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .