phairoh/hyprtrackscroll

Modifier + TrackPoint/touchpad scrolling drives Hyprland's scrolling layout

★ 0Forks 0C++GitHub ↗Compare

README

hyprtrackscroll

Hold a modifier and scroll with a ThinkPad TrackPoint (middle-button scroll) to slide the tape of Hyprland's native scrolling layout, 1:1 — the gesture the TrackPoint can't have any other way.

Why

Hyprland's scroll binds (SUPER + mouse_up etc.) only match wheel-source axis events — the discrete clicks of a physical mouse wheel. TrackPoint middle-button scrolling is a continuous-source event stream, so it can never trigger a bind; with a modifier held it just leaks into the focused application. The gesture system doesn't cover it either (gestures are 3+ finger touchpad events; TrackPoint scrolling isn't a gesture source), and the Lua event API exposes no pointer events. Touchpad users have the official three-finger scroll_move gesture; the TrackPoint — the primary pointer on a machine with no meaningful touchpad habit — has nothing.

This plugin closes that gap with a 1:1 tape gesture, opt-in via config (installing it changes nothing by itself): hold the configured modifier and scroll to slide the tape, driven through the scrolling algorithm directly — the same path as the official scroll_move touchpad gesture — with a snap-to-grid settle when you release. On other layouts the gesture is a no-op, but the scroll is still consumed while the modifier is held.

An earlier version also offered bind_mods: scroll deltas accumulated into wheel-detent steps and re-injected into the keybind pipeline, so ordinary hl.bind("<mods> + mouse_up", ...) binds fired from these devices. It worked, but a scroll stream forced through trigger semantics is choppy by construction (and throttled by binds.scroll_event_delay), so it was dropped — the code remains at tag v0.3-bind-demo as a demonstration that the bind shape is possible and that gesture semantics are the right answer.

Install

hyprpm add https://github.com/phairoh/hyprtrackscroll
hyprpm enable hyprtrackscroll

Or for development: make and hyprctl plugin load $PWD/hyprtrackscroll.so.

Requires the Hyprland headers matching your compositor (on Arch they ship with the hyprland package; elsewhere run hyprpm update).

Config

Defaults shown; all values live under plugin.hyprtrackscroll:

hl.config({
    plugin = {
        hyprtrackscroll = {
            mod         = "",    -- tape-gesture modifier(s), e.g. "SUPER"; "" = off
            sensitivity = 1.0,   -- scroll-delta → tape-px multiplier
            invert      = false, -- reverse tape direction
            trackpoint  = true,  -- react to continuous-source scrolling
            touchpad    = false, -- also react to finger-source scrolling
                                 -- (two-finger); off by default — touchpads
                                 -- have the official 3-finger gestures
        },
    },
})

Touchpad two-finger scrolling shares the same gap (finger-source events can't trigger binds either), and touchpad = true extends the gesture to it — but it's off by default, since the three-finger hl.gesture scroll_move action is the sanctioned way to scroll the tape from a touchpad, and two-finger scrolling conventionally belongs to applications.

Contributors

phairoh

Issues