• Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mouse scroll wheel acceleration in user space

Mouse scroll wheel acceleration, implemented in user space

Background: Mouse scroll wheel acceleration

What is that?

It's the same as mouse cursor movement acceleration, but for the mouse scroll wheel.

This makes esp sense for devices where scrolling is continuous, such as the trackpad (but even if the scrolling is discrete, like other mouse, it makes sense). In any case you want to be able to scroll slowly (e.g. pixel by pixel, or maybe max only a couple of lines). If you are in a very long document / webpage, you also want to be able to scroll very fastly. It is not possible to have both slow and fast scrolling without acceleration. With acceleration, this becomes very natural.

If you have used MacOSX, you have that enabled. You might not even have noticed, as this feels very natural.

Non-MacOSX support

Unfortunately, this is not supported yet in other desktop operating systems (Linux or Windows) (it is supported on iOS and Android though). When you switch from MacOSX to Linux or Windows, you will probably greatly miss this. (If you have never used MacOSX much, you might not have gotten used to it, and might not even know what you miss.)

As this is not implemented in the OS, some applications and frameworks slowly start to add their own support for it. This is really a bad solution, as it means that the behavior will be inconsistent from app to app. E.g. GTK has some support (here), Firefox has some support (I think only trackpad, here).

If you want to do it right, it's still not so clear where exactly this should be implemented. Long time ago (2010), I implemented a patch for xf86-input-mouse (here). This code used a similar acceleration logic as the mouse cursor movement acceleration. In Xorg/X11, you get discrete button press events for scroll events, which made it a bit ugly. The discussion was mostly about whether this is useful at all, and also where to actually implement it, where the conclusion was mostly either in libinput, or in xf86-input-libinput. A new proposal for libinput mouse wheel acceleration was opened here. As continuous scrolling and high resolution scrolling becomes more widely used, corresponding support in libinput for high-resolution scroll wheel support was merged now (2021). This was blocking any further development on the scroll acceleration. Which probably makes sense, as a clean high resolution API makes any implementation of scroll acceleration much cleaner. However, it is also slightly problematic, as applications which do not support the new high-res scroll API will use the old API.

For reference, in MacOSX, this is deeply implemented in the kernel (see here), specifically in IOHIDFamily (e.g. see here).

User space implementation

I just want to have that support now, on my desktop.

How?

We can just send extra scroll events, and basically replicate the logic of my original xf86-input-mouse patch.

This uses pynput both to listen to scroll events, and also to send out further scroll events.

Pynput supports all the major desktop platforms like X11, Wayland, MacOSX and Windows. It even works on MacOSX in addition to the OS scroll acceleration, such that you can further increase the acceleration.

Dependencies

pip install -r requirements.txt

Usage

You can customize the behavior with two numeric values. Example:

./main.py -v --exp 0.4 --multiplier 1.2

Settings

  • exp: the exponential factor
  • multiplier: additional multiplier. if this is >1, it means that every single scroll event will always get multiplied by this factor

The formula is:

m = user_scroll_speed ** exp
target_scroll_speed = user_scroll_speed * m * multiplier

Installation

If you found values that work for you, you can install the script as a systemd user unit (only on Linux):

./install-daemon.py

This will create a configuration file in ~/.config/mouse-scroll-wheel-accelerator/config.py. Enter your preferred values there.

The systemd unit can then be controlled like this:

systemctl enable --now --user mouse-scroll-wheel-accelerator
systemctl status --user mouse-scroll-wheel-accelerator
systemctl restart --user mouse-scroll-wheel-accelerator

More Repositories

1

music-player

Music player - endlessly plays your music
Python
492
star
2

PyCParser

C parser and interpreter written in Python with automatic ctypes interface generation
Python
345
star
3

openlierox

OpenLieroX - Liero clone / Worms realtime / 2D shooter
C++
264
star
4

pydbattach

attach to running Python process
Python
105
star
5

python-embedded

Python build script to create a small embeddable static Python lib
C
82
star
6

music-player-core

Music player core Python module
C++
76
star
7

RandomFtpGrabber

Random FTP grabber - downloads all the interesting stuff
Python
59
star
8

playground

some space to try things out
Python
50
star
9

py_better_exchook

nice Python exception hook replacement
Python
41
star
10

python-preloaded

Bundle Python executable with preloaded modules
Python
41
star
11

commandergenius

Commander Genius - Commander Keen compatible clone -- main repo here: https://github.com/gerstrong/Commander-Genius
C++
40
star
12

Pyjector

inject PyTerminal into any running application via SIMBL
Objective-C
36
star
13

simbl

SIMBL is the SIMple Bundle Loader.
C
34
star
14

helpers

some small helper tools
Python
34
star
15

timecapture

captures your current topmost application and the URL/file with timestamps
Python
32
star
16

PySDL

PySDL is a pure Python SDL binding via on-the-fly ctypes generation
Python
29
star
17

wiki

some useful information
28
star
18

PythonHotswap

Hotswap Python functions. And persistence of runtime.
Python
28
star
19

grub-fuse

GRUB filesystem support <-> FUSE bridge
C
26
star
20

Xee

lightweight, fast and convenient image viewer and browser for MacOSX
C
24
star
21

