4

X11 window managers historically have a notion of screens - each screen has a distinct set of windows and you can switch between them using the same physical display.

I'm recording a screencast so I would really like to have a secondary, smaller X11 screen on which a handful of windows will be displayed, while keeping the content of my main screen intact and hidden. So I would like to have a virtual screen in a window, which will contain other windows. Then I can simply grab this window for my screencast. How do I do that?

I would prefer a native X11 approach (maybe there are window managers which do that with ease?)

Maybe there's a way I can declare a virtual monitor for X11 server to use, that ends up displayed as a window?

Failing that, I guess I could use Xvfb or VNC, but obviously it is harder to set up. Maybe some other popular approaches are there?

2 Answers 2

7

Xephyr if your distro ships it. Xephyr or its predecessor Xnest. Run Xephyr :1, it starts displaying a window. Then run DISPLAY=:1 rxvt or DISPLAY=:1 xfwm4, so the terminal would appear in the Xephyr display, or have the window manager manage windows in the Xephyr display. The -size parameter control how big the Xephyr window is, e.g. Xephyr -size 1024x768.

3
  • Not only it is available, it comes pre-installed on my system! There's also xnest, I wonder what's the practical difference.
    – alamar
    Commented Dec 28, 2020 at 15:20
  • Wow, did not know such thing as xephyr exist, thank you for naming it. It is very useful for working around a shitty supermicro java application for viewing ipmi kvm. While rebooting the server, the application constantly (many times at a single minute!) recreates its window (so I cannot create a window rule) and steals focus from your currently opened window. Very annoying and frustrating. But xephyr keeps that shit happening inside a separate window, which do not steels a focus. Awesome!
    – Ashark
    Commented Apr 19, 2021 at 12:03
  • 1
    It's `Xephyr -screen 1024x768", at least is my Arch Linux.
    – tokland
    Commented Aug 14, 2022 at 16:43
4

You can use squint for that purpose: https://github.com/a-ba/squint/

It was initially designed for giving a feedback of the external monitor when doing a presentation but it works well with virtual monitors too (eg: for sharing a screen in a videoconference). It does not require you to juggle with an additional X server.

You can do something like:

xrandr --addmode VIRTUAL1 1024x768
xrandr --output  VIRTUAL1 --mode 1024x768 --right-of HDMI1

to set up the virtual monitor, then run:

squint -w

Now, when you move the mouse pointer to the right screen, a window pops up with its content. You can grab the content of that window to record your screencast.

1
  • Sounds exactly like what I was looking for.
    – alamar
    Commented Feb 1, 2021 at 8:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .