Populate an entire pre-configured workspace in i3wm

Is it possible with I3Wm to populate an entire workspace with determined size, position and commands for each window?

I know I can do i3-msg "exec xterm -e 'ls; bash'" to create a new window, but I can’t specify his position and size.

Maybe there is also an alternative by declaring via JSON the layout or something like that?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Since version 4.8, something like that is part of i3 and there’s a detailed guide on the website, but here’s a short version:

Once you’ve set up a workspace like you want it to be, save its layout with

i3-save-tree --workspace <whichever workspace you want> > ~/.i3/layout-ws-<xyz>.json

into the file ~/.i3/layout-ws-xyz.json. You’ll then need to edit that file to enable criteria that match windows in the layout.

After that, you can restore that layout with

i3-msg "workspace <your workspace>; append_layout ~/.i3/layout-ws--<xyz>.json"

This will open placeholder windows on that workspace and when a window matching the criteria enabled in the layout file appears, it will be placed in the corresponding placeholder window.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x