Page 1 of 1

Mouse-trails on multiple monitors- how to auto-apply xrandr fix?

Posted: Tue Jan 12, 2021 2:17 pm
by cjh
(Minor edit: fixing typos)


I'm having an issue with connecting my multiple monitors to my laptop.

I have a recurring problem with "mouse trails". Moving my mouse across the screen causes flickering, and artefacts of the cursor remain blinking in the trail where the cursor was previously.

I solve the problem by using the following command in the terminal:

xrandr --output HDMI-1 --scale 0.9999x0.9999

where I replace 'HDMI-1' with whatever display name(s) i;m using.

I've added the commands to the startup, and that works fine . . . unless I don't start the machine up connected to my displays. Then I need to manually execute each line when connect to them. This is a problem because I have one set of displays at my treadmill desk, and another at a regular desk. Additionally. I sometimes switch inputs on on of the displays so that I can work with my windows machine alongside this one. Each time I do that I have to execute the commands again.

Is there any way to make this xrandr setting the default? It's really obnoxious.


Pasting system info below:

System: Kernel: 5.4.0-59-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Cinnamon 4.6.7
wm: muffin dm: LightDM Distro: Linux Mint 20 Ulyana base: Ubuntu 20.04 focal
Machine: Type: Laptop System: LENOVO product: 20RM v: Lenovo ThinkBook 14s-IWL serial: <filter>
Chassis: type: 10 v: Lenovo ThinkBook 14s-IWL serial: <filter>
Mobo: LENOVO model: LNVNB161216 v: SDK0J40697WIN serial: <filter> UEFI: LENOVO
v: 9YCN32WW date: 04/18/2019
Battery: ID-1: BAT0 charge: 33.4 Wh condition: 39.8/45.0 Wh (88%) volts: 15.4/N/A
model: Celxpert SR Real Battery serial: <filter> status: Discharging
Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M510 serial: <filter>
charge: 55% (should be ignored) status: Discharging
Device-2: hidpp_battery_1 model: Logitech Wireless Solar Keyboard K750 serial: <filter>
charge: 93% status: Charging
CPU: Topology: Quad Core model: Intel Core i5-8265U bits: 64 type: MT MCP arch: Kaby Lake
rev: B L2 cache: 6144 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 28800
Speed: 3701 MHz min/max: 400/3900 MHz Core speeds (MHz): 1: 3700 2: 3670 3: 3398
4: 3425 5: 2618 6: 2868 7: 3700 8: 3414
Graphics: Device-1: Intel UHD Graphics 620 vendor: Lenovo driver: i915 v: kernel bus ID: 00:02.0
chip ID: 8086:3ea0
Device-2: AMD Lexa [Radeon 540X/550X/630 / RX 640 / E9171 MCM] vendor: Lenovo
driver: amdgpu v: kernel bus ID: 01:00.0 chip ID: 1002:6987
Display: x11 server: X.Org 1.20.8 driver: amdgpu,ati,modesetting unloaded: fbdev,vesa
resolution: 1920x1080~60Hz, 1024x600~60Hz
OpenGL: renderer: Mesa Intel UHD Graphics 620 (WHL GT2) v: 4.6 Mesa 20.0.8
direct render: Yes
Audio: Device-1: Intel Cannon Point-LP High Definition Audio vendor: Lenovo
driver: snd_hda_intel v: kernel bus ID: 00:1f.3 chip ID: 8086:9dc8
Device-2: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo
bus ID: 1-3.1.3:11 chip ID: 046d:0825
Sound Server: ALSA v: k5.4.0-59-generic
Network: Device-1: Intel Cannon Point-LP CNVi [Wireless-AC] driver: iwlwifi v: kernel port: 3000
bus ID: 00:14.3 chip ID: 8086:9df0
IF: wlp0s20f3 state: up mac: <filter>
Device-2: Realtek RTL8153 Gigabit Ethernet Adapter type: USB driver: r8152
bus ID: 2-3.4:3 chip ID: 0bda:8153
IF: enx00e04c680f90 state: down mac: <filter>
Drives: Local Storage: total: 238.47 GiB used: 389.48 GiB (163.3%)
ID-1: /dev/nvme0n1 vendor: Lenovo O.E.M. model: RPFTJ256PDD2MWX size: 238.47 GiB
speed: 15.8 Gb/s lanes: 2 serial: <filter>
Partition: ID-1: / size: 233.12 GiB used: 194.74 GiB (83.5%) fs: ext4 dev: /dev/nvme0n1p3
Sensors: System Temperatures: cpu: 37.0 C mobo: N/A gpu: amdgpu temp: 27 C
Fan Speeds (RPM): N/A
Repos: No active apt repos in: /etc/apt/sources.list
Active apt repos in: /etc/apt/sources.list.d/google-chrome.list
1: deb [arch=amd64] http: // stable main
Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
1: deb http: // ulyana main upstream import backport
2: deb http: // focal main restricted universe multiverse
3: deb http: // focal-updates main restricted universe multiverse
4: deb http: // focal-backports main restricted universe multiverse
5: deb http: // focal-security main restricted universe multiverse
6: deb http: // focal partner
Active apt repos in: /etc/apt/sources.list.d/skype-stable.list
1: deb [arch=amd64] https: // stable main
Active apt repos in: /etc/apt/sources.list.d/steam.list
1: deb [arch=amd64,i386] https: // stable steam
2: deb-src [arch=amd64,i386] https: // stable steam
Active apt repos in: /etc/apt/sources.list.d/vscode.list
1: deb [arch=amd64] http: // stable main
Info: Processes: 285 Uptime: 28m Memory: 15.34 GiB used: 3.37 GiB (22.0%) Init: systemd
v: 245 runlevel: 5 Compilers: gcc: 9.3.0 alt: 9 Client: Unknown python3.8 client
inxi: 3.0.38

