fix(macos): enable pixel-scroll-precision-mode for smooth trackpad/mouse scrolling
macOS NS/Cocoa Emacs generates pixel-level scroll events from trackpad and Magic Mouse. Without pixel-scroll-precision-mode, these events are handled as line-based scrolling, resulting in jerky or broken scroll behavior. Changes: - Enable pixel-scroll-precision-mode (Emacs 29+) in GUI mode - Set pixel-scroll-precision-large-scroll-height to 40.0 (prevents trackpad fling from being interpolated frame-by-frame) - Enable momentum scrolling (trackpad inertia from macOS) - Keep line-based mouse-wheel-scroll-amount as fallback for physical scroll wheels
This commit is contained in:
19
config.el
19
config.el
@@ -178,10 +178,25 @@ Bound to cmd+v in org-mode and markdown-mode."
|
||||
[down-mouse-1] [down-mouse-2] [down-mouse-3]))
|
||||
(global-set-key key #'ignore))
|
||||
(setq mouse-highlight nil)
|
||||
;; Smooth scroll wheel: 3 lines per tick, no acceleration
|
||||
|
||||
;; Scroll wheel — macOS NS/Cocoa generates pixel-level scroll events from
|
||||
;; trackpad and Magic Mouse. pixel-scroll-precision-mode (Emacs 29+) handles
|
||||
;; these natively for smooth, 1:1 scrolling. Line-based mouse-wheel-scroll-amount
|
||||
;; is kept as fallback for physical scroll wheels that send line events.
|
||||
(setq mouse-wheel-scroll-amount '(3 ((shift) . 1) ((control) . nil))
|
||||
mouse-wheel-progressive-speed nil
|
||||
mouse-wheel-follow-mouse t))
|
||||
mouse-wheel-follow-mouse t)
|
||||
|
||||
;; Enable pixel-precise scrolling (Emacs 29+) — essential for macOS trackpad/
|
||||
;; Magic Mouse. Translates pixel deltas from NS scroll events into smooth
|
||||
;; pixel-level buffer scrolling instead of jerky line jumps.
|
||||
(when (fboundp 'pixel-scroll-precision-mode)
|
||||
(pixel-scroll-precision-mode 1)
|
||||
;; Large scroll threshold: pixel deltas above this trigger line-based scroll
|
||||
;; (prevents trackpad fling from being interpolated frame-by-frame).
|
||||
(setq pixel-scroll-precision-large-scroll-height 40.0
|
||||
;; Use momentum scrolling from macOS (trackpad inertia)
|
||||
pixel-scroll-precision-use-momentum t)))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user