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

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 "website.com/login" & done

Kind regards, Morten

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

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

Comments

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 "website.com" & done

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

Question Tools

Stats

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

Seen: 1,840 times

Last updated: Sep 19 '14