diff --git a/CHANGELOG.develop b/CHANGELOG.develop index 12f7a062a..6ad7f421b 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -502,6 +502,7 @@ In org-agenda-mode performance in emacs 27 (thanks to Maximilian Wolff) - New variable =dotspacemacs-show-trailing-whitespace= (thanks to duianto) - New var =dotspacemacs-startup-buffer-multi-digit-delay= (thanks to duianto) + - New variable =dotspacemacs-scroll-bar-while-scrolling= (thanks to duianto) - Removed Variables: - Removed unused variable =dotspacemacs-verbose-loading= from =.spacemacs.template= (thanks to Ying Qu) diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index c2c09af23..49ba396ea 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -500,6 +500,12 @@ screen." 'boolean 'spacemacs-dotspacemacs-init) +(spacemacs|defc dotspacemacs-scroll-bar-while-scrolling t + "Show the scroll bar while scrolling. The auto hide time can be configured by +setting this variable to a number." + '(choice boolean number) + 'spacemacs-dotspacemacs-init) + (spacemacs|defc dotspacemacs-line-numbers nil "Control line numbers activation. If set to `t' or `relative' line numbers are turned on in all `prog-mode' and diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index b38cbb5ec..3e3b442af 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -374,6 +374,10 @@ It should only modify the values of Spacemacs settings." ;; when it reaches the top or bottom of the screen. (default t) dotspacemacs-smooth-scrolling t + ;; Show the scroll bar while scrolling. The auto hide time can be configured + ;; by setting this variable to a number. (default t) + dotspacemacs-scroll-bar-while-scrolling t + ;; Control line numbers activation. ;; If set to `t', `relative' or `visual' then line numbers are enabled in all ;; `prog-mode' and `text-mode' derivatives. If set to `relative', line diff --git a/layers/+spacemacs/spacemacs-defaults/funcs.el b/layers/+spacemacs/spacemacs-defaults/funcs.el index 3d9c7fe0e..b3c3fab89 100644 --- a/layers/+spacemacs/spacemacs-defaults/funcs.el +++ b/layers/+spacemacs/spacemacs-defaults/funcs.el @@ -1442,6 +1442,7 @@ using a visual block/rectangle selection." (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. @@ -1451,8 +1452,14 @@ This can be used to temporarily show the scroll bar when mouse wheel scrolling. 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) + (run-with-idle-timer + (if (numberp dotspacemacs-scroll-bar-while-scrolling) + dotspacemacs-scroll-bar-while-scrolling + 3) + nil + #'spacemacs//scroll-bar-hide)) +(when (and (fboundp 'scroll-bar-mode) + dotspacemacs-scroll-bar-while-scrolling) (advice-add 'mwheel-scroll :after #'spacemacs//scroll-bar-show-delayed-hide)) ;; BEGIN linum mouse helpers