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

unforseen result of sequential execution

asked 2012-09-17 12:31:20 +0000

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

Hi all,

i use

i3 version 4.2 (2012-04-25, branch "release-4.2")

and i am very happy with it. Many thanks to the developers for this great software and that they make it freely available. Now to my question.

To define a workspace on startup i followed fhaun's auto-start-for-i3 script. Unfortunately it doesn't work for me as expected. After some debugging efforts i figured out what cause the strange behavior.

With the following bash script i want to illustrate this:

test_startup.sh:

#!/bin/bash
i3-msg workspace "[t]ools"
for i in {1..4} ; do
    galculator --class "galculator-${i}" &
done

If i execute this script from a running i3 session via rxvt i3 switches to workspace [t]ools and four instances of galculator are opened on this workspace subsequently. Just as expected. Whereas galculator stands for an arbitrary x-client.

If at the contrary i execute this script via the built in exec command for example by invoking i3-input:

exec test_startup.sh

the first instance of galculator is opened on the workspace from that i invoked i3-input and after that i3 switches to workspace [t]ools and the remaining instances of galculator are opened. So only three instances of galculator are on [t]ools. This means that the above line added to ~/.i3/config yields the same result.

Is it a bug, that the two approaches to execute test_startup.sh yields different results? Or is there anything wrong in my reasoning and i haven't considered a important point yet?

Thanks for your time and with best regards


Appendix 1 (19.09.2012)

I managed to install the latest version of the next branch but the results are still unsatisfactory.

The instructions with which i want to define a workspace on startup looks like this (i placed the code in the shell script test_startup.sh and test it via i3-input with exec test_startup.sh):

i3-msg workspace "test"
i3-msg exec thunar
i3-msg split v
i3-msg exec galculator
i3-msg exec urxvt

Unfortunately split v seems to be a global setting for the workspace test and all windows are arranged vertically no matter where i place this command, even if this command is appended to the last line.

Furthermore if i mix i3-msg split v and i3-msg split h instructions only the last one is crucial for the arrangement of the windows.

Is there a way to achieve the desired behavior i.e. have an arbitrary arrangement of windows on a specific workspace during startup?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2012-09-17 15:05:34 +0000

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

When using i3’s exec command, startup-notifications are used. They are the only way with which you can ensure that applications are placed on that workspace on which they are started (unless you use assignments/for_window, but that’s a permanent configuration).

Therefore, here is how you would ensure that (a startup-notification-respecting) application is launched on workspace 3:

i3-msg workspace 3
i3-msg exec firefox

Note that you should upgrade to the latest git version of the "next" branch which contains a fix that might be relevant for this to work with some applications (http://c.i3wm.org/32d4dbf)

edit flag offensive delete link more

Comments

Unfortunately the results are still unsatisfactory. I appended a more detailed explanation to my original post.

nichtleiter gravatar imagenichtleiter ( 2012-09-19 14:25:22 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2012-09-17 12:31:20 +0000

Seen: 297 times

Last updated: Sep 19 '12