emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/keycast 75d3862dea 2/2: keycast-log-mode: Also toggle focu


From: ELPA Syncer
Subject: [nongnu] elpa/keycast 75d3862dea 2/2: keycast-log-mode: Also toggle focus-avoidance of log frame
Date: Mon, 30 Oct 2023 19:01:47 -0400 (EDT)

branch: elpa/keycast
commit 75d3862deab1bfa2993b75092320b2ba6c7ed7da
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    keycast-log-mode: Also toggle focus-avoidance of log frame
    
    Without this it is difficult to kill the buffer and frame after
    exiting the mode.
    
    Closes #27.
---
 keycast.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/keycast.el b/keycast.el
index 2ae77e35fc..e89a824285 100644
--- a/keycast.el
+++ b/keycast.el
@@ -670,10 +670,12 @@ t to show the actual COMMAND, or a symbol to be shown 
instead."
    (keycast-log-mode
     (add-hook 'post-command-hook #'keycast--update t)
     (add-hook 'minibuffer-exit-hook #'keycast--minibuffer-exit t)
+    (keycast-log--set-focus-properties t)
     (keycast-log-update-buffer))
    ((not (keycast--mode-active-p))
     (remove-hook 'post-command-hook #'keycast--update)
-    (remove-hook 'minibuffer-exit-hook #'keycast--minibuffer-exit))))
+    (remove-hook 'minibuffer-exit-hook #'keycast--minibuffer-exit)
+    (keycast-log--set-focus-properties nil))))
 
 (defun keycast-log-update-buffer ()
   (let ((buf (get-buffer keycast-log-buffer-name)))
@@ -699,6 +701,15 @@ t to show the actual COMMAND, or a symbol to be shown 
instead."
           (insert output))
         (goto-char (if keycast-log-newest-first (point-min) (point-max)))))))
 
+(defun keycast-log--set-focus-properties (value)
+  (when-let* ((buffer (get-buffer keycast-log-buffer-name))
+              (window (get-buffer-window buffer t))
+              (frame (window-frame window)))
+    (when (cdr (assq 'no-accept-focus keycast-log-frame-alist))
+      (set-frame-parameter frame 'no-accept-focus value))
+    (when (cdr (assq 'no-accept-on-map keycast-log-frame-alist))
+      (set-frame-parameter frame 'no-focus-on-map value))))
+
 (defun keycast-log-erase-buffer ()
   "Erase the contents of `keycast-log-mode's buffer."
   (interactive)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]