This solution can “crop” and position without transformations. It can even leave multiple cropped areas on multiple real monitors. The mouse will not be caged to the “crop” area(s).¹
This command line should answer the question. For more explanation read on:
xrandr --setmonitor my-monitor-0 2880/2000x1900/1500+0+20 eDP-1
The following figures show an example X11 screen in different states. Note that an X11 screen is always one rectangle. Some parts of an X11 screen might not be visible. That happens whenever no real monitor is configured to reflect those parts of the X11 screen.
4 real monitors are used to show this X11 screen. They are positioned 2×2. The figures suggest where those real monitors are exactly, as the window manager (i3 in this case) puts a desktop/workspace on each of them. This also explains the black border in the top right. That particular monitor has a resolution slightly below the others. The window manager put a workspace on that monitor, which has its position snug to the other monitors, leaving an “off-screen” area on the X11 screen where i3 does not paint anything. Non-tiling window managers often allow you to move windows half outside of the monitor(s), so that area might actually contain something (and have that visible on a screenshot).
Figure 1: X11 screen with 4 real monitors configured 2×2
Figure 2 was created by launching xrandr --setmonitor my-monitor-0 520/5x480/4+1400+600 DVI-0
. --setmonitor
together with --delmonitor
, --listactivemonitors
and --listmonitors
are not mentioned (yet) in the man page on my system, but xrandr --help
(version 1.5.0 running on an X11 server with RandR 1.6) shows them.
Here we create a virtual monitor named my-monitor-0
. The point is that the window manager (or any other X11 client/app) will see it while iterating through all X11 monitors, composed of virtual and regular monitors (e.g. to determine where to create workspaces on the X11 screen). DVI-0
is the --output
name of the real monitor on the top left where we are doing this trick on. While DVI-0
now forms part of the virtual monitor my-monitor-0
, the point here is something else though: DVI-0
will be de-listed from the regular X11 monitor list, so no desktop/workspace will be created here by window managers!
The string 520/5x480/4+1400+600
dictates the resolution, position and the pixel density of the virtual monitor. 520x480 is the width and height in pixels, +1400+600 is the offset in pixels from the left and from the top, respectively, and /5
& /4
should be the size in millimeters (width and hight). (The millimeter size is used to calculate the pixel density of that virtual screen; apps can request these numbers and possibly adapt their widget sizes etc.—In my example here they are totally wrong. Measure with a ruler on your real monitor to get numbers for your final setup.)
Note that the real DVI-0
monitor is still showing the same position of the X11 screen and will not be reconfigured by this command. It will only be taken off the X11 monitor list.
Figure 2: top left (real) monitor content replaced with a virtual monitor with smaller dimensions
For figure 3 I executed xrandr --setmonitor my-monitor-1 300/30x200/20+50+30 none
to create an additional virtual mointor (“crop area”) in the top left. The command is similar to before. Here I picked a location and dimension that is not yet covered by any other X11 monitor, but that it is part of the area covered by the real DVI-0
monitor. The name of the virtual monitor is new and the list of real monitors in use by this virtual one is empty (none
). Reusing DVI-0
would destroy any other virtual monitors containing it.
Figure 3: additional virtual monitor added on empty area covered by top left real monitor
Note that the mouse is confined to the real monitors (limited by the X11 screen) as long as they form one continuous area. If one real monitor is even only 1 pixel apart from all others, the mouse is allowed to go anywhere on the bigger X11 screen rectangle.
For similar questions and similar, often shorter, answers refer to the list in this answer.
¹ X11 can restrict the mouse with pointer barriers, but that needs additional X11 API calls with other software.
Images made with xwd -root | convert xwd:- screen.jpg