1

Up to now, I have been using my laptop screen (3840x2160) alone, and I'm now trying to set up a secondary monitor (1920x1080). Since my primary monitor is double the resolution of my secondary, this has proven quite awkward to configure how I want it. Initially, when I connected the second monitor, my laptop was reduced to 1920x1080, and my scaling to 100%. This leads to problems for two reasons:

  • I want to retain the 3840x2160 my laptop monitor supports
  • My application scaling was set to 200% as otherwise, many applications don't look good on the 4K monitor

Setting the monitor back to 3840x2160 creates another problem: with the laptop monitor being double the size of the secondary one, the cursor only transitions from the laptop to the external monitor if it moves through the top half of the right side of my screen. The cursor cannot move through the bottom half.

Additionally, if I set the scaling back to 200%, the applications which are scaling to display well on the 4K monitor look bad on the FHD monitor.

In an attempt to resolve the problem, I've been looking at this answer: Is it possible to have different DPI configurations for two different screens? . Following its instructions whilst adjusting for my monitors, I found that whilst the second monitor did display as I hoped, I could not move my cursor outside of its first quadrant. These are the commands I executed (DP-1 is my external monitor, and eDP-1 is my laptop one):

xrandr --output DP-1 --scale 2x2 --mode 1920x1080 --fb 7680x2160 --pos 3840x0
xrandr --output eDP-1 --scale 1x1 --pos 0x0

After running various other commands in an attempt to achieve what I'm after, I managed to get it working - though not in such a way that it's clear to see which of my steps did the job. I essentially ran xrandr with various options I was testing until it worked. I've restarted my system since, and I've recorded one set of commands that sets the monitor configuration to how I want it, listed below (note that after restart the dash was no longer in my output names).

xrandr --output DP1 --scale 2x2 --mode 1920x1080 --fb 7680x2160 --pos 3840x0
xrandr --output DP1 --panning 3840x2160
xrandr --output DP1 --panning 1920x1080
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  7 (RRSetScreenSize)
  Serial number of failed request:  40
  Current serial number in output stream:  41
xrandr --output DP1 --scale 1x1
xrandr --output DP1 --scale 2x2
xrandr --output DP1 --scale 2x2 --mode 1920x1080 --fb 7680x2160 --pos 3840x0
xrandr --output DP1 --panning 1920x1080
xrandr --output DP1 --scale 2x2 --mode 1920x1080 --fb 7680x2160 --pos 3840x0
xrandr --output eDP1 --scale 1x1 --pos 0x0
xrandr --output DP1 --pos 3840x0
xrandr --output eDP1 --pos 0x0

In an attempt to figure out which steps are necessary and which aren't, I've tried omitting commands I didn't think were responsible when configuring the setup. The problem is, messing it up can cause my displays to get in a pseudo-frozen state, where I can move my mouse but none of the other graphical elements will move - I have to restart when experiencing this.

Initially, when the system boots, my external monitor's application content (including the cursor) appears quite zoomed in. I run the commands in the order that they are listed, and on the penultimate step the graphics freeze like I described in the last section - though continuing to type in the final command despite this causes the system to return to normal, and to be configured how I hoped.

Note that the "X Error of failed request" message doesn't seem to be tied to the panning command directly - in one test where I omitted this line, the message appeared instead for the line that took its place (the scale line).

What's the best way for me to resolve my problem directly, rather than running the series of commands that (somehow) work for me currently?

EDIT: These commands aren't absolute either - they seem to be only guaranteed to work relative to the default configuration of xrandr. If I mess with xrandr before running these, it may not work.

EDIT2: I also saw this, which sounds like what I'm facing, but it is apparently fixed (I'm running version 1.5).

1

Today (2019-02-15) saw a new point release of 18.04, 18.04.02. It includes a new Xserver which fixes the problem of the mouse being constrained to a quarter of the external monitor screen. I have spent days trying to find a workaround, and ot now works as you expect! :-)

But if you are on 18.04 LTS you won't get the fix through the update system! You need to install the new kernel and hardware drivers, which also includes the new xserver, with sudo apt-get install --install-recommends linux-generic-hwe-18.04 xserver-xorg-hwe-18.04 (thanks omgubuntu.co.uk for pointing out that you don't get the update automagically).

As an update to my script posted above, the magic line for putting the external monitor on the right, now working without mouse constraint, is: xrandr --output DP-1 --auto --scale 2x2 --pos 3840x0 --fb 6000x3840 --right-of eDP-1 --rotate left --output eDP-1 --auto --scale 1x1 --pos 0x0 --primary

I have found that if I have been playing with --panning (which cancels the 2x2 scaling in my experience), a new xrandr command does not cancel the panning: I have to reboot.

