Fix various minor issues

; Coding style fixes

* exwm-core.el (exwm-mode-menu exwm-mode-map):
Use `exwm-workspace--count'.
* exwm-workspace.el (exwm-workspace--set-fullscreen)
(exwm-workspace--on-focus-in, exwm-workspace--set-desktop):
Use `exwm-workspace--position'.

* exwm-workspace.el (exwm-workspace-swap, exwm-workspace-move):
Renamed from `exwm-workspace-swap-workspace' and
`exwm-workspace-move-workspace'.

* exwm-workspace.el (exwm-workspace--update-ewmh-props):
Update comments.

* exwm-workspace.el (exwm-workspace--switch-map-nth-prefix):
Fix a calculation.

* exwm-workspace.el (exwm-workspace-switch): Fix a potential timer
problem.

* exwm-workspace.el (exwm-workspace-swap, exwm-workspace-move)
(exwm-workspace--remove-frame-as-workspace): Update workspace and
clients involved.

* exwm-workspace.el (exwm-workspace--remove-frame-as-workspace):
Remove workspace first.
This commit is contained in:
Chris Feng 2016-07-19 10:24:23 +08:00
parent d0797d03de
commit 73d890aad4
4 changed files with 102 additions and 54 deletions

View file

@ -205,7 +205,7 @@
(interactive) (interactive)
(exwm-workspace-switch ,i)) (exwm-workspace-switch ,i))
(/= ,i exwm-workspace-current-index)]) (/= ,i exwm-workspace-current-index)])
(number-sequence 0 (1- exwm-workspace-number))))))) (number-sequence 0 (1- (exwm-workspace--count))))))))
(declare-function exwm-manage--kill-buffer-query-function "exwm-manage.el") (declare-function exwm-manage--kill-buffer-query-function "exwm-manage.el")

View file

