The i3 FAQ has migrated to https://www.reddit.com/r/i3wm/. All content here is read-only.
Ask Your Question
1

What is wrong in this use of 'focus parent' ?

asked 2013-11-25 18:43:05 +0000

geo909 gravatar image

updated 2013-11-25 21:45:48 +0000

badboy_ gravatar image

Inside my i3config, I have a bindsym like so:

bindsym $mod+F1 split h; exec pcmanfm; exec pcmanfm; focus parent; split v; exec terminal

I was expecting that if I go to an empty workspace and hit mod+F1, I should get the following layout (EDIT: cannot post images or links due to low carma):

However I only get a horizontal split of 3 windows, lxterminal beeing on the top. The same happens if I change the split commands like so: exec i3-msg layout splith, etc.

Could somebody please explaing what I'm doing wrong and how I should correct it?

edit retag flag offensive close merge delete

Comments

Please, could somebody with higher karma fix the link for me?

geo909 gravatar imagegeo909 ( 2013-11-25 18:43:28 +0000 )edit

@badboy Sorry to appear greedy.. could you please use the image so that it appears in the message and people don't have to click? Thank you!

geo909 gravatar imagegeo909 ( 2013-11-25 18:52:58 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-11-25 21:27:23 +0000

Adaephon gravatar image

updated 2013-11-28 08:05:54 +0000

Your usage of focus parent is correct. The problem lies elsewhere.

There are two problems with that approach:

  1. On a empty workspace there is no container on which layout splith or splith would work.
  2. exec does not return only after the program has fully started or at least has a window, but returns immediatelly after startup has initalized.

The solution to the first problem is to create the first window, before changing the layout to splith.

The second problem is a bit more tricky. You could probably use i3 IPC and register to to window events.

An easy (but not reliable in every case) solution could be an external script:

#!/bin/sh
i3-msg 'exec pcmanfm'
sleep .5
i3-msg 'layout splith; exec pcmanfm'
sleep .5
i3-msg 'focus parent; layout splitv; exec terminal'

The duration of the sleeps will of course depend on the program you start. Safe this script, for example as 'startup.sh', make it executable and bind it to your shortcut:

bindsym $mod+F1 exec --no-startup-id /path/to/startup.sh
edit flag offensive delete link more

Comments

Thanks.. Unfortunately your script doesn't work. It opens the three programs in a vertical split. I increased the sleep times, but it's still the same. In any case, I think it makes more sense to switch to a dual panel file manager with terminal in handy, like emelfm2..

geo909 gravatar imagegeo909 ( 2013-11-27 12:38:41 +0000 )edit

Btw it's `--no-startup-id` not `not-startup-id`, but this is not the problem

geo909 gravatar imagegeo909 ( 2013-11-27 12:39:21 +0000 )edit

Thanks, I fixed the typo. As for the script not working, I tested it with xclock and xlogo. I now testet with pcmanfm and had to raise the sleep to one second to work reliably. If you start `pcmanfm -d`, a daemon is started and subsequent `pcmanfm` start only client, reducing "time to window".

Adaephon gravatar imageAdaephon ( 2013-11-28 10:16:41 +0000 )edit

Weird.. Still doesn't work.. I accepted the answer though as it seems that the method is working for you. I also started trying vifm, so for the moment I won't look further into this, I think.. Thank you!

geo909 gravatar imagegeo909 ( 2013-11-29 18:51:25 +0000 )edit

Question Tools

Stats

Asked: 2013-11-25 18:43:05 +0000

Seen: 707 times

Last updated: Nov 28 '13