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

Executing applications (exec)

asked 2012-08-28 10:50:21 +0000

lzap gravatar image

updated 2012-08-28 10:50:37 +0000

Hi, i3 docs states:

What good is a window manager if you can’t actually start any applications? The exec command starts an application by passing the command you specify to a shell. This implies that you can use globbing (wildcards) and programs will be searched in your $PATH.

Couple of questions:

  • which shell is used (I assume user's default shell)
  • can I use everything that is available in full shell (like variables, pipes, multiple commands separated with ; and other things)
  • its the i3 process that spawns them right?

Because for some reason this is not working for me:

 bindsym Control+Mod1+l exec i3-msg workspace 1; i3lock -c 111111 -d

and only the first command is executed.

edit retag flag offensive close merge delete

Comments

I found that && instead ; works but I am interested in limitations. Thanks!

lzap gravatar imagelzap ( 2012-08-28 10:52:01 +0000 )edit

When you are using semicolon `;` all commands will be executed regardless of their exit code. When you are using `&&` and one of the commands fail, remaining ones won't be executed.

MeanEYE gravatar imageMeanEYE ( 2013-03-05 15:35:24 +0000 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2012-08-28 10:59:36 +0000

Michael gravatar image
  1. $SHELL is used (if set), otherwise /bin/sh. See http://code.stapelberg.de/git/i3/tree...
  2. Yes. i3 calls $SHELL -c <your command>
  3. Yes.

The reason your bindsym doesn’t work is because ; is the separator for i3 commands. Use exec "i3-msg workspace 1; i3lock -c 111111 -d (with double quotes) instead:

midna ~ $ i3 'exec "echo foo > /tmp/bar; echo bar > /tmp/baz"'
2012-08-28 12:56:15 - Additional arguments passed. Sending them as a command to i3.
[{"success":true}]
midna ~ $ cat /tmp/bar /tmp/baz                               
foo
bar
edit flag offensive delete link more

Comments

Thank you for nice explanation and big patience with me. But it seems other folks in our team are interested in i3 too ;-)

lzap gravatar imagelzap ( 2012-08-28 13:31:56 +0000 )edit

Is it still the case? The code comment in http://code.stapelberg.de/git/i3/tree/src/startup.c?h=next#n136 is quite misleading because _PATH_BSHELL seems to be used everywhere.

Julien Jehannet gravatar imageJulien Jehannet ( 2014-03-13 16:59:58 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2012-08-28 10:50:21 +0000

Seen: 3,194 times

Last updated: Aug 28 '12