@ -304,7 +304,7 @@ selected by `other-buffer'."
(make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST_STACKING (make-instance 'xcb:ewmh:set-_NET_CLIENT_LIST_STACKING
:window exwm--root :window exwm--root
:data (vconcat (append clients-other clients-iconic :data (vconcat (append clients-other clients-iconic
clients clients-floating)))))) clients clients-floating))))))
(defun exwm-layout--refresh () (defun exwm-layout--refresh ()
"Refresh layout." "Refresh layout."

View file

@ -515,7 +515,7 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
(< (abs width-delta) (< (abs width-delta)
exwm-manage--width-delta-min)) exwm-manage--width-delta-min))
(if (= 0 (logand value-mask (if (= 0 (logand value-mask
xcb:ConfigWindow:Height)) xcb:ConfigWindow:Height))
t t
(< (abs height-delta) (< (abs height-delta)
exwm-manage--height-delta-min)))))))) exwm-manage--height-delta-min))))))))

View file

@ -53,7 +53,8 @@ NIL if FRAME is not a workspace"
(user-error "[EXWM] Frame is not a workspace %S" frame-or-index)) (user-error "[EXWM] Frame is not a workspace %S" frame-or-index))
frame-or-index) frame-or-index)
((integerp frame-or-index) ((integerp frame-or-index)
(unless (and (<= 0 frame-or-index) (< frame-or-index (exwm-workspace--count))) (unless (and (<= 0 frame-or-index)
(< frame-or-index (exwm-workspace--count)))
(user-error "[EXWM] Workspace index out of range: %d" frame-or-index)) (user-error "[EXWM] Workspace index out of range: %d" frame-or-index))
(elt exwm-workspace--list frame-or-index)) (elt exwm-workspace--list frame-or-index))
(t (user-error "[EXWM] Invalid workspace: %s" frame-or-index)))) (t (user-error "[EXWM] Invalid workspace: %s" frame-or-index))))
@ -62,7 +63,8 @@ NIL if FRAME is not a workspace"
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map [t] (lambda () (interactive))) (define-key map [t] (lambda () (interactive)))
(dotimes (i 10) (dotimes (i 10)
(define-key map (int-to-string i) #'exwm-workspace--switch-map-nth-prefix)) (define-key map (int-to-string i)
#'exwm-workspace--switch-map-nth-prefix))
(define-key map "\C-a" (lambda () (interactive) (goto-history-element 1))) (define-key map "\C-a" (lambda () (interactive) (goto-history-element 1)))
(define-key map "\C-e" (lambda () (define-key map "\C-e" (lambda ()
(interactive) (interactive)
@ -95,7 +97,8 @@ NIL if FRAME is not a workspace"
"Workspace: " (elt exwm-workspace--switch-history current-idx) "Workspace: " (elt exwm-workspace--switch-history current-idx)
exwm-workspace--switch-map nil exwm-workspace--switch-map nil
`(exwm-workspace--switch-history . ,(1+ current-idx)))) `(exwm-workspace--switch-history . ,(1+ current-idx))))
(workspace-idx (cl-position history-idx exwm-workspace--switch-history :test #'equal))) (workspace-idx (cl-position history-idx exwm-workspace--switch-history
:test #'equal)))
(elt exwm-workspace--list workspace-idx))) (elt exwm-workspace--list workspace-idx)))
(defun exwm-workspace--update-switch-history () (defun exwm-workspace--update-switch-history ()
@ -270,7 +273,7 @@ Value nil means to use the default position which is fixed at bottom, while
(defun exwm-workspace--set-fullscreen (frame) (defun exwm-workspace--set-fullscreen (frame)
"Make frame FRAME fullscreen according to `exwm-workspace--workareas'." "Make frame FRAME fullscreen according to `exwm-workspace--workareas'."
(let ((workarea (elt exwm-workspace--workareas (let ((workarea (elt exwm-workspace--workareas
(cl-position frame exwm-workspace--list))) (exwm-workspace--position frame)))
(id (frame-parameter frame 'exwm-outer-id)) (id (frame-parameter frame 'exwm-outer-id))
(container (frame-parameter frame 'exwm-container)) (container (frame-parameter frame 'exwm-container))
(workspace (frame-parameter frame 'exwm-workspace)) (workspace (frame-parameter frame 'exwm-workspace))
@ -317,11 +320,8 @@ Value nil means to use the default position which is fixed at bottom, while
PREFIX-DIGITS is a list of the digits introduced so far." PREFIX-DIGITS is a list of the digits introduced so far."
(interactive) (interactive)
(let* ((ev (this-command-keys-vector)) (let* ((k (aref (substring (this-command-keys-vector) -1) 0))
(off (1- (length ev))) (d (- k ?0))
(k (elt ev off))
;; 0 is ASCII 48.
(d (- k 48))
;; Convert prefix-digits to number. For example, '(2 1) to 120. ;; Convert prefix-digits to number. For example, '(2 1) to 120.
(o 1) (o 1)
(pn (apply #'+ (mapcar (lambda (x) (pn (apply #'+ (mapcar (lambda (x)
@ -330,15 +330,16 @@ PREFIX-DIGITS is a list of the digits introduced so far."
prefix-digits))) prefix-digits)))
(n (+ pn d)) (n (+ pn d))
(num-workspaces (exwm-workspace--count))) (num-workspaces (exwm-workspace--count)))
(if (= (length prefix-digits) ; Go ahead if there are enough (if (= (length prefix-digits)
(floor (log num-workspaces 10))) ; digits to select any workspace. (floor (log (1- num-workspaces) 10)))
(exwm-workspace--switch-map-select-nth n) (exwm-workspace--switch-map-select-nth n)
;; go ahead if there are enough digits to select any workspace.
(set-transient-map (set-transient-map
(let ((map (make-sparse-keymap)) (let ((map (make-sparse-keymap))
(cmd `(lambda () (cmd `(lambda ()
(interactive) (interactive)
(exwm-workspace--switch-map-nth-prefix ',(cons d prefix-digits)) (exwm-workspace--switch-map-nth-prefix
))) ',(cons d prefix-digits)))))
(dotimes (i 10) (dotimes (i 10)
(define-key map (int-to-string i) cmd)) (define-key map (int-to-string i) cmd))
;; Accept ;; Accept
@ -383,10 +384,10 @@ The optional FORCE option is for internal use only."
(unless (buffer-local-value 'exwm--fullscreen (window-buffer window)) (unless (buffer-local-value 'exwm--fullscreen (window-buffer window))
(dolist (pair exwm-workspace--id-struts-alist) (dolist (pair exwm-workspace--id-struts-alist)
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ConfigureWindow (make-instance 'xcb:ConfigureWindow
:window (car pair) :window (car pair)
:value-mask xcb:ConfigWindow:StackMode :value-mask xcb:ConfigWindow:StackMode
:stack-mode xcb:StackMode:Above)))) :stack-mode xcb:StackMode:Above))))
(setq exwm-workspace--current frame (setq exwm-workspace--current frame
exwm-workspace-current-index index) exwm-workspace-current-index index)
(unless (exwm-workspace--workspace-p (selected-frame)) (unless (exwm-workspace--workspace-p (selected-frame))
@ -398,7 +399,10 @@ The optional FORCE option is for internal use only."
(set-frame-parameter frame 'exwm-selected-window nil) (set-frame-parameter frame 'exwm-selected-window nil)
;; Close the (possible) active minibuffer ;; Close the (possible) active minibuffer
(when (active-minibuffer-window) (when (active-minibuffer-window)
(run-with-idle-timer 0 nil (lambda () (abort-recursive-edit)))) (run-with-idle-timer 0 nil (lambda ()
;; Might be aborted by then.
(when (active-minibuffer-window)
(abort-recursive-edit)))))
(if (not (exwm-workspace--minibuffer-own-frame-p)) (if (not (exwm-workspace--minibuffer-own-frame-p))
(setq default-minibuffer-frame frame) (setq default-minibuffer-frame frame)
;; Resize/reposition the minibuffer frame ;; Resize/reposition the minibuffer frame
@ -428,10 +432,11 @@ The optional FORCE option is for internal use only."
(make-instance 'xcb:ewmh:set-_NET_CURRENT_DESKTOP (make-instance 'xcb:ewmh:set-_NET_CURRENT_DESKTOP
:window exwm--root :data index)) :window exwm--root :data index))
(xcb:flush exwm--connection)) (xcb:flush exwm--connection))
(run-hooks 'exwm-workspace-switch-hook))) (run-hooks 'exwm-workspace-switch-hook)))
;;;###autoload ;;;###autoload
(defun exwm-workspace-swap-workspaces (workspace1 workspace2) (defun exwm-workspace-swap (workspace1 workspace2)
"Interchange position of WORKSPACE1 with that of WORKSPACE2." "Interchange position of WORKSPACE1 with that of WORKSPACE2."
(interactive (interactive
(unless (and (eq major-mode 'exwm-mode) exwm--fullscreen) ;it's invisible (unless (and (eq major-mode 'exwm-mode) exwm--fullscreen) ;it's invisible
@ -440,19 +445,24 @@ The optional FORCE option is for internal use only."
(exwm-workspace--prompt-for-workspace)))) (exwm-workspace--prompt-for-workspace))))
(let ((pos1 (exwm-workspace--position workspace1)) (let ((pos1 (exwm-workspace--position workspace1))
(pos2 (exwm-workspace--position workspace2))) (pos2 (exwm-workspace--position workspace2)))
(if (and pos1 pos2) (if (or (not pos1) (not pos2) (= pos1 pos2))
(progn (user-error "[EXWM] Cannot swap %s and %s" workspace1 workspace2)
(setf (elt exwm-workspace--list pos1) workspace2) (setf (elt exwm-workspace--list pos1) workspace2)
(setf (elt exwm-workspace--list pos2) workspace1) (setf (elt exwm-workspace--list pos2) workspace1)
(cond ;; Update the _NET_WM_DESKTOP property of each X window affected.
((eq exwm-workspace--current workspace1) (dolist (pair exwm--id-buffer-alist)
(setq exwm-workspace-current-index pos2)) (when (memq (buffer-local-value 'exwm--frame (cdr pair))
((eq exwm-workspace--current workspace2) (list workspace1 workspace2))
(setq exwm-workspace-current-index pos1)))) (exwm-workspace--set-desktop (car pair))))
(user-error "[EXWM] Frames are not workspaces")))) (xcb:flush exwm--connection)
(when (memq exwm-workspace--current (list workspace1 workspace2))
;; With the current workspace involved, lots of stuffs need refresh.
(set-frame-parameter exwm-workspace--current 'exwm-selected-window
(selected-window))
(exwm-workspace-switch exwm-workspace--current t)))))
;;;###autoload ;;;###autoload
(defun exwm-workspace-move-workspace (workspace nth) (defun exwm-workspace-move (workspace nth)
"Move WORKSPACE to the NTH position. "Move WORKSPACE to the NTH position.
When called interactively, prompt for a workspace and move current one just When called interactively, prompt for a workspace and move current one just
before it." before it."
@ -461,16 +471,36 @@ before it."
(list exwm-workspace--current (list exwm-workspace--current
(exwm-workspace--position (exwm-workspace--prompt-for-workspace))))) (exwm-workspace--position (exwm-workspace--prompt-for-workspace)))))
(let ((pos (exwm-workspace--position workspace))) (let ((pos (exwm-workspace--position workspace)))
(let ((pos (exwm-workspace--position workspace))
flag start end index)
(if (= nth pos) (if (= nth pos)
(user-error "[EXWM] Cannot move to same position") (user-error "[EXWM] Cannot move to same position")
;; Set if the current workspace is involved.
(setq flag (or (eq workspace exwm-workspace--current)
(eq (elt exwm-workspace--list nth)
exwm-workspace--current)))
;; Do the move.
(pop (nthcdr pos exwm-workspace--list)) (pop (nthcdr pos exwm-workspace--list))
(push workspace (nthcdr nth exwm-workspace--list))))) (push workspace (nthcdr nth exwm-workspace--list))
;; Update the _NET_WM_DESKTOP property of each X window affected.
(setq start (min pos nth)
end (max pos nth))
(dolist (pair exwm--id-buffer-alist)
(setq index (exwm-workspace--position
(buffer-local-value 'exwm--frame (cdr pair))))
(unless (or (< index start) (> index end))
(exwm-workspace--set-desktop (car pair))))
(when flag
;; With the current workspace involved, lots of stuffs need refresh.
(set-frame-parameter exwm-workspace--current 'exwm-selected-window
(selected-window))
(exwm-workspace-switch exwm-workspace--current t)))))
(defun exwm-workspace--on-focus-in () (defun exwm-workspace--on-focus-in ()
"Handle unexpected frame switch." "Handle unexpected frame switch."
;; `focus-in-hook' is run by `handle-switch-frame'. ;; `focus-in-hook' is run by `handle-switch-frame'.
(unless (eq this-command #'handle-switch-frame) (unless (eq this-command #'handle-switch-frame)
(let ((index (cl-position (selected-frame) exwm-workspace--list))) (let ((index (exwm-workspace--position (selected-frame))))
(exwm--log "Focus on workspace %s" index) (exwm--log "Focus on workspace %s" index)
(when (and index (/= index exwm-workspace-current-index)) (when (and index (/= index exwm-workspace-current-index))
(exwm--log "Workspace was switched unexpectedly") (exwm--log "Workspace was switched unexpectedly")
@ -482,7 +512,7 @@ before it."
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_WM_DESKTOP (make-instance 'xcb:ewmh:set-_NET_WM_DESKTOP
:window id :window id
:data (cl-position exwm--frame exwm-workspace--list))))) :data (exwm-workspace--position exwm--frame)))))
(defvar exwm-floating-border-width) (defvar exwm-floating-border-width)
(defvar exwm-floating-border-color) (defvar exwm-floating-border-color)
@ -490,7 +520,8 @@ before it."
(declare-function exwm-layout--show "exwm-layout.el" (id &optional window)) (declare-function exwm-layout--show "exwm-layout.el" (id &optional window))
(declare-function exwm-layout--hide "exwm-layout.el" (id)) (declare-function exwm-layout--hide "exwm-layout.el" (id))
(declare-function exwm-layout--refresh "exwm-layout.el") (declare-function exwm-layout--refresh "exwm-layout.el")
(declare-function exwm-layout--other-buffer-predicate "exwm-layout.el" (buffer)) (declare-function exwm-layout--other-buffer-predicate "exwm-layout.el"
(buffer))
;;;###autoload ;;;###autoload
(defun exwm-workspace-move-window (frame-or-index &optional id) (defun exwm-workspace-move-window (frame-or-index &optional id)
@ -906,7 +937,8 @@ before it."
(exwm--log "Adding frame `%s' as workspace" frame) (exwm--log "Adding frame `%s' as workspace" frame)
(setq exwm-workspace--list (nconc exwm-workspace--list (list frame)) (setq exwm-workspace--list (nconc exwm-workspace--list (list frame))
exwm-workspace--current frame) exwm-workspace--current frame)
(let ((outer-id (string-to-number (frame-parameter frame 'outer-window-id))) (let ((outer-id (string-to-number (frame-parameter frame
'outer-window-id)))
(container (xcb:generate-id exwm--connection)) (container (xcb:generate-id exwm--connection))
(workspace (xcb:generate-id exwm--connection))) (workspace (xcb:generate-id exwm--connection)))
;; Save window IDs ;; Save window IDs
@ -965,7 +997,8 @@ before it."
;; Delay making the workspace fullscreen until Emacs becomes idle ;; Delay making the workspace fullscreen until Emacs becomes idle
(run-with-idle-timer 0 nil (run-with-idle-timer 0 nil
`(lambda () `(lambda ()
(set-frame-parameter ,frame 'fullscreen 'fullboth))) (set-frame-parameter ,frame
'fullscreen 'fullboth)))
;; Update EWMH properties. ;; Update EWMH properties.
(exwm-workspace--update-ewmh-props) (exwm-workspace--update-ewmh-props)
(exwm-workspace-switch frame t)))) (exwm-workspace-switch frame t))))
@ -984,16 +1017,24 @@ before it."
;; As we are removing this workspace, the one on its left is its ;; As we are removing this workspace, the one on its left is its
;; natural substitutes... except when this is already the last one ;; natural substitutes... except when this is already the last one
;; and there is none on its left. ;; and there is none on its left.
;; FIXME (ch11ng): Which direction is "left"?
(nextw (elt exwm-workspace--list (+ index (if lastp -1 +1))))) (nextw (elt exwm-workspace--list (+ index (if lastp -1 +1)))))
;; Need to remove the workspace from the list in order for
;; the correct calculation of indexes.
(setq exwm-workspace--list (delete frame exwm-workspace--list))
;; Clients need to be moved to some other workspace before this is being ;; Clients need to be moved to some other workspace before this is being
;; removed. ;; removed.
(dolist (pair exwm--id-buffer-alist) (dolist (pair exwm--id-buffer-alist)
(with-current-buffer (cdr pair) (with-current-buffer (cdr pair)
(when (eq exwm--frame frame) (when (eq exwm--frame frame)
(exwm-workspace-move-window nextw exwm--id)))) (exwm-workspace-move-window nextw exwm--id))))
;; Need to remove the workspace from the list in order for ;; Update the _NET_WM_DESKTOP property of each X window affected.
;; `exwm-workspace-switch' to calculate the right index. (dolist (pair exwm--id-buffer-alist)
(setq exwm-workspace--list (delete frame exwm-workspace--list)) (when (<= (1- index)
(exwm-workspace--position (buffer-local-value 'exwm--frame
(cdr pair))))
(exwm-workspace--set-desktop (car pair))))
;; If the current workspace is deleted, switch to next one.
(when (eq frame exwm-workspace--current) (when (eq frame exwm-workspace--current)
(exwm-workspace-switch nextw))) (exwm-workspace-switch nextw)))
;; Update EWMH properties. ;; Update EWMH properties.
@ -1004,7 +1045,7 @@ before it."
(defun exwm-workspace--update-ewmh-props () (defun exwm-workspace--update-ewmh-props ()
"Update EWMH properties to match the workspace list." "Update EWMH properties to match the workspace list."
(let ((num-workspaces (exwm-workspace--count))) (let ((num-workspaces (exwm-workspace--count)))
;; Set _NET_NUMBER_OF_DESKTOPS (it's currently fixed). ;; Set _NET_NUMBER_OF_DESKTOPS.
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_NUMBER_OF_DESKTOPS (make-instance 'xcb:ewmh:set-_NET_NUMBER_OF_DESKTOPS
:window exwm--root :data num-workspaces)) :window exwm--root :data num-workspaces))
@ -1017,7 +1058,7 @@ before it."
:data (make-vector (* 2 num-workspaces) 0))) :data (make-vector (* 2 num-workspaces) 0)))
;; Update and set _NET_WORKAREA. ;; Update and set _NET_WORKAREA.
(exwm-workspace--update-workareas) (exwm-workspace--update-workareas)
;; Set _NET_VIRTUAL_ROOTS (it's currently fixed.) ;; Set _NET_VIRTUAL_ROOTS.
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ewmh:set-_NET_VIRTUAL_ROOTS (make-instance 'xcb:ewmh:set-_NET_VIRTUAL_ROOTS
:window exwm--root :window exwm--root
@ -1036,7 +1077,8 @@ applied to all subsequently created X frames."
;; ones or insert a new X-specific list. ;; ones or insert a new X-specific list.
(let ((x-parameters (or (assq 'x window-system-default-frame-alist) (let ((x-parameters (or (assq 'x window-system-default-frame-alist)
(let ((new-x-parameters '(x))) (let ((new-x-parameters '(x)))
(push new-x-parameters window-system-default-frame-alist) (push new-x-parameters
window-system-default-frame-alist)
new-x-parameters)))) new-x-parameters))))
(setf (cdr x-parameters) (setf (cdr x-parameters)
(append new-x-parameters (cdr x-parameters))))) (append new-x-parameters (cdr x-parameters)))))
@ -1084,14 +1126,16 @@ applied to all subsequently created X frames."
(frame-parameter exwm-workspace--minibuffer (frame-parameter exwm-workspace--minibuffer
'outer-window-id))) 'outer-window-id)))
(container (xcb:generate-id exwm--connection))) (container (xcb:generate-id exwm--connection)))
(set-frame-parameter exwm-workspace--minibuffer 'exwm-outer-id outer-id) (set-frame-parameter exwm-workspace--minibuffer
'exwm-outer-id outer-id)
(set-frame-parameter exwm-workspace--minibuffer 'exwm-container (set-frame-parameter exwm-workspace--minibuffer 'exwm-container
container) container)
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:CreateWindow (make-instance 'xcb:CreateWindow
:depth 0 :wid container :parent exwm--root :depth 0 :wid container :parent exwm--root
:x -1 :y -1 :width 1 :height 1 :x -1 :y -1 :width 1 :height 1
:border-width 0 :class xcb:WindowClass:CopyFromParent :border-width 0
:class xcb:WindowClass:CopyFromParent
:visual 0 ;CopyFromParent :visual 0 ;CopyFromParent
:value-mask xcb:CW:OverrideRedirect :value-mask xcb:CW:OverrideRedirect
:override-redirect 1)) :override-redirect 1))
@ -1115,13 +1159,13 @@ applied to all subsequently created X frames."
(add-hook 'minibuffer-setup-hook #'exwm-workspace--on-minibuffer-setup) (add-hook 'minibuffer-setup-hook #'exwm-workspace--on-minibuffer-setup)
(add-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit) (add-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit)
(setq exwm-workspace--timer (setq exwm-workspace--timer
(run-with-idle-timer 0 t #'exwm-workspace--on-echo-area-dirty)) (run-with-idle-timer 0 t #'exwm-workspace--on-echo-area-dirty))
(add-hook 'echo-area-clear-hook #'exwm-workspace--on-echo-area-clear) (add-hook 'echo-area-clear-hook #'exwm-workspace--on-echo-area-clear)
;; Recreate frames with the external minibuffer set. ;; Recreate frames with the external minibuffer set.
(setq initial-workspaces (setq initial-workspaces
(mapcar (mapcar
(lambda (_) (lambda (_)
(make-frame `((window-system . x) (make-frame '((window-system . x)
(internal-border-width . 0) (internal-border-width . 0)
(client . nil)))) (client . nil))))
initial-workspaces)) initial-workspaces))
@ -1141,8 +1185,10 @@ applied to all subsequently created X frames."
;; We have to advice `x-create-frame' or every call to it would hang EXWM ;; We have to advice `x-create-frame' or every call to it would hang EXWM
(advice-add 'x-create-frame :around #'exwm-workspace--x-create-frame) (advice-add 'x-create-frame :around #'exwm-workspace--x-create-frame)
;; Make new frames create new workspaces. ;; Make new frames create new workspaces.
(add-hook 'after-make-frame-functions #'exwm-workspace--add-frame-as-workspace) (add-hook 'after-make-frame-functions
(add-hook 'delete-frame-functions #'exwm-workspace--remove-frame-as-workspace) #'exwm-workspace--add-frame-as-workspace)
(add-hook 'delete-frame-functions
#'exwm-workspace--remove-frame-as-workspace)
;; Switch to the first workspace ;; Switch to the first workspace
(exwm-workspace-switch 0 t)) (exwm-workspace-switch 0 t))
@ -1164,8 +1210,10 @@ applied to all subsequently created X frames."
:test #'equal)) :test #'equal))
(remove-hook 'focus-in-hook #'exwm-workspace--on-focus-in) (remove-hook 'focus-in-hook #'exwm-workspace--on-focus-in)
(advice-remove 'x-create-frame #'exwm-workspace--x-create-frame) (advice-remove 'x-create-frame #'exwm-workspace--x-create-frame)
(remove-hook 'after-make-frame-functions #'exwm-workspace--add-frame-as-workspace) (remove-hook 'after-make-frame-functions
(remove-hook 'delete-frame-functions #'exwm-workspace--remove-frame-as-workspace)) #'exwm-workspace--add-frame-as-workspace)
(remove-hook 'delete-frame-functions
#'exwm-workspace--remove-frame-as-workspace))
(defun exwm-workspace--post-init () (defun exwm-workspace--post-init ()
"The second stage in the initialization of the workspace module." "The second stage in the initialization of the workspace module."