This is not a question, but rather a work around for a problem under Ubuntu, I encountered.

Given a laptop screen (e.g., "LVDS-1-0") and a second screen (e.g., "DP-1") with the second screen being your primary screen and your monitor being to the right of your primary screen (or left) as an extension (see picture). The first screen was always extended virtually despite explicit xrandr instructions not to do this. When entering this, I was able to avoid the annoying scrolling when moving my mouse cursor to the right on the primary monitor.

xrandr --output LVDS-1-0 --off
xrandr --output DP-1 --mode 1920x1080 --primary --pos 0x0 --output LVDS-1-0 --mode 1920x1080 --pos 1920x0

After this, it just goes from one monitor to the other one without scrolling the screen.


After switching to discrete graphics card (nvidia is discrete and intel is integrated for my laptop), the order of the outputs needed to be changed:

output_DP=$(xrandr | grep " connected" | grep DP | awk '{print $1}')
output_LVDS=$(xrandr | grep " connected" | grep LVDS | awk '{print $1}')

xrandr --output $output_LVDS --off
xrandr --output $output_LVDS --mode 1920x1080 --pos 1920x0 --output $output_DP --mode 1920x1080 --pos 0x0  --primary

For more convenience, I made these variables to have more flexibility since switching between discrete and integrated graphics cards changes the designation of the output devices (e.g., LVDS-1-0 vs LVDS-1).

Monitor layout


1 Answer 1


I met the same bug. Your workaround didn't work for me. Your trick is simply a trigger that makes the bug not to fall in. I digged in a bit and found a nice guy with a solution that might help others here as well.

The main problem is that the bug we met here causes the monitor which is scrolling into the other to have a virtual screen with the size of both screens summed. So the solution might seem to disable that extra virtual space on that screen to fit the monitors resolution. This is usually done with the --panning AxB argument - We use it to set the virtual space size.

This is how you could do it:

xrandr \
  --output LVDS-1-0 --mode 1920x1080 --panning 1920x1080 --pos 1920x0 \
  --output HDMI-0   --mode 1920x1080 --panning 1920x1080 --pos 0x0    --primary

(Slashed \ added to use newlines in the command.)

Sadly the problem here is that the driver (that is the bug) seems to overwrite the panning we set (or not set). But what it does not is to set another part of the panning: The tracking area! The Tracking area is actually that part of the screen the camera follows the cursor on that monitor.

tl;dr: So the idea is to set the panning as the driver but restrict the tracking area instead.

This is done with the following command:

xrandr \
  --output LVDS-1-0 --mode 1920x1080 \
  --output HDMI-0   --mode 1920x1080 --panning 3840x1080+0+0/1920x1080+1920+0/0/0/0/0    --primary

"The first four parameters [of the panning argument] specify the total panning area, the next four the pointer tracking area (which defaults to the same area). The last four parameters specify the border and default to 0." [man xrandr]

  • I put the last command in a shell script I call via keyboard (when switching display hardware) and few seconds after login automatically. Sep 20, 2016 at 21:46
  • Setting the tracking area was crucial in my setup, too.
    – krlmlr
    Oct 31, 2016 at 23:18
  • 2
    At the end, your solution didn't help me, but I found a solution by leaving the resolutions alone. Command for mirror: xrandr --output HDMI1 --same-as Laptop1 and for extended: xrandr --output Laptop1 --auto --output HDMI1 --auto --left-of Laptop1
    – Edenshaw
    Mar 13, 2018 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.