The Story of the Laggy Mouse
A story as old as time, not all the stories involve computers and peripherals, but the tale is known by all do-it-your-selfers, home-depot-excursioners, and other fixers-of-small-things. It is a story told around camp fires, in fact one version of the story starts "So we were out of firewood..."
My version starts with "So my mouse seems to be lagging..."
I noticed the cursor hiccuping and not a smooth motion as I moved my mouse. I initially ignored it, probably just the CPU peaked for a moment, web browsers are hogs, damn electron apps, the usual culprits.
However, on a fresh boot, nothing else running, I noticed the mouse lag happening, in a fairly consistent manner.
The TLDR; in video form, Hal's story involves a light bulb, but the narrative is the same.
We got new carpets installed at my house, which required me to break down my computer and then put it back together. I never noticed the lag before, so thought it might be how I plugged things back together.
I use a wireless mouse, the kind with a small USB receiver that plugs in to a port. I also use a USB hub and when I plugged everything back in, I had my scanner and mouse both plugged into the hub.
I switched the mouse to be directly plugged into the computer and moved other peripherals around to the hub.
This seemed to improve things.
However, after a day or so I noticed the lag came back, not as bad as before but still noticeable.
So maybe it was a performance issue. I run GNOME on Ubuntu, I've been using it for years without any problems. It's a great setup. However, the more I searched the more complaints I found about GNOME being a resource hog, it requires high-end graphics card just to run.
I'm a loser and I use built-in on-chip Intel graphics. The internet convinced me that I was doing it wrong, I needed a new desktop environment.
I switched over to i3wm, which is a nice light-weight tiling windows manager. It can run on Ubuntu and I've used it before on a older laptop, so I'm familiar with it, but its been a few years.
The setup took a little time, I forgot that I wanted i3-gaps and not the default install, which required compiling and a little extra config.
I lived with i3 for a few days. It includes a nice status bar you can configure to display extra info. I wrote a quick script to display the current bitcoin price, and another to display how many people are in space at the moment. For that, I needed to install i3blocks and not i3status, but minor.
You primarily use your keyboard when using a tiling windows manager which is the appeal. It is often quicker and easier to use, so it took me a bit to realize the mouse lag was still there.
Maybe it's the Mouse
I probably should of tried this one sooner, before installing and configuring a whole new desktop environment, but c'est la vie.
I have a corded mouse, so maybe my mouse died or there was wireless interference. I plugged the corded mouse in and tested it out and the same mouse lag was there.
Maybe it's the USB
I have a left over Apple Magic Mouse which uses Bluetooth. Sadly the Apple mouse can't be used and charged at the same time.
Come on, Apple!
After charging and pairing, which would have been surprisingly easy, but i3 doesn't have all the default settings setup. So I had to switch to GNOME to pair the mouse, thankfully Ubuntu makes it pretty easy to switch between.
The Apple mouse works and no lag! USB is the culprit.
But touch scrolling doesn't work.
Upgrade Linux Kernel
After a bit of searching, the Apple Magic Mouse 2, the one I have with the unfortunate design, uses a proprietary protocol for sending touch events which is not supported in the kernel I have. It is supported in a newer version.
I haven't compiled and upgraded a kernel in a long long time, just hasn't been a reason. So, I'm debating which is worse, mouse lag or no scrolling.
Thankfully there is now a tool, Ukuu, which makes it easy to install new kernel versions. After installing Ukuu and the new kernel, I couldn't switch to using the new kernel. I had to remember how to configure Grub to allow me to select the new kernel, since my boot bypassed Grub timeout previously.
New kernel loaded. I compiled and installed the new driver for Apple Magic Mouse 2, but still no scrolling. After reading and troubleshooting, looks like if I run a command it can force the kernel to load the newly compiled driver and scrolling works!
The scrolling is slow.
For the life of me I can't figure out how to configure the scrolling acceleration. I read and tried a bunch of things, but nothing. Additionally, I can not get the Magic Mouse driver to load by default on boot, it requires running an install command.
So now I'm debating which is worse mouse lag or slow scrolling and requiring to run a command on each boot.
As I'm sitting there mulling over the pros and cons, considering buying yet another mouse, a bluetooth one. I look at my little computer.
There are two USB ports on the front, I had the mouse plugged in the one on the left. What happens if I switch it to the one on the right.
That was all it took.
At least I have two new scripts, I can look up bitcoin price and how many people are currently in space.