pynput works now. Ignore the first UPDATE message.
UPDATE: An update to
pynput has broke FreeBSD. The error I get is:
Traceback (most recent call last): File "/home/neel/.local/bin/scrollify.py", line 20, in <module> mouse.scroll(0, scroll_amt) File "/home/neel/.local/lib/python2.7/site-packages/pynput/mouse/_base.py", line 78, in scroll self._scroll(dx, dy) File "/home/neel/.local/lib/python2.7/site-packages/pynput/mouse/_xorg.py", line 75, in _scroll self._check_bounds(dx, dy) File "/home/neel/.local/lib/python2.7/site-packages/pynput/mouse/_xorg.py", line 103, in _check_bounds raise ValueError() ValueError
You can track the bug on GitHub.
I recently acquired a HP EliteBook 9470m (before you ask: it's personal), and installed FreeBSD on it. The Synaptics touchpad is detected on FreeBSD as a PS/2 mouse on both laptops, and unlike the 2570p I was coming from, the 9470m doesn't automatically fallback to edge scrolling. While web browsers make up by making it easy to scroll with the arrow keys, other applications (such as email) end up doing actions you might not want with the arrow keys.
scrollify.py is not yet on FreeBSD Ports, you will have to install it manually.
First, you need
pip. To install this, run either:
pkg install py27-pip py27-xlib
cd /usr/ports/devel/python-pip make config-recursive install clean cd /usr/ports/x11-toolkits/py-xlib make config-recursive install clean
Then you need to install the Python module
pynput. This is used for controlling the keyboard and mouse from Python, and is not in Ports either. To install this, run this as a normal user:
pip install --user pynput
Next, you will need
xbindkeys in order to do the mapping. To install this, run:
pkg install xbindkeys
cd /usr/ports/x11/xbindkeys make config-recursive install clean
Finally, you should install
scrollify.py somewhere on your system. For example, if you want it in
mkdir -p ~/.local/bin cd ~/.local/bin fetch --no-verify-peer https://raw.githubusercontent.com/neelchauhan/scrollify/master/scrollify.py
You will need to modify
.xbindkeysrc. To do that, run:
and add the following:
"python2.7 ~/.local/bin/scrollify.py up" alt + Up "python2.7 ~/.local/bin/scrollify.py down" alt + Down
vim with your text editor of choice,
~/.local/bin to the place you stored
alt + Up and
alt + Down to your desired key combination (you can Google search the possible combinations). This will map the scroll up to Alt + Up and scroll down to Alt + Down.
You finally need to make your window manager or desktop environment (GNOME for me) launch
xbindkeys on startup. For instance, on GNOME, make the directory
~/.config/autostart if it doesn't exist, create a
.desktop file in the directory with the following content:
[Desktop Entry] Name=xbindkeys GenericName=Keyboard Bindings Comment=Keybindings Exec=/usr/local/bin/xbindkeys Terminal=false Type=Application X-GNOME-Autostart-enabled=true
.desktop file you created to
~/.local/applications. This ensures that GNOME (or whatever DE you use) can see the startup script.
On your specific WM or DE, this can be found on the Internet. Arch Linux's wiki has a page on startup scripts for all the major DEs (and I believe the information should be common on FreeBSD as well). Keep in mind that there is a delay (~1sec) when scrolling with this method.
I may update this page once
pynput makes it to FreeBSD Ports (I am a maintainer), but in the meanwhile, that's it.