mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 13:07:59 +01:00
Improve the performance of workspace creation
* exwm-workspace.el (exwm-workspace--add-frame-as-workspace): Do not run `exwm-workspace-list-change-hook' when create workspace in the background. (exwm-workspace-switch-create): Run the hook once. (exwm-workspace--prompt-add): Run the hook.
This commit is contained in:
parent
76ced38ae4
commit
86777c54f3
1 changed files with 9 additions and 5 deletions
|
@ -110,14 +110,17 @@ NIL if FRAME is not a workspace"
|
||||||
(defvar exwm-workspace--prompt-delete-allowed nil
|
(defvar exwm-workspace--prompt-delete-allowed nil
|
||||||
"Non-nil to allow deleting workspace from the prompt")
|
"Non-nil to allow deleting workspace from the prompt")
|
||||||
(defvar exwm-workspace--create-silently nil
|
(defvar exwm-workspace--create-silently nil
|
||||||
"When non-nil workspaces are created in the background (not switched to).")
|
"When non-nil workspaces are created in the background (not switched to).
|
||||||
|
|
||||||
|
Please manually run the hook `exwm-workspace-list-change-hook' afterwards.")
|
||||||
|
|
||||||
(defun exwm-workspace--prompt-add ()
|
(defun exwm-workspace--prompt-add ()
|
||||||
"Add workspace from the prompt."
|
"Add workspace from the prompt."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when exwm-workspace--prompt-add-allowed
|
(when exwm-workspace--prompt-add-allowed
|
||||||
(let ((exwm-workspace--create-silently t))
|
(let ((exwm-workspace--create-silently t))
|
||||||
(make-frame))
|
(make-frame)
|
||||||
|
(run-hooks 'exwm-workspace-list-change-hook))
|
||||||
(exwm-workspace--update-switch-history)
|
(exwm-workspace--update-switch-history)
|
||||||
(goto-history-element minibuffer-history-position)))
|
(goto-history-element minibuffer-history-position)))
|
||||||
|
|
||||||
|
@ -507,7 +510,8 @@ each time.")
|
||||||
(dotimes (_ (min exwm-workspace-switch-create-limit
|
(dotimes (_ (min exwm-workspace-switch-create-limit
|
||||||
(1+ (- frame-or-index
|
(1+ (- frame-or-index
|
||||||
(exwm-workspace--count)))))
|
(exwm-workspace--count)))))
|
||||||
(make-frame)))
|
(make-frame))
|
||||||
|
(run-hooks 'exwm-workspace-list-change-hook))
|
||||||
(exwm-workspace-switch (car (last exwm-workspace--list)))))
|
(exwm-workspace-switch (car (last exwm-workspace--list)))))
|
||||||
|
|
||||||
(defvar exwm-workspace-list-change-hook nil
|
(defvar exwm-workspace-list-change-hook nil
|
||||||
|
@ -1174,8 +1178,8 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
||||||
(exwm-workspace--update-ewmh-props)
|
(exwm-workspace--update-ewmh-props)
|
||||||
(if exwm-workspace--create-silently
|
(if exwm-workspace--create-silently
|
||||||
(setq exwm-workspace--switch-history-outdated t)
|
(setq exwm-workspace--switch-history-outdated t)
|
||||||
(exwm-workspace-switch frame t))
|
(exwm-workspace-switch frame t)
|
||||||
(run-hooks 'exwm-workspace-list-change-hook))))
|
(run-hooks 'exwm-workspace-list-change-hook)))))
|
||||||
|
|
||||||
(defun exwm-workspace--remove-frame-as-workspace (frame)
|
(defun exwm-workspace--remove-frame-as-workspace (frame)
|
||||||
"Stop treating frame FRAME as a workspace."
|
"Stop treating frame FRAME as a workspace."
|
||||||
|
|
Loading…
Reference in a new issue