Setting Trackpoint speed via systemd

2015/05/02

Disclaimer

This post does not offer the truth in how trackpoint speed and sensitivity should be set. It just shows how I am doing it at the moment. Since this is the first time I wrote a systemd-service-file, or anything like this, I am very happy to receive any feedback on mistakes I may have made or anything else.

Why trackpoint speed/sensitivity matters (to me)

I am currently using a Thinkpad X220i with a heavily keyboard-based setup. Nearely everything I can do I can do with just my keyboard. The few things I still need my mouse for (mostly browsing) are therefore done with my trackpoint, because this way my fingers don’t have to leave the keyboard. Obviously, I don’t want to have to push the trackpoint for 20 seconds to achive what feels like seven pixels onscreen mouse-movement. Therefore, I increased both trackpoint speed and sensitivity

How I used to do it

Before I changed the settings to use systemd, I had a script named “trackpoint” in my home. It looked something like this.

#!/bin/bash

bash -c 'echo -n 200 > /sys/devices/platform/i8042/serio1/speed'
bash -c 'echo -n 250 > /sys/devices/platform/i8042/serio1/sensitivity'

Both these numbers can be changed according to your needs, and they seem to work just fine for me. The settings for your trackpoint may be located somewhere else, for a friend of mine it’s /sys/devices/platform/i8042/serio1/serio2/speed. Since both the speed- and the sensitivity-file are owned by root, after every startup I had to execute

$ sudo ./trackpoint

which I found quite annoying. After talking to some friends, I found out that apparently systemd should handle things like this for me. So I decided to change my setup to do this.

How it is done now

At first, I wrote a systemd-service file, located somewhere in /etc/systemd/system, called trackpoint_sensitivity_set.service

[Unit]
Description=Trackpointer Speed StartUp Setup
After=multi-user.target

[Service]
ExecStart=/opt/bin/trackpoint_sensitivity.sh

[Install]
WantedBy=multi-user.target

Then, I placed my script from before in /opt/bin/trackpoint_sensitivity.sh, because that seems to be the place for things like this. Obviously, the script has to be executable, for root at least. After this, it’s just

$ sudo systemctl enable trackpoint_sensitivity_set.service

$ sudo systemctl start trackpoint_sensitivity_set.service

and the trackpoint speed and sensitivity should be set right on every startup.