Discussion:
i3 commands chaining and parallelism
(too old to reply)
Guillaume Maudoux (Layus)
2018-05-24 09:33:39 UTC
Permalink
Hi,

I have a command in .i3/config that reads `exec --no-startup-id i3-msg
'workspace 1; append_layout ~/.i3/workspace1'`. The commands applies the
layout correctly, but to workspace 0, and not workspace 1 as expected.
At about the same time, an autorandr hook runs that basically iterates
over all the workspaces to move it to the right display.

Could there be a race condition between `workspace X` commands, or
should I look elsewhere.
Is there a guarantee that chained commands run atomically, or at least
that the selected workspace cannot be altered during command execution ?

Cheers,

-- Layus
Ismael Carnales
2018-05-24 13:28:53 UTC
Permalink
unsuscribe

On Thu, May 24, 2018 at 6:34 AM Guillaume Maudoux (Layus) <
Post by Guillaume Maudoux (Layus)
Hi,
I have a command in .i3/config that reads `exec --no-startup-id i3-msg
'workspace 1; append_layout ~/.i3/workspace1'`. The commands applies the
layout correctly, but to workspace 0, and not workspace 1 as expected.
At about the same time, an autorandr hook runs that basically iterates
over all the workspaces to move it to the right display.
Could there be a race condition between `workspace X` commands, or
should I look elsewhere.
Is there a guarantee that chained commands run atomically, or at least
that the selected workspace cannot be altered during command execution ?
Cheers,
-- Layus
Michael Stapelberg
2018-05-25 15:19:08 UTC
Permalink
I think you might be running into a quoting issue with the exec command:
the semicolon (;) separates it.

You could either try running a shell script to circumvent quoting issues
entirely (and thereby confirm the theory), or try double-quoting the exec
parameter, i.e.:

exec --no-startup-id "i3-msg 'workspace 1; append_layout ~/.i3/workspace1'"

On Thu, May 24, 2018 at 2:33 AM, Guillaume Maudoux (Layus) <
Post by Guillaume Maudoux (Layus)
Hi,
I have a command in .i3/config that reads `exec --no-startup-id i3-msg
'workspace 1; append_layout ~/.i3/workspace1'`. The commands applies the
layout correctly, but to workspace 0, and not workspace 1 as expected.
At about the same time, an autorandr hook runs that basically iterates
over all the workspaces to move it to the right display.
Could there be a race condition between `workspace X` commands, or should
I look elsewhere.
Is there a guarantee that chained commands run atomically, or at least
that the selected workspace cannot be altered during command execution ?
Cheers,
-- Layus
--
Best regards,
Michael
Guillaume Maudoux (Layus)
2018-05-28 08:48:00 UTC
Permalink
Hi Michael,

It appears that the issue comes from launching this command when
workspace 1 is focused.
`workspace_auto_back_and_forth yes` then makes the `workspace 1` command
focus workspace 0, which is counter intuitive in a script, even is very
useful for interactive users.

We should consider ignoring `workspace_auto_back_and_forth yes` for
scripts ;-)
--
Regards,
Layus.
Post by Michael Stapelberg
I think you might be running into a quoting issue with the exec
command: the semicolon (;) separates it.
You could either try running a shell script to circumvent quoting
issues entirely (and thereby confirm the theory), or try
exec --no-startup-id "i3-msg 'workspace 1; append_layout
~/.i3/workspace1'"
On Thu, May 24, 2018 at 2:33 AM, Guillaume Maudoux (Layus)
Hi,
I have a command in .i3/config that reads `exec --no-startup-id
i3-msg 'workspace 1; append_layout ~/.i3/workspace1'`. The
commands applies the layout correctly, but to workspace 0, and not
workspace 1 as expected.
At about the same time, an autorandr hook runs that basically
iterates over all the workspaces to move it to the right display.
Could there be a race condition between `workspace X` commands, or
should I look elsewhere.
Is there a guarantee that chained commands run atomically, or at
least that the selected workspace cannot be altered during command
execution ?
Cheers,
-- Layus
--
Best regards,
Michael
Guillaume Maudoux (Layus)
2018-05-28 08:50:33 UTC
Permalink
Or just ignore my message, I see that a `--no-auto-back-and-forth` flag
was added to the workspace command back in 2015...

-- Layus.
Post by Guillaume Maudoux (Layus)
Hi Michael,
It appears that the issue comes from launching this command when
workspace 1 is focused.
`workspace_auto_back_and_forth yes` then makes the `workspace 1`
command focus workspace 0, which is counter intuitive in a script,
even is very useful for interactive users.
We should consider ignoring `workspace_auto_back_and_forth yes` for
scripts ;-)
--
Regards,
Layus.
Post by Michael Stapelberg
I think you might be running into a quoting issue with the exec
command: the semicolon (;) separates it.
You could either try running a shell script to circumvent quoting
issues entirely (and thereby confirm the theory), or try
exec --no-startup-id "i3-msg 'workspace 1; append_layout
~/.i3/workspace1'"
On Thu, May 24, 2018 at 2:33 AM, Guillaume Maudoux (Layus)
Hi,
I have a command in .i3/config that reads `exec --no-startup-id
i3-msg 'workspace 1; append_layout ~/.i3/workspace1'`. The
commands applies the layout correctly, but to workspace 0, and
not workspace 1 as expected.
At about the same time, an autorandr hook runs that basically
iterates over all the workspaces to move it to the right display.
Could there be a race condition between `workspace X` commands,
or should I look elsewhere.
Is there a guarantee that chained commands run atomically, or at
least that the selected workspace cannot be altered during
command execution ?
Cheers,
-- Layus
--
Best regards,
Michael
Loading...