From 0dd909a11baf3d7d766c1672d726eb59b1474ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Medra=C3=B1o=20Calvo?= Date: Sat, 3 Nov 2018 12:00:00 +0000 Subject: [PATCH 1/2] Stop hiding the minibuffer when a message is being displayed * exwm-workspace.el (exwm-workspace--echo-area-maybe-clear): New function that postpones hiding the minibuffer when it's displaying a message. (exwm-workspace--on-echo-area-dirty): Use it. --- exwm-workspace.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/exwm-workspace.el b/exwm-workspace.el index 383bf530b..0f0d10c36 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -1203,7 +1203,18 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." input-method-use-echo-area) (setq exwm-workspace--display-echo-area-timer (run-with-timer exwm-workspace-display-echo-area-timeout nil - #'exwm-workspace--on-echo-area-clear))))) + #'exwm-workspace--echo-area-maybe-clear))))) + +(defun exwm-workspace--echo-area-maybe-clear () + "Eventually clear the echo area container." + (exwm--log) + (if (not (current-message)) + (exwm-workspace--on-echo-area-clear) + ;; Reschedule. + (cancel-timer exwm-workspace--display-echo-area-timer) + (setq exwm-workspace--display-echo-area-timer + (run-with-timer exwm-workspace-display-echo-area-timeout nil + #'exwm-workspace--echo-area-maybe-clear)))) (defun exwm-workspace--on-echo-area-clear () "Run in echo-area-clear-hook to hide echo area container." From cd7b32d1c203b87d428ea75e5a5e1452d8236742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Medra=C3=B1o=20Calvo?= Date: Sat, 3 Nov 2018 12:00:00 +0000 Subject: [PATCH 2/2] Hide minibuffer upon receiving any event * exwm-input.el (exwm-input--event-hook): New variable. (exwm-input--on-ButtonPress, exwm-input--on-KeyPress): Run `exwm-input--event-hook'. * exwm-workspace.el (exwm-workspace--init, exwm-workspace--exit): Hide minibuffer upon noticing an event. --- exwm-input.el | 9 +++++++-- exwm-workspace.el | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/exwm-input.el b/exwm-input.el index c757b09d3..a7fb16a17 100644 --- a/exwm-input.el +++ b/exwm-input.el @@ -137,6 +137,9 @@ defined in `exwm-mode-map' here." (defvar exwm-input--update-focus-window nil "The (Emacs) window to be focused. This value should always be overwritten.") +(defvar exwm-input--event-hook nil + "Hook to run when EXWM receives an event.") + (defvar exwm-workspace--current) (declare-function exwm-floating--do-moveresize "exwm-floating.el" (data _synthetic)) @@ -418,7 +421,8 @@ ARGS are additional arguments to CALLBACK." (setq mode (exwm-input--on-ButtonPress-char-mode))))))))) (xcb:+request exwm--connection (make-instance 'xcb:AllowEvents :mode mode :time xcb:Time:CurrentTime)) - (xcb:flush exwm--connection))) + (xcb:flush exwm--connection)) + (run-hooks 'exwm-input--event-hook)) (defun exwm-input--on-KeyPress (data _synthetic) "Handle KeyPress event." @@ -432,7 +436,8 @@ ARGS are additional arguments to CALLBACK." (exwm-input--on-KeyPress-line-mode obj data)) (char-mode (exwm-input--on-KeyPress-char-mode obj data))) - (exwm-input--on-KeyPress-char-mode obj)))) + (exwm-input--on-KeyPress-char-mode obj))) + (run-hooks 'exwm-input--event-hook)) (defun exwm-input--on-CreateNotify (data _synthetic) "Handle CreateNotify events." diff --git a/exwm-workspace.el b/exwm-workspace.el index 0f0d10c36..d58758fc1 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -128,6 +128,7 @@ Please manually run the hook `exwm-workspace-list-change-hook' afterwards.") (defvar exwm-workspace--workareas nil "Workareas (struts excluded).") (defvar exwm-input--during-command) +(defvar exwm-input--event-hook) (defvar exwm-layout-show-all-buffers) (defvar exwm-manage--desktop) (declare-function exwm-input--on-buffer-list-update "exwm-input.el" ()) @@ -1584,6 +1585,9 @@ applied to all subsequently created X frames." (add-hook 'after-make-frame-functions #'exwm-workspace--on-after-make-frame) (add-hook 'delete-frame-functions #'exwm-workspace--on-delete-frame) + (when (exwm-workspace--minibuffer-own-frame-p) + (add-hook 'exwm-input--event-hook + #'exwm-workspace--on-echo-area-clear)) ;; Switch to the first workspace (exwm-workspace-switch 0 t) ;; Prevent frame parameters introduced by this module from being @@ -1604,6 +1608,9 @@ applied to all subsequently created X frames." #'exwm-workspace--on-after-make-frame) (remove-hook 'delete-frame-functions #'exwm-workspace--on-delete-frame) + (when (exwm-workspace--minibuffer-own-frame-p) + (remove-hook 'exwm-input--event-hook + #'exwm-workspace--on-echo-area-clear)) ;; Hide & reparent out all frames (save-set can't be used here since ;; X windows will be re-mapped). (setq exwm-workspace--current nil)