The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

Spawn placeholder

asked Jul 27 '15

gerw gravatar image

updated Jul 28 '15

i3convert gravatar image

Is it possible to spawn a (specific) placeholder exactly at the position at which a new window would spawn?

Currently, I used

i3-msg append_layout file

with file being

{
"name": "aa",
    "swallows": [
       {
          "class": "bb",
          "instance": "cc"
       }
    ],
    "type": "con"
}

However, this window spawns at the top-node of the workspace (i.e. on the very right/bottom).

Maybe there is another possibilty to create those handy placeholder windows?

2 answers

Sort by » oldest newest most voted
2

answered Jul 28 '15

gerw gravatar image

One can simply use

i3-msg "workspace dummy; append_layout file; focus child; move window to workspace back_and_forth; workspace back_and_forth"

Here, dummy is a workspace which is not used elsewhere. The only drawback seems to be that this command changes back_and_forth.

Comments

Nice idea. You can of course fix the drawback by moving to the previous workspace first and saving its name.

i3convert gravatar imagei3convert (Jul 28 '15)edit
1

answered Jul 28 '15

i3convert gravatar image

updated Jul 28 '15

Let me sketch a possible solution (assuming that “aa” is a unique name). First, move the layout window to the scratchpad automatically by adding the following line to the config file:

for_window [title="^aa$"] move scratchpad

Next write a script that places the placeholder as follows. First it should issue the append_layout command. Then it should wait for the layout window to be opened (you can subscribe to i3 events, which I won't go into, or use an ugly solution that waits in loop and checks every, say, 0.01s whether the window has been opened). When it has been opened, it should issue two commands:

  • [title="^aa$"] scratchpad show to show the layout window.
  • floating disable to make it tiling in the current position.

Comments

Thank you for your valuable input. By playing around with your suggestion, I have found an easier solution.

gerw gravatar imagegerw (Jul 28 '15)edit

Question Tools

1 follower

Stats

Asked: Jul 27 '15

Seen: 101 times

Last updated: Jul 28