Separate Workspace for Second Screen

Separate Workspace for Second Screen

I would like to achieve a behavior like this: When I use my laptop screen my first workspace is used. When I plug in a second screen (via HDMI) a second workspace is used and all the new opened windows on this second screen will land in the second space, except I switch the workspace on the second screen to another workspace.

When I unplug my second screen all windows will stay in the workspaces they were created in and I can switch the workspaces on my laptop to see them.

Is this behavior already possible?

4

1 Answer

Is this behavior already possible?

Everything is possible in linux. You will need some basic knowledge about the Xserver, some time and a system to test on, since you are messing with your X and you certainly need the browser running if you need help :-)

In my opinion there are three possible solutions:

  • Multimonitor-setups use Xinerama. The simplest solution i can think of is to add a third virtual screen to your configuration and simply move the windows there using xdotool. There are some downsides to this solution but it would not require the effort of having to move windows between different Xservers which in general is not possible.

  • Since it is not possible to move windows between different Xservers, we need a kind of proxy like xmove or Xpra to do this for us. I think the windows then live in a separate Xfvb session to hide the windows. You can attach and detach to the session.

  • Regardless of what method you are using, you need an event when the monitor gets unplugged. The event should get triggered when the screen is disconnected and also when reconnected. You can daemonize the script to watch for the event.

I would prefer the solution using Xpra for various reasons. I can only give you some hints of how to do it. The solutions are not complete but should get you started.

Xinerama Solution

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.