GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit 06a52705 authored by Ruben ten Hove's avatar Ruben ten Hove 🚵
Browse files

Update content/blog/hires-scrolling-logitech.md

parent ee06aa0c
......@@ -8,36 +8,32 @@ tags:
- scrolling
- linux
- xorg
- todo
---
Various Logitech mice implement hi-res scrolling. This means instead of having the content move for 3 lines for each scroll movement, you can scroll per-pixel using many more precise scroll events sent by the mouse. This gives a precise and smooth experience while scrolling.
Various Logitech mice implement hi-res scrolling. This means instead of having the content move 3 lines on each scroll click, you can scroll per-pixel using many more precise scroll events sent by the mouse. This gives you a precise and smooth experience in applications that support it.
## Enabling the feature
First off, we need to enable this feature. [Solaar](https://github.com/pwr-Solaar/Solaar) is able to do so when using the Logitech USB receiver. Install it as follows:
```shell script
cd /to a directory to store the Solaar application/
First off, we need to enable this feature on your mouse. [Solaar](https://github.com/pwr-Solaar/Solaar) is able to do this. Install it as follows:
git clone https://github.com/pwr-Solaar/Solaar.git
cd Solaar
sudo bash -c 'umask 022 ; pip3 install .'
sudo cp rules.d/42-logitech-unify-permissions.rules /etc/udev/rules.d/
cp share/autostart/solaar.desktop ~/.config/autostart/
```shell script
pip3 install --user solaar
sudo cp ~/.local/share/solaar/udev-rules.d/42-logitech-unify-permissions.rules /etc/udev/rules.d/
```
> If pip isn't installed, install it using `sudo apt install -y python3-pip`.
> To update, run a git pull in the `Solaar` directory, and run the last 3 lines again.
> If pip3 isn't installed, install it using `sudo apt install -y python3-pip`.
This will install Solaar, give regular users write access to Logitech HID devices, and ensure Solaar autostarts on login so the feature is enabled at boot.
This will install Solaar, and give regular users write access to Logitech HID devices.
Run `solaar` and enable **Wheel Resolution**.
Run `solaar` and enable **Scroll Wheel Resolution**. You may need to unlock the setting by clicking on the lock icon next to it twice.
## Scroll resolution
Now scrolling will be awfully fast, so we need to tell each scroll event matches 1 pixel instead of the default 15. Horizontal scrolling still uses an ordinary wheel click, so we need to make sure that wheel behaves as before.
Lookup the name of your mouse using `xinput`. This will for example be `Logitech MX Master 3` for a USB connected MX Master 3 or `MX Master 3 Mouse` if the same device is connected through bluetooth. Since more devices may support this, for example the `Logitech MX Anywhere 3`, we use a string also matching that device name.
Create a new udev hwdb file called `/etc/udev/hwdb.d/71-logitech-mice.hwdb` and enter the following information:
If you have an MX 3 mouse, just copy the block below, else look up the name of your mouse using `xinput`. This will for example be `Logitech MX Master 3` for a USB connected MX Master 3 or `MX Master 3 Mouse` if the same device is connected through Bluetooth. As more devices may support this, for example the `Logitech MX Anywhere 3`, we use a string also matching that device name.
Create a new udev hwdb file called `/etc/udev/hwdb.d/71-logitech-mice.hwdb` and enter the following:
```shell script
mouse:*:name:*MX * 3*:
......@@ -47,7 +43,7 @@ mouse:*:name:*MX * 3*:
MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL=14
```
> This will match all MX Master 3 or MX Anywhere 3 mice connected through USB and/or Bluetooth.
> This will match all MX Master 3 and MX Anywhere 3 mice connected through USB or Bluetooth.
Reload these settings using the following commands to give them a try.
......@@ -56,16 +52,31 @@ sudo systemd-hwdb update
sudo udevadm trigger /dev/input/event*
```
> If the settings seem to have no effect, make sure the device name in `71-logitech-mice.hwdb` is correct.
Enjoy your new smooth scrolling!
## Virtual Machines
Scrolling in a guest in Virtualbox will work much worse now since `xinput`s _Motion_ events won't reach the guest. So you'll need to scroll quite fast for the _ButtonPress_ events to be generated and then passed to the guest.
There doesn't seem to be a way to fix this, so we need to disable _XInput 2_ support for the Virtualbox guest process using `QT_XCB_NO_XI2=1`. We can't do this through the interface, so we need to start a guest using:
## Application specific
Some applications don't play well with smooth scrolling, and some don't recognize it by default. This may change over time, so here's some examples if you encounter problems.
### Firefox<sup>[1](https://www.reddit.com/r/linux/comments/72mfv8/psa_for_firefox_users_set_moz_use_xinput21_to/)</sup>
Firefox will wait for 15 scrolled pixels before moving down 15 pixels using their own smooth scrolling setup. We need to tell Firefox we're using `xinput2` as follows:
```shell
echo "export MOZ_USE_XINPUT2=1" | sudo tee /etc/profile.d/use-xinput2.sh
```
and disable the built-in smooth scrolling in `about:preferences`. Search for _Use smooth scrolling_ and disable it.
You need to log out and back in again for the above to work. You can also try it out by closing firefox and then running it from a terminal using `MOZ_USE_XINPUT2=1 firefox`.
### Virtualbox
Scrolling in a guest in Virtualbox will be much worse now since `xinput`s _Motion_ events won't reach the guest. So you'll need to scroll quite fast for the _ButtonPress_ events to be generated and then passed to the guest.
There doesn't seem to be a way to fix this, so we need to disable _XInput 2_ support when starting a Virtualbox guest by setting `QT_XCB_NO_XI2=1`. We can't do this through the interface, so we need to start a guest using:
```shell script
QT_XCB_NO_XI2=1 VBoxManage startvm <Guest VM name or UUID>
```
And now we have regular good ol' scrolling in that virtual machine.
And now we have regular (non-smooth) scrolling in that guest.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment