xrandr – How to Decrease Viewable Space on a Partially Broken Monitor Using xrandr

displaygraphicsmonitorsxorgxrandr

My secondary monitor is partially broken in the top 1/3 of the screen so I want to add blackbars and have something like in the picture below.
The top part it's how everything is now. The bottom part is what I want to achieve. The resolutions listed there are the maximum for each screen.

This is the xrandr output for the second screen:

VGA1 connected 1920x1080+1366+12 (normal left inverted right x axis y axis) 890mm x 500mm
1920x1080     60.00*+
1600x1200     60.00  
1680x1050     59.95  
1280x1024     75.02    60.02  
1440x900      74.98    59.89  
1280x960      60.00  
1360x768      60.02  
1280x800      59.81  
1152x864      75.00  
1024x768      75.08    70.07    60.00  
832x624       74.55  
800x600       72.19    75.00    60.32  
640x480       75.00    72.81    66.67    60.00  
720x400       70.08 

Schematic

Best Answer

Possible workarounds:

Use empty panels covering the damaged region to force windows using the remaining space. For example, xfce4-panel can be configured well. It depends on your desktop environment how well this works. Xfce and LXDE will work fine, Gnome will make problems, I assume. This does not help for fullscreen applications that would cover the panel, too, for example, firefox+F11, or VLC in fullscreen.

Workaround for fullscreen applications: Starting Xephyr with desired screen size, positioning it and starting applications inside it. Automate this with a script and 'xdotool`:

Xephyr :1 -screen 1500x800x24 &
xdotool search --name Xephyr windowmove 0 437

Start applications in Xephyr window with DISPLAY=:1 firefox. Xephyr does not support hardware acceleration, but virtualgl can help here.


Best workaround:

Use weston with Xwayland. It supports hardware acceleration and fullscreen applications.

Use a quite lightweight window manager like openbox at startup (or even better, one without window decorations at all like evilwm). It serves as background environment only, weston will cover it.

Create a custom myweston.ini file like this one (see man weston.ini):

[core]
shell=desktop-shell.so
idle-time=0

[shell]
panel-location=none
locking=false

[output]
name=X1
mode=1366x768

[output]
name=X2
mode=1500x768

Create a script like this one to start weston in evilwm and Xwayland in Weston (customize positions of 2 weston windows). Finally, start your desired desktop environment:

# start weston with custom config and two output windows
weston --socket=wayland-1 --config=$HOME/myweston.ini --output-count=2 >$HOME/weston.log 2>&1 &
sleep 1 # wait until weston is ready

# get window id's from logfile and move windows at target (xwininfo could give id's, too)
xdotool windowmove 0x$(printf '%x\n' $(cat $HOME/weston.log | grep 'window id' | head -n1 | rev | cut -d' ' -f1 | rev))    0 0
xdotool windowmove 0x$(printf '%x\n' $(cat $HOME/weston.log | grep 'window id' | tail -n1 | rev | cut -d' ' -f1 | rev))    1369 400

# start X server Xwayland in weston
WAYLAND_DISPLAY=wayland-1 Xwayland :1 &
sleep 1 # wait until Xwayland is ready

# start your desired desktop environment
DISPLAY=:1 startlxde

The start script above does not set up cookie authentication for X clients. Instead, you can use x11docker to have cookie authentication, too:

# start weston and Xwayland, read X environment
read Xenv < <(x11docker --weston-xwayland --gpu --output-count=2 --westonini=$HOME/myweston.ini)

# move weston windows to target locations
xdotool windowmove $(xwininfo -name "Weston Compositor - X1" | grep "Window id" | cut -d' ' -f4) 0 0
xdotool windowmove $(xwininfo -name "Weston Compositor - X2" | grep "Window id" | cut -d' ' -f4) 1367 400

# start desired desktop environment
env $Xenv startlxde

Xwayland appears as a client "window" of weston. Unfortunately, due to a bug in Weston or Xwayland, it does not always sit at position 0:0. You can move Xwayland to desired position with [META]+left-mouse-button. I wrote a bug report, but got noresponse.

Related Question