The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

Start program in specific workspace using terminal/bash-script

asked 2014-09-19 10:44:27 +0000

MortenJ gravatar image

Hi, I have made a script (used for debugging a multi-user web portal) to run multiple instances of Firefox (each with its own profile). Is it possible to specify the workspace when starting a program from the terminal/script, so I am able to e.g. start the first 10 instances in workspace 1, the next 10 instances in workspace 2 etc.?

bash-script: for i in {1..40; do sleep 0.1; firefox -p $i -new-instance "" & done

Kind regards, Morten

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-09-19 14:30:11 +0000

cee gravatar image

You could use something like this:

i3-msg workspace 5 && sleep 0.1 && chromium
  • first switch to workspace 1 (or whatever yours is called)
  • then wait a little (not 100% sure if it's necessary)
  • then start your browser

This is probably not the best possible way, but should get you started.

edit flag offensive delete link more


Thanks, that works great. Final script: for (( i=1; i <= 20; i++ )) do WRKSPACE=$((($i-1)/5 + 2)) i3-msg workspace $WRKSPACE sleep 1 firefox -p $i -new-instance "" & done

MortenJ gravatar imageMortenJ ( 2014-09-21 12:08:33 +0000 )edit

Question Tools


Asked: 2014-09-19 10:44:27 +0000

Seen: 1,840 times

Last updated: Sep 19 '14