Re: Mouse-trails on multiple monitors- how to auto-apply xrandr fix?

Posted: Tue Jan 12, 2021 3:14 pm
by AndyMH
Don't know about auto-detecting a monitor change after boot, but...

I have an external monitor connected to my laptop that has to be manually set, I have a script to do it, content:

Code: Select all

if xrandr | grep -q "HDMI-2 connected"; then
    xrandr --newmode "2560x1080" 185.58 2560 2624 2688 2784 1080 1083 1093 1111 -hsync -vsync
    xrandr --addmode HDMI-2 "2560x1080"
    xrandr --output HDMI-2 --mode "2560x1080"
If the external monitor is not connected the modes don't get set.

Modify the if clause to if, then, else clauses (or use a case statement) to deal with your different monitors.
To run on boot put the commands at the end of either your .profile or .xprofile file. If you want it earlier in the boot cycle then create a new file in /etc/lightdm/lightdm.conf.d, mine is 71-linuxmint.conf (one higher than the existing file). Content:

Code: Select all

use it to point at the script you have created. MAKE SURE you test the script before you do this, get it wrong and you have a system that won't boot into the GUI (I've done it).

To deal with changing monitor after boot - put a launcher on the desktop pointing at the script you created.

For future posts - enclose any terminal output in code markers (the </> button above the reply window) - makes it easier for others to read.

Re: Mouse-trails on multiple monitors- how to auto-apply xrandr fix?

Posted: Wed Jan 13, 2021 1:57 pm
by cjh
Thanks for the input (and the correction to my post formatting).

Right now I just run all the commands at startup and they are ignored if the displays are not connected. Additionally, I sometimes switch one of the displays to a different input, so that I can use my windows machine alongside this one. What I've found is that any adjustment to the display properties at all causes xrandr to re-scale itself and I need to reset it. That can actually be difficult as the parts of the display will sometimes "freeze" and I can't see what's happening.