Automate starting up programs on different workspaces in i3

1

I have i3 installed on ubuntu. I want specific windows to open in specific workspaces when I execute a script (or more optimally on startup). The structure is this:

Workspaces:

  1. Firefox window
  2. Firefox window (left pane), atom (right pane), terminal (under atom)
  3. Same as 2 but different directory for atom
  4. Firefox with overleaf
  5. evince a pdf file
  6. evince another pdf file

I've tried achieving this strictly in i3 config file but it does not seem to work. I can get applications to launch on startup, but I can't direct which workspace they end up in and what size they are.

I've tried using a bash script for this, like:

xdotool key ctrl+1 && firefox && sleep 1 &&

xdotool key ctrl+2 && firefox -n && atom -n && sleep 2 && xdotool key ctrl+m && xdotool key ctrl+Return && sleep 1 && xdotool key ctrl+r && xdotool key Up && xdotool key Up && xdotool key Up && xdotool key Escape && sleep 1 && .... etcetcetc....

Where ctrl is my mod key, ctrl+m opens windows vertically, cltr+r resizes window, ctrl+Up tells which direction it show expand / deflate.

Running this script is very unstable and it almost always get stuck somewhere. Is there a better more stable way to do what I'm trying to achieve?

caesar

Posted 2019-09-02T11:53:41.223

Reputation: 113

The better-suited tool for the job is i3-msg, a tool for sending messages to i3 window manager. Docs: https://build.i3wm.org/docs/i3-msg.html

– curusarn – 2019-10-23T18:18:37.493

No answers