Skip to content

Conversation

@redneck-f25
Copy link

@redneck-f25 redneck-f25 commented Sep 12, 2025

Add option crop_rect to select the region of the remote framebuffer to be transferred.

Preview: https://download.bitctrl.de/novnc-u6Nm/noVNC-feature-crop-fb/vnc.html?crop_rect=120x48-0-0

See discussion at #1986

image

@CendioOssman
Copy link
Member

Seems reasonable for some niche cases. But I'm worried the UI for this is a bit technical.

I don't think it's appropriate to have a complex syntax in the RFB object. Better if it just takes a DOMRect.

@redneck-f25
Copy link
Author

redneck-f25 commented Sep 15, 2025

What do you mean with complex syntax. It is the well known x11 geometry syntax:
<width> "x" <height> [ "+" <left> | "-" <right> ] [ "+" <top> | "-" <bottom> ].

How do you want it? new DOMRect(x, y, width, height)

  • crop_rect=3720,2232,120,48
  • crop_rect=x=3720,y=2232,w=120,h=48
  • crop_x=3720&crop_y=2232&crop_w=120&crop_h=48

EDIT: Or do you mean how it looks in the settings?
image

Also with CSS it's possible to set width, height, right and bottom attributes.
In ThighVNC users can define listeners for selected areas of the screen with (almost) the same syntax.
Also TigerVNC uses this syntax (https://tigervnc.org/doc/x0vncserver.html).

−Geometry geometry

This option specifies the screen area that will be shown to VNC clients. The format is widthxheight+xoffset+yoffset ,
where ‘+’ signs can be replaced with ‘−’ signs to specify offsets from the right and/or from the bottom of the screen.
Offsets are optional, +0+0 is assumed by default (top left corner). If the argument is empty, full screen is shown to
VNC clients (this is the default).

I have three screens:

  • [3] upper left: w=1920, h=1080, x=-1920, y=0
  • [2] upper right: w=1920, h=1080, x=0, y=0 (primary)
  • [1] lower right: w=1920, h=1200, x=0, y=1080

To have listeners for the clocks on [1] and [3] I configured TightVNC as follows

  • [3] 120x48+-120+1032 at 5902/tcp
  • [1] 120x48+1800+2232 at 5901/tcp
image

Now I can observe my clocks

  • [3]
    • vnc.html?path=addr:127.0.0.1:5900&crop_rect=120x48-1920-1200 (which from the lower right corner up the height of my lower display and left the width of my right displays)
    • vnc.html?path=addr:127.0.0.1:5902
    • vnc.html?path=addr:127.0.0.1:5900&crop_rect=120x48+1800-1032 (which is from the upper left corner down the height of my upper displays minus the height of the area and right the with of my left display minus the width of the are, if I need to change the size of the area I need to change the anchor point)
  • [1]
    • vnc.html?path=addr:127.0.0.1:5900&crop_rect=120x48-0-0 (which is just the lower right corner)
    • vnc.html?path=addr:127.0.0.1:5901
    • vnc.html?path=addr:127.0.0.1:5900&crop_rect=120x48+3720+2232 (which is from the upper left corner right the sum of the width of my upper displays minus the width of the displays and down the sum of the height of my right displays minus the height of the area)

BTW: there was a bug RFB::get cropRect() if right or bottom is 0 (zero).

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants