Since you are here, you probably know what I'm talking about. Ubuntu 20.04 Focal Fossa (and 20.10 Groovy Gorilla) has a pretty unusual bug, if you have the experimental "fractional scaling" feature enabled: when you log-in with your password, your mouse cursor gets stuck at its current position, while a new, bigger one appears and tracks your mouse movements. The bug is caused by this issue, described on the Ubuntu mutter issue tracker. However, since an official fix is not currently available, I've found a workaround that pretty much fixes it every reboot, and made it into a program:
The installation process is pretty easy, although admittedly not one of the shortest.
Step 1 - Fractional Scaling
Make sure that fractional scaling is enabled, by going in your System Settings ➙ Monitors ➙ Fractional Scaling. If it's disabled, turn it on and configure your monitors.
Step 2 - Installing Java
Open up a new Terminal window and type
java -version. If your output looks similar to this, you are good to go:
openjdk version "1.8.0_272" OpenJDK Runtime Environment (build 1.8.0_272-8u272-b10-0ubuntu1~20.10-b10) OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
If, instead, you get
java: command not found, just run
sudo apt install -y default-jre and finally re-check the correct installation with the previous command.
Step 3 - Adding the fix
While still in the Terminal, download the latest version of the fix from the official GitHub repo linked above, with the following command:
wget -O ~/ScreenScalingFixer.jar https://github.com/mind-overflow/gnome-fs-duplicate-cursor-fix/releases/download/v1.0/ScreenScalingFixer-1.0-SNAPSHOT.jar
Then, create a new directory for the program and move it inside:
mv ~/ScreenScalingFixer.jar ~/screen-scaling-fixer/ScreenScalingFixer.jar
The next step is to create a startup script, which will run every time after you login. Run the commands:
echo "sh -c \"cd ~/screen-scaling-fixer/ && java -jar ~/screen-scaling-fixer/ScreenScalingFixer.jar\"" > ~/screen-scaling-fixer/start.sh
chmod +x ~/screen-scaling-fixer/start.sh
Finally, enable the recently created script by executing the following lines in the Terminal:
printf \ "[Desktop Entry]\n\ Name=fs-fixer\n\ GenericName=fs-fixer\n\ Comment=fix gnome scaling duplicate cursor\n\ Exec=sh -c ~/screen-scaling-fixer/start.sh\n\ Terminal=false\n\ Type=Application\n\ X-GNOME-Autostart-enabled=true\n\ X-GNOME-Autostart-Delay=1\n" > ~/.config/autostart/fractional-scaling-fix.desktop
chmod +x ~/.config/autostart/fractional-scaling-fix.desktop
Step 4 - Final configuration
At this point, you have correctly installed and enabled the fix. Now, the last thing you need to do is configure it!
Move into the correct directory and launch it:
cd ~/screen-scaling-fixer && ./start.sh
xrandr. You should get a list containing all of your monitors. What you need to do is find the correct port your fractional-scaling-enabled monitor is plugged into. It should be something like
eDP-1... Write that down somewhere. Don't worry if you have multiple scaled monitors, one is enough.
Now, edit the
config.yml file in the
~/screen-scaling-fixer directory. In my case, I'm going to use nano:
The file will look like this:
enable: false delay: 2000 monitor-connector: 'DisplayPort-1' scale: 1.5
enable: false to
enable: true, or the script won't run.
monitor-connector: 'DisplayPort-1' to the one you just found with
xrandr, such as
Now you need to set the
scale. This is the effective scale you want your monitor to be at, and this must be the same you used in the system settings. So, 150% becomes 1.5; 125% is 1.25, etc.
Finally, set the delay, in milliseconds. The delay is how long the script needs to wait before actually running. Set it to something that you think is enough for your computer to fully complete the login sequence. If you are running from an SSD with a decent processor,
2000 will be enough. If the delay is too short, you will simply see no effect.
Step 5 - Check that everything works
You are finally done! I really hope this didn't take too long. Now, to test that everything works correctly, run the program again from Terminal:
cd ~/screen-scaling-fixer && ./start.sh
Your screen should flash twice for a few seconds, and when it ends flashing, your monitor configuration should be the very same one you had before running it. Congratulations! Now, you just need to logout and log back in, to see it work its magic and make the dead cursor disappear.
Until the development teams of Ubuntu, GNOME and mutter have a fix ready for this, I think this is the best solution to the problem. It certainly isn't the prettiest, but it works, and it does it well enough, at least for me. I think waiting 2 seconds after logging in is not a big deal, especially since this solves the problem of having an ugly cursor always stuck on the screen.
If you were unable to follow some steps or have any problem/question about this, please leave a comment below and I'll try to help you as soon as possible!