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

Automatically stack certain windows

asked 2013-11-12 13:20:42 +0000

Yuri Khan gravatar image

updated 2013-11-19 15:30:30 +0000

On my communications workspace, I have an email client and a Jabber client, tiled horizontally (Thunderbird occupying the left 4/5 of the screen, and Gajim contact list the remaining 1/5 on the right). There may be other windows stacked with Thunderbird.

Now I want to arrange for all chat windows spawned by Gajim to open stacked with its contact list.

If I only opened chat windows from my contact list, they would open in place automatically. But they also open when someone messages me.

I understand that I can arrange for my initial layout to be like this:

  • H-split container
    • Stacked container
      • Thunderbird
    • Stacked container
      • Gajim contact list

Then, I plan to have a for_window rule matching all Gajim windows.

What do I need to write as the action, so as to move the new window to the second stacked container in that workspace?

As an ugly workaround, I used to use this:

assign [class="Gajim"] 2
for_window [class="Gajim"] focus; move right; move right; move left

but this doesn’t play well with switching Thunderbird’s parent container into tabbed layout. (I would need to increase the number of move rights to the maximum number of tabbed windows I can have.)

edit retag flag offensive close merge delete

Comments

It would be nice to have some of the workspace features for containers, too. Being able to predefine (named) containers, setting a layout (other than the global default) and assigning windows to them would go a long way to help with cases like this. I'd certainly like to see something like that.

Adaephon gravatar imageAdaephon ( 2013-11-12 20:46:49 +0000 )edit

Adaephon: Experiment with http://i3wm.org/docs/userguide.html#_vim_like_marks_mark_goto. Focus parent, set a mark, and some juggling is possible with this container.

joepd gravatar imagejoepd ( 2013-11-17 20:28:15 +0000 )edit

joepd: I'm aware of that feature, but the container has to be already there in order to use it. And even with a mark on the container it is not possible to move a window into it by using that mark as target. Or am I missing something?

Adaephon gravatar imageAdaephon ( 2013-11-17 21:35:18 +0000 )edit

As far as I understand, marks add a different way to address a window or container, in case its class/instance/role is not unique enough. It does not, however, allow any new two-address commands involving a window and a container (such as `move window to container`).

Yuri Khan gravatar imageYuri Khan ( 2013-11-18 03:07:25 +0000 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2013-11-19 15:29:27 +0000

Yuri Khan gravatar image

The basic commands we have for moving windows around are the basic move left|right|up|down which work within one workspace and lead to the ugly workaround; and one more command move container to workspace x. Let’s examine the latter.

If we spell out all the defaults, what the general form of this command exactly does is it moves the currently active window on the current workspace into the parent container of the currently active window on the target workspace, except that:

  • if workspace_auto_back_and_forth is set and target workspace is the same as current, or
  • if target workspace is back_and_forth,

then the target workspace is adjusted to the most recent previously active workspace.

So, if we want to use this command, we need to arrange for the following conditions:

  1. The subject window is currently active.
  2. The target window is currently active on its workspace. (It follows that the subject window has to be on some other workspace.)
  3. The target workspace is the most recent previously active workspace. (Because otherwise we will have to specify the target workspace explicitly.)

Working back from those requirements, we get the following sequence (assuming the subject window is currently focused):

  1. Move the subject window into an empty temporary workspace, out of the way but still easily accessible. move container to workspace temp;
  2. Focus the target window. (This satisfies requirement 2.) [class="Gajim" role="roster"] focus;
  3. Activate the temporary workspace. (This deals with requirements 3 and also 1, as the subject window is the only one on that workspace.) workspace temp;
  4. Move the window into place. move container to workspace back_and_forth;
  5. Finally, activate the target workspace. workspace back_and_forth
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-11-12 13:20:42 +0000

Seen: 442 times

Last updated: Nov 19 '13