png-db

Database for PNG images
C
23
star
22

dotfiles

my dotfiles
Shell
23
star
23

google-books-export

export PDF from Google Books preview
Python
21
star
24

Coding-Game-Intro

Coding Introduction / Tutorial, mostly by writing small little fun games
21
star
25

PyTerminal

Python Terminal framework - embed a Python GUI Terminal in your app
Objective-C
21
star
26

chrome-ext-google-takeout-downloader

JavaScript
19
star
27

learn-midi

Learn-midi learns to procude MIDI output based on any audio input
Python
17
star
28

background-zmq-ipython

Background ZMQ IPython/Jupyter kernel
Python
17
star
29

PyCPython

interpret CPython in pure Python
Python
16
star
30

IdeaResolveSymlinks

Java
14
star
31

mac-suppress-mouse-keyboard

Suppress mouse & keyboard events on MacOSX. Baby-proof my Mac!
Objective-C
14
star
32

PyLua

interpret Lua (the C source code) in pure Python with PyCParser
C
14
star
33

binstruct

binary structure serialization (like binary JSON or BSON) with cryptography
Python
10
star
34

FScriptAnywhereSIMBL

FScript Anywhere via SIMBL
Objective-C
10
star
35

RemoteControl

secure remote control of your computer from your iPhone
Python
10
star
36

PyOverheadGame

simple Python game with 2D top-down perspective
Scilab
9
star
37

smf-openid-server

SMF OpenID server
PHP
9
star
38

navit

Navit is a car navigation system with routing engine
C
9
star
39

planet_wars-cpp

Google AI challenge: Planet Wars game engine and co, C++ implementation
C++
9
star
40

timidity-macosx

TiMidity++ for MacOSX
C
8
star
41

literal-python-to-pickle

Convert literal Python code to binary Pickle -- faster ast.literal_eval
C++
7
star
42

pyclibrary

pure-python C parser + ctypes automation library
Python
7
star
43

backup_system

Python
6
star
44

py-tui-editor

Simple Python terminal (TUI) multi-line editor
Python
5
star
45

TeXShop

Objective-C
5
star
46

system-tools

Python
5
star
47

pynsh

the Python dynamic shell
JavaScript
4
star
48

AutoSleep

automatically suspend not-needed processes - safe battery
Python
4
star
49

iphone-ssh-relay

iPhone port/SSH relay daemon and client for USB connections
C
4
star
50

CPython

fork of CPython - to try out own hacks
Python
4
star
51

chromehacking

Chrome hacking
Python
4
star
52

screenshooting

scripts for handling screenshots and analyzing them
Python
4
star
53

foreground_app_info

get details about the application and opened url which is in foreground
Python
3
star
54

ChromeWebApps

turn a website into a native-like app on your Mac
Python
3
star
55

SaveTheRock

Save The Rock! is a 2D platformer bundled with a user-friendly in-game level editor
C++
3
star
56

iphone-backup

iPhone backup scripts
Shell
3
star
57

intelligent-patcher

scripts to patch source code in an intelligent way
Python
3
star
58

clang

copy of git://repo.or.cz/clang.git
C++
3
star
59

WebAudioPlayer

audio player in HTML/JS
JavaScript
3
star
60

getraenke

Getränkeabrechnungssystem fürs Wohnheim
Python
3
star
61

9eyes-fetcher

fetches all images from 9-eyes.com
Python
3
star
62

ImageViewer

view images
C++
2
star
63

play-with-the-brain

PyBrain experiments
Python
2
star
64

openlierox-distrib

OpenLieroX - distrib scripts & files
C++
2
star
65

planetwars

PlanetWars Google AI Challenge 2010
Python
2
star
66

reiserfs-fuse

ReiserFS for FUSE
C
2
star
67

PictureSlider

MacOSX picture screen saver
Objective-C
2
star
68

turingmachine

Non-deterministic Turing machine simulator framework
C++
2
star
69

MathExercisesJavaAppletBase

Java (Applet) code base for math exercises
Java
2
star
70

zinssaetze

Python
2
star
71

tor

C
2
star
72

automatic_object_locking

demonstrating how the GIL could be removed in Python
C++
2
star
73

google-contacts-sync

Google contact syncing and merging
Python
2
star
74

diplom-thesis-automata

Diplom thesis for Computer Science in Automata theory
TeX
1
star
75

memos

manage memos
Python
1
star
76

ParseOggVorbis

C++ OGG Vorbis decoder
C
1
star
77

errordb

error message database - with list of solutions to each error
1
star
78

live-helper

Python
1
star
79

PyJitDev

Just-in-Time Python development
Python
1
star
80

ffmpeg

build tools, Xcode project
C
1
star
81

google-breakpad

OpenLieroX Google Breakpad copy
C++
1
star
82

diplom-thesis-math

Diplom thesis for Mathematics
Python
1
star
83

sdl

copy of SDL svn trunk
C
1
star
84

itunes-scripts

some simple Python scripts for iTunes and the iTunes music library
Python
1
star
85

streamplay

Objective-C
1
star
86

Sport-RWTH-Aachen

exaktes Kursprogramm (nach Zeit) von Sportkursen vom Hochschulsport der RWTH Aachen
1
star