From 25d4111c7b7f31bc8c5a78d57ef40a07521f524b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9andre?= Date: Wed, 26 Jan 2022 18:54:33 +0100 Subject: [PATCH] Correction for timer performance. --- ghb.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ghb.el b/ghb.el index db4b696..a36507f 100644 --- a/ghb.el +++ b/ghb.el @@ -27,12 +27,12 @@ ;; along with this program. If not, see . ;;; Commentary: -;; + ;; This package propose to insert a frame header bar with : ;; - project name; ;; - date and time; ;; - battery information. -;; + ;;; Code: (require 'all-the-icons) @@ -198,15 +198,15 @@ command starts, by installing a pre-command hook." (when (null (ghb-get ghb-timer frame)) ;; Set up the timer first, so that if this signals an error, ;; ghb is not added to pre-command-hook. - (ghb--start-timer frame))) - ;; (add-hook 'pre-command-hook (lambda () (ghb-end frame))))) + (ghb--start-timer frame) + (add-hook 'pre-command-hook `(lambda () (ghb-end ,frame))))) (defun ghb-end (&optional frame) "Stop header bar updating. This is installed as a pre-command hook by `ghb-start'. When run, it cancels the timer `ghb-timer' and removes itself as a pre-command hook." - ;; (remove-hook 'pre-command-hook (lambda () (ghb-end frame))) + (remove-hook 'pre-command-hook `(lambda () (ghb-end ,frame))) (let ((timer (ghb-get ghb-timer frame))) (when timer (cancel-timer timer) @@ -367,5 +367,7 @@ itself as a pre-command hook." (advice-add 'desktop-save :before 'ghb-close) (advice-add 'desktop-save :after 'ghb-open) +(setq ghb-time-idle-delay 5.0) + (provide 'ghb) ;;; ghb.el ends here