1

I have a laptop with an external monitor, both with the same resolution as you. But I use my external monitor in portrait. My monitor is to the left of the laptop - I had problems getting xrandr to do what I wanted when it is to the right. I plug my monitor into one of two ports so the script works out where it is. Without the --autos I found the external display could be occasionally disabled, causing much head scratching until I found it disabled in the GUI settings (I use kubuntu 18.04). Here is my script, it includes comments about the maths involved:

#!/bin/bash

# 2mon: adjusts displays after plugging or plugging second monitor

# Main laptop display is eDP-1 3840x2160 landscape
# Second ASUS monitor is DP-1 or DP-2 1920x1080 portrait ie. 1080x1920
#                        has to have 2x2 scale or everything appears huge

# Find current monitors
tmp=~/tmp/xrandr.txt
xrandr>$tmp

# Set $dp to DP-1 or DP-2 as appropriate
# xrandr prints "DP-1 connected" and "DP-2 disconnected" or vice versa. But
# don't match eDP-1...
dp=
if   (grep "^DP-1 connected" $tmp >/dev/null);  then dp=DP-1;
elif (grep "^DP-2 connected" $tmp >/dev/null);  then dp=DP-2; fi

if [ "$dp" = "" ]; then
  echo External monitor is not connected

  # Reset pos and frame buffer size in case second monitor was previously connected
  xrandr --output eDP-1 --auto --scale 1x1 --pos 0x0 --fb 3840x2160 --primary
else
  echo External monitor is on $dp

  # External monitor to left of main display

  # Main display starts at 2*1080=2160 (2* because of 2x scale)
  # Frame Buffer -fb x-direction is 2*1080=2160 (external) + 3840 (main) = 6000
  #                  y-direction is largest of 2*external y= 3840 and main y = 3840
  xrandr --output $dp   --auto --scale 2x2 --pos 0x0 --fb 6000x3840 --left-of eDP-1 --rotate left
  xrandr --output eDP-1 --auto --scale 1x1 --pos 2160x0 --primary
fi
  • Thanks for your answer! Unfortunately, whilst it resolves the zooming problem it still leaves me in the position where my cursor can only enter one quadrant of the screen. – VortixDev Jan 16 at 15:17
  • It was a while ago now and my memory is not great, but I think that may have been the problem I had when I tried the monitor to the right. Have you tried the settings for it on the left? – B.Tanner Jan 16 at 17:16
  • Trying the following: xrandr --output DP1 --auto --scale 2x2 --pos 3840x0 --fb 7680x2160 --left-of eDP1 && xrandr --output eDP1 --auto --scale 1x1 --pos 0x0 --primary seems to mirror my primary display's content across both screens. – VortixDev Jan 17 at 4:10
  • Using this instead: xrandr --output DP1 --auto --scale 2x2 --pos 3840x0 --fb 7680x2160 --left-of eDP1 && xrandr --output eDP1 --auto --scale 1x1 --pos 0x0 --right-of DP1 produces the effect of the correct content on my primary monitor, but my second monitor being composed half its own content, and half of my primary monitor's content. – VortixDev Jan 17 at 4:15
1

Mouse not scaling with 2nd/3rd monitor:

I have found that adding 1 pixel to the offset of my 3rd monitor resolves the mouse being constrained to the original screen size (top left quadrant).

Here is my xrandr script for 3 monitors (two 4k one 1280x1024):

xrandr \
  --dpi 282 \
  --fb 9409x2160 \
  --output eDP --primary --mode 3840x2160 --pos 0x0 --rotate normal \
  --output DisplayPort-7 --mode 3840x2160 --right-of eDP --rotate normal \
  --output DisplayPort-4 --mode 1280x1024 --pos 7681x0 --scale 1.6875x1.6875 --rotate left;

Note: Offset pos increased by 1: DisplayPort-4 --mode 1280x1024 --pos 7681x0 and the --fb is 1 larger to accommodate this.

To clear some graphical glitches after running this I update the wallpaper as well:

# load wallpaper (remove screen-load artifacts)
feh --bg-fill ~/Pictures/The\ Old\ School\ 2018.jpeg

Now I just have to work out why the physical monitors swap display ports on boot sometimes. Initially DisplayPort-4 would swap with DisplayPort-5 and recently DisplayPort-4 and 7 swap. :(

I'm happy for any and all feed-back, this is not my area of expertise.

System: Dell Precision 7530, TB18DC dock, U2718Q Ultrasharp 27" 4k & Ultrasharp 1703FP monitors

Steve

  • Update: DisplayPort order for physical monitor appears to depend on if I turn on the system using the dock or laptop power button. – s.judd Feb 7 at 15:55

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.