How to launch an application on a different workspace with cwd preserved
Assume the following situation (which is my normal way of working): 2 displays, a full screen terminal with tmux on workspace 1 on display 1. When launching a X application from that terminal it will open "in the background" of workspace 1 since the full screen terminal is always on top.
What I'm looking for is a convenient way (i.e. something I can bind to a shell alias/function) to launch an application on workspace N on display 2 instead. Ideally I'd also like to preserve my current working directory.
I got some of the way using:
i3 "workspace N; exec cd `pwd` && cmd"
This will however still launch a new workspace on the same display. Is there a more elegant way of doing this?
There is a talk here on launching terminals on specific path: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/
Thanks, I've seen that, but it only solves a small part of the problem.
You could try to explicitly bind some workspaces to the second display in your config file using "workspace <n> output <output>" where <n> is the number and <output> is the display name (you get it e.g. via xrandr). However, maybe not the solution you are looking for...
why not? If you can preserve the cwd location, then you can just define the i3 config to react when your terminal window is created, such as moving to a specific workspace...
but if you want different behavior (this time move to w1, now w3, and so on), the only way would be to bind different terminal launch keys with named windows (urxvt), running the script to preserve the cwd, and then assigning the particular window to a specific workspace in i3 config.