
Momentum Mouse brings smooth, natural scrolling to Linux desktop environments. It transforms the abrupt, jerky scrolling experience typical of mouse wheels into a fluid, momentum-based scrolling experience similar to what you'd find on modern trackpads and touchscreens.
Scrolling with a mouse on Linux can be a jarring experience. Each notch of the scroll wheel produces a fixed-distance jump that:
- Hurts your eyes as content suddenly jumps instead of flowing
- Makes it difficult to track where you are in a document
- Creates a disconnected feeling between your input and the on-screen response
- Lacks the natural physics-based movement we've come to expect from modern interfaces
- Makes reading long documents more tiring than it needs to be
momentum mouse solves this by:
- Intercepting your mouse's scroll wheel events
- Applying physics-based inertia and momentum calculations
- Emulating natural touchpad gestures to produce smooth scrolling
Instead of content jumping in fixed increments, it glides naturally with momentum, gradually slowing down just like a physical object would. This creates a more intuitive, comfortable, and visually pleasing scrolling experience. Kinematic scrolling in Ubuntu is finally here!
Smooth_Scrolling_Web.mp4
Smooth.Scroller.mp4
- Smooth Inertial Scrolling: Content continues to move after you stop scrolling, gradually slowing down
- Natural Scrolling Option: Choose between traditional or natural (touchpad-like) scrolling direction
- Horizontal Scrolling Support: Works with both vertical and horizontal scrolling
- Configurable Physics: Adjust sensitivity, friction, and velocity to match your preferences
- System Integration: Runs as a background service with minimal resource usage
- Multi-threaded Architecture: Separates input capture and physics processing for responsiveness
- Auto-detection: Automatically detects your system's scroll direction settings
- Use your scroll wheel like you normally would!
- Click to stop the inertia
- Move your mouse to dampen the inertia
# Download the latest .deb package
wget https://github.com/AshMartian/momentum_mouse/releases/latest/download/momentum-mouse_1.0.0_amd64.deb
# Install the package
sudo dpkg -i momentum-mouse_1.0.0_amd64.deb
# Install dependencies if needed
sudo apt-get install -f
# The service will start automatically
# Clone the repository
git clone https://github.com/AshMartian/momentum_mouse.git
cd momentum-mouse
# Install dependencies
sudo ./setup.sh
# Build the project
make
sudo ./momentum_mouse -h
# Install (optional)
sudo make install
# Start the service
sudo systemctl start momentum_mouse.service
dpkg-buildpackage -us -uc -b
sudo dpkg -i ../momentum-mouse_1.0.0_amd64.deb

Momentum Mouse can be configured through:
- Command-line arguments
- Configuration files at
/etc/momentum_mouse.conf
(system-wide) - Via the GUI! Installed as "Momentum Mouse"
# Enable or disable multitouch scrolling (true/false or 1/0)
multitouch=true
# Grab the input device exclusively (true/false or 1/0)
grab=false
# Use natural scrolling direction (true/false or 1/0)
natural=false
# Use horizontal scrolling instead of vertical (true/false or 1/0)
horizontal=false
# Enable debug logging (true/false or 1/0)
debug=false
# Scroll sensitivity (default: 1.0)
sensitivity=1.0
# Scroll multiplier (default: 1.0)
multiplier=1.0
# Scroll friction (default: 2.0)
friction=2.0
# Maximum velocity factor (default: 0.8)
max_velocity=0.8
# Velocity threshold below which inertia stops (default: 1.0)
inertia_stop_threshold=1.0
After updating your configuration, run sudo systemctl restart momentum_mouse.service
momentum mouse - Smooth scrolling for Linux
Usage: momentum_mouse [OPTIONS] [DEVICE_PATH]
Options:
--help, -h Show this help message and exit
--debug Enable debug logging
--grab Grab the input device exclusively
--no-multitouch Use wheel events instead of multitouch
--natural Force natural scrolling direction
--traditional Force traditional scrolling direction
--horizontal Use horizontal scrolling instead of vertical
--no-auto-detect Don't auto-detect system scroll direction
--sensitivity=VALUE Set scroll sensitivity (default: 1.0)
--multiplier=VALUE Set repeating scroll multiplier (default: 1.0)
--friction=VALUE Set scroll friction (default: 1.0)
Lower values make scrolling last longer
--max-velocity=VALUE Set maximum velocity as screen factor (default: 0.8)
Higher values allow faster scrolling
--inertia-stop-threshold=VALUE Set velocity threshold below which inertia stops (default: 1.0)
Higher values allow inertia to continue at lower speeds
--daemon Run as a background daemon
If DEVICE_PATH is provided, use that input device instead of auto-detecting
Momentum Mouse employs a multi-threaded architecture to ensure smooth performance and responsiveness:
-
Input Capture Thread:
- Uses
libevdev
to listen for events directly from the specified mouse device (or an auto-detected one). - If
grab_device
is enabled, it attempts to exclusively grab the device to prevent the original scroll events from reaching the desktop environment. - Filters incoming events:
- Scroll wheel events (
REL_WHEEL
orREL_HWHEEL
) are captured, and their delta values are placed into a thread-safe queue. - Mouse movement events (
REL_X
,REL_Y
) trigger a friction signal ifmouse_move_drag
is enabled. - Mouse clicks or Escape key presses trigger a stop signal.
- Scroll wheel events (
- Other events are passed through to the system via a virtual uinput device (
emit_passthrough_event
).
- Uses
-
Inertia Processing Thread:
- Waits for scroll deltas in the queue or signals (stop, friction) using condition variables.
- When scroll deltas arrive, it updates the current scrolling
velocity
andposition
based on the configured sensitivity, multiplier, and timing between events (update_inertia
). - Continuously calculates the effect of friction over time, reducing the
velocity
. - Applies additional friction if a mouse movement signal is received.
- Stops inertia immediately if a stop signal is received or if the velocity drops below a threshold.
- Based on the calculated velocity and position changes, it emits virtual events:
- Multitouch Mode (Default): Simulates two-finger touchpad movements (
emit_two_finger_scroll_event
) on a virtual uinput touchpad device. This provides the smoothest experience on most modern desktops. It includes logic to handle screen boundaries by "jumping" the virtual fingers. - Wheel Event Mode (
--no-multitouch
): Emits traditionalREL_WHEEL
orREL_HWHEEL
events (emit_scroll_event
) on a virtual uinput mouse device.
- Multitouch Mode (Default): Simulates two-finger touchpad movements (
- No effect on scrolling: Make sure the service is running with
systemctl status momentum_mouse.service
- Wrong mouse detected: Specify your mouse device path directly with
momentum_mouse /dev/input/eventX
- Check available input devices with
evtest
- Check available input devices with
- Conflicts with other software: Try disabling the
--grab
option if other applications need access to your mouse
Check the system logs for troubleshooting:
journalctl -u momentum_mouse.service
Don't like it? Sorry, run sudo systemctl stop momentum_mouse.service
:(
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.