From f0f7c53cb3d139fd6db6ec6097a181ec92090ac0 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 7 Apr 2022 01:42:18 +0100 Subject: [PATCH] feat(ui): enable pixel-scroll-precision-mode in GUI if available --- core/siren-core-modules.el | 3 +++ modules/ui/siren-pixel-scroll.el | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 modules/ui/siren-pixel-scroll.el diff --git a/core/siren-core-modules.el b/core/siren-core-modules.el index 5adbeae..7a46318 100644 --- a/core/siren-core-modules.el +++ b/core/siren-core-modules.el @@ -44,6 +44,9 @@ (require 'siren-uniquify) (require 'siren-which-key) +;; UI +(require 'siren-pixel-scroll) + ;; Completion Systems and Interfaces (require 'siren-vertico) (require 'siren-orderless) diff --git a/modules/ui/siren-pixel-scroll.el b/modules/ui/siren-pixel-scroll.el new file mode 100644 index 0000000..85907b9 --- /dev/null +++ b/modules/ui/siren-pixel-scroll.el @@ -0,0 +1,28 @@ +;;; siren-pixel-scroll.el --- jimeh's Emacs Siren: pixel-scroll. + +;;; Commentary: + +;; Enable and configure pixel-scroll-precision-mode on Emacs 29.x and later when +;; running in a window system. + +;;; Code: + +(when (fboundp 'pixel-scroll-precision-mode) + (use-package pixel-scroll + :straight (:type built-in) + :if window-system + + :custom + ;; Only affects keyboard-based scrolling when pixel scrolling is enabled. + (scroll-preserve-screen-position 'always) + (scroll-margin 0) + (pixel-scroll-precision-interpolate-page t) + (pixel-scroll-precision-large-scroll-height 40.0) + (pixel-scroll-precision-interpolation-factor 30) + (pixel-scroll-precision-use-momentum (not (eq system-type 'darwin))) + + :config + (pixel-scroll-precision-mode +1))) + +(provide 'siren-pixel-scroll) +;;; siren-pixel-scroll.el ends here