splitbrain.org

electronic brain surgery since 2001

Introducing: clipscreen

Using a ginormous 49" widescreen monitor is awesome. Except for when you wanna share your screen in Google Meet or other tools. Sharing a 5120×1440 screen simply makes no sense. Of course you can opt to share a tab or window instead. But for work, I often need to switch between a terminal, my IDE and a browser. If I want to share my workflow with a colleague, I have to constantly stop and restart sharing.

Zoom has an option to share a portion of the screen. So I wondered if there is a more general way to achieve this. One that works across any sharing tool.

Turns out there is. As this Ask Ubuntu answer explains, you can use xrandr to create a virtual monitor that mirrors part of your screen. You then can share that monitor.

Works great. Except that you can't really see which region of your screen is shared.

So I looked for a way to display an overlay on X. This Stackoverflow answer gave me a great starting point to implement that.

So I sat down and wrote a small C++ program. Of course I barely remember C++, so being able to just talk to ChatGPT to iterate over my code was great. I'm using Aider for things like this.

clipscreen lets you define a screen area, draws a green rectangle around it and creates a virtual monitor for that area. Kill it and the monitor is gone again. Pretty cool for a 20KB binary.

Below you can see the screen share dialog in Chrome. It shows two monitors. The first one is the virtual one created by clipscreen, the second one is my real screen.

You can find the code at Github.

Tags:
programming, cpp, x11, screenshare, monitor
Similar posts: