Skip to content

Commit

Permalink
[defaults] Show scroll bar when using the mouse wheel
Browse files Browse the repository at this point in the history
Thanks to duianto
  • Loading branch information
syl20bnr committed Mar 26, 2021
1 parent 5874e1a commit a9cafdb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions layers/+spacemacs/spacemacs-defaults/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,23 @@ using a visual block/rectangle selection."
(interactive)
(spacemacs/sort-lines-by-column -1))

;; Show scroll bar when using the mouse wheel
(defun spacemacs//scroll-bar-hide ()
" Hide the scroll bar."
(scroll-bar-mode -1))
(defun spacemacs//scroll-bar-show-delayed-hide (&rest _ignore)
"Show the scroll bar for a couple of seconds, before hiding it.
This can be used to temporarily show the scroll bar when mouse wheel scrolling.
(advice-add 'mwheel-scroll :after #'spacemacs//scroll-bar-show-delayed-hide)
The advice can be removed with:
(advice-remove 'mwheel-scroll #'spacemacs//scroll-bar-show-delayed-hide)"
(scroll-bar-mode 1)
(run-with-idle-timer 3 nil #'spacemacs//scroll-bar-hide))
(when (fboundp 'scroll-bar-mode)
(advice-add 'mwheel-scroll :after #'spacemacs//scroll-bar-show-delayed-hide))

;; BEGIN linum mouse helpers

(defvar spacemacs-linum-mdown-line nil
Expand Down

0 comments on commit a9cafdb

Please sign in to comment.