; Use `derived-mode-p'.
This commit is contained in:
parent
1364f80f09
commit
bc5f0b3ffa
6 changed files with 27 additions and 26 deletions
|
@ -79,11 +79,11 @@
|
||||||
|
|
||||||
You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
|
You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
|
||||||
(with-current-buffer (window-buffer (selected-window))
|
(with-current-buffer (window-buffer (selected-window))
|
||||||
(if (and (eq major-mode 'exwm-mode)
|
(if (and (derived-mode-p 'exwm-mode)
|
||||||
exwm--floating-frame)
|
exwm--floating-frame)
|
||||||
;; Switch from a floating frame.
|
;; Switch from a floating frame.
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(if (and (eq major-mode 'exwm-mode)
|
(if (and (derived-mode-p 'exwm-mode)
|
||||||
exwm--floating-frame
|
exwm--floating-frame
|
||||||
(eq exwm--frame exwm-workspace--current))
|
(eq exwm--frame exwm-workspace--current))
|
||||||
;; Switch to another floating frame.
|
;; Switch to another floating frame.
|
||||||
|
@ -92,7 +92,7 @@ You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
|
||||||
(or (get-buffer-window buffer exwm-workspace--current)
|
(or (get-buffer-window buffer exwm-workspace--current)
|
||||||
(selected-window))))
|
(selected-window))))
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(when (eq major-mode 'exwm-mode)
|
(when (derived-mode-p 'exwm-mode)
|
||||||
(if (eq exwm--frame exwm-workspace--current)
|
(if (eq exwm--frame exwm-workspace--current)
|
||||||
(when exwm--floating-frame
|
(when exwm--floating-frame
|
||||||
;; Switch to a floating frame on the current workspace.
|
;; Switch to a floating frame on the current workspace.
|
||||||
|
|
|
@ -411,7 +411,7 @@ This is also used by X window containers.")
|
||||||
(defun exwm-floating-hide ()
|
(defun exwm-floating-hide ()
|
||||||
"Hide the current floating X window (which would show again when selected)."
|
"Hide the current floating X window (which would show again when selected)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (and (eq major-mode 'exwm-mode)
|
(when (and (derived-mode-p 'exwm-mode)
|
||||||
exwm--floating-frame)
|
exwm--floating-frame)
|
||||||
(exwm-layout--hide exwm--id)
|
(exwm-layout--hide exwm--id)
|
||||||
(select-frame-set-input-focus exwm-workspace--current)))
|
(select-frame-set-input-focus exwm-workspace--current)))
|
||||||
|
@ -641,7 +641,7 @@ This is also used by X window containers.")
|
||||||
"Move a floating window right by DELTA-X pixels and down by DELTA-Y pixels.
|
"Move a floating window right by DELTA-X pixels and down by DELTA-Y pixels.
|
||||||
|
|
||||||
Both DELTA-X and DELTA-Y default to 1. This command should be bound locally."
|
Both DELTA-X and DELTA-Y default to 1. This command should be bound locally."
|
||||||
(unless (and (eq major-mode 'exwm-mode) exwm--floating-frame)
|
(unless (and (derived-mode-p 'exwm-mode) exwm--floating-frame)
|
||||||
(user-error "[EXWM] `exwm-floating-move' is only for floating X windows"))
|
(user-error "[EXWM] `exwm-floating-move' is only for floating X windows"))
|
||||||
(unless delta-x (setq delta-x 1))
|
(unless delta-x (setq delta-x 1))
|
||||||
(unless delta-y (setq delta-y 1))
|
(unless delta-y (setq delta-y 1))
|
||||||
|
|
|
@ -224,7 +224,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
;; The X window is on another workspace.
|
;; The X window is on another workspace.
|
||||||
(exwm-workspace-switch frame)
|
(exwm-workspace-switch frame)
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(when (and (eq major-mode 'exwm-mode)
|
(when (and (derived-mode-p 'exwm-mode)
|
||||||
(not (eq exwm--frame exwm-workspace--current)))
|
(not (eq exwm--frame exwm-workspace--current)))
|
||||||
;; The floating X window is on another workspace.
|
;; The floating X window is on another workspace.
|
||||||
(exwm-workspace-switch exwm--frame)))))
|
(exwm-workspace-switch exwm--frame)))))
|
||||||
|
@ -295,7 +295,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
"Update input focus."
|
"Update input focus."
|
||||||
(when (window-live-p window)
|
(when (window-live-p window)
|
||||||
(with-current-buffer (window-buffer window)
|
(with-current-buffer (window-buffer window)
|
||||||
(if (eq major-mode 'exwm-mode)
|
(if (derived-mode-p 'exwm-mode)
|
||||||
(if (not (eq exwm--frame exwm-workspace--current))
|
(if (not (eq exwm--frame exwm-workspace--current))
|
||||||
(progn
|
(progn
|
||||||
(set-frame-parameter exwm--frame 'exwm-selected-window window)
|
(set-frame-parameter exwm--frame 'exwm-selected-window window)
|
||||||
|
@ -369,14 +369,14 @@ ARGS are additional arguments to CALLBACK."
|
||||||
(cond ((and (eq button-event exwm-input-move-event)
|
(cond ((and (eq button-event exwm-input-move-event)
|
||||||
;; Either an undecorated or a floating X window.
|
;; Either an undecorated or a floating X window.
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(or (not (eq major-mode 'exwm-mode))
|
(or (not (derived-mode-p 'exwm-mode))
|
||||||
exwm--floating-frame)))
|
exwm--floating-frame)))
|
||||||
;; Move
|
;; Move
|
||||||
(exwm-floating--start-moveresize
|
(exwm-floating--start-moveresize
|
||||||
event xcb:ewmh:_NET_WM_MOVERESIZE_MOVE))
|
event xcb:ewmh:_NET_WM_MOVERESIZE_MOVE))
|
||||||
((and (eq button-event exwm-input-resize-event)
|
((and (eq button-event exwm-input-resize-event)
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(or (not (eq major-mode 'exwm-mode))
|
(or (not (derived-mode-p 'exwm-mode))
|
||||||
exwm--floating-frame)))
|
exwm--floating-frame)))
|
||||||
;; Resize
|
;; Resize
|
||||||
(exwm-floating--start-moveresize event))
|
(exwm-floating--start-moveresize event))
|
||||||
|
@ -389,7 +389,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
;; The X window is on another workspace
|
;; The X window is on another workspace
|
||||||
(exwm-workspace-switch frame)
|
(exwm-workspace-switch frame)
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(when (and (eq major-mode 'exwm-mode)
|
(when (and (derived-mode-p 'exwm-mode)
|
||||||
(not (eq exwm--frame
|
(not (eq exwm--frame
|
||||||
exwm-workspace--current)))
|
exwm-workspace--current)))
|
||||||
;; The floating X window is on another workspace
|
;; The floating X window is on another workspace
|
||||||
|
@ -410,7 +410,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
"Handle KeyPress event."
|
"Handle KeyPress event."
|
||||||
(let ((obj (make-instance 'xcb:KeyPress)))
|
(let ((obj (make-instance 'xcb:KeyPress)))
|
||||||
(xcb:unmarshal obj data)
|
(xcb:unmarshal obj data)
|
||||||
(if (eq major-mode 'exwm-mode)
|
(if (derived-mode-p 'exwm-mode)
|
||||||
(funcall exwm--on-KeyPress obj data)
|
(funcall exwm--on-KeyPress obj data)
|
||||||
(exwm-input--on-KeyPress-char-mode obj))))
|
(exwm-input--on-KeyPress-char-mode obj))))
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ instead."
|
||||||
exwm--connection (car keysym)
|
exwm--connection (car keysym)
|
||||||
(logand state (lognot (cdr keysym)))))
|
(logand state (lognot (cdr keysym)))))
|
||||||
(setq event (exwm-input--mimic-read-event raw-event)))
|
(setq event (exwm-input--mimic-read-event raw-event)))
|
||||||
(if (not (eq major-mode 'exwm-mode))
|
(if (not (derived-mode-p 'exwm-mode))
|
||||||
(exwm-input--unread-event raw-event)
|
(exwm-input--unread-event raw-event)
|
||||||
;; Grab keyboard temporarily.
|
;; Grab keyboard temporarily.
|
||||||
(setq exwm-input--temp-line-mode t)
|
(setq exwm-input--temp-line-mode t)
|
||||||
|
|
|
@ -225,7 +225,7 @@ is t EXWM buffers are never selected by `other-buffer'.
|
||||||
When variable `exwm-layout--other-buffer-exclude-buffers' is a
|
When variable `exwm-layout--other-buffer-exclude-buffers' is a
|
||||||
list of buffers, EXWM buffers belonging to that list are never
|
list of buffers, EXWM buffers belonging to that list are never
|
||||||
selected by `other-buffer'."
|
selected by `other-buffer'."
|
||||||
(or (not (eq 'exwm-mode (buffer-local-value 'major-mode buffer)))
|
(or (not (with-current-buffer buffer (derived-mode-p 'exwm-mode)))
|
||||||
(and (not exwm-layout--other-buffer-exclude-exwm-mode-buffers)
|
(and (not exwm-layout--other-buffer-exclude-exwm-mode-buffers)
|
||||||
(not (memq buffer exwm-layout--other-buffer-exclude-buffers))
|
(not (memq buffer exwm-layout--other-buffer-exclude-buffers))
|
||||||
;; Do not select if already shown in some window.
|
;; Do not select if already shown in some window.
|
||||||
|
@ -268,7 +268,7 @@ selected by `other-buffer'."
|
||||||
;; Refresh a floating frame
|
;; Refresh a floating frame
|
||||||
(let ((window (frame-first-window frame)))
|
(let ((window (frame-first-window frame)))
|
||||||
(with-current-buffer (window-buffer window)
|
(with-current-buffer (window-buffer window)
|
||||||
(when (and (eq major-mode 'exwm-mode)
|
(when (and (derived-mode-p 'exwm-mode)
|
||||||
;; It may be a buffer waiting to be killed.
|
;; It may be a buffer waiting to be killed.
|
||||||
(exwm--id->buffer exwm--id))
|
(exwm--id->buffer exwm--id))
|
||||||
(exwm--log "Refresh floating window #x%x" exwm--id)
|
(exwm--log "Refresh floating window #x%x" exwm--id)
|
||||||
|
@ -279,7 +279,7 @@ selected by `other-buffer'."
|
||||||
(let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
|
(let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
|
||||||
(dolist (window windows)
|
(dolist (window windows)
|
||||||
(with-current-buffer (window-buffer window)
|
(with-current-buffer (window-buffer window)
|
||||||
(when (eq major-mode 'exwm-mode)
|
(when (derived-mode-p 'exwm-mode)
|
||||||
(switch-to-prev-buffer window))))))
|
(switch-to-prev-buffer window))))))
|
||||||
;; Refresh the whole workspace
|
;; Refresh the whole workspace
|
||||||
;; Workspaces other than the active one can also be refreshed (RandR)
|
;; Workspaces other than the active one can also be refreshed (RandR)
|
||||||
|
@ -310,7 +310,8 @@ selected by `other-buffer'."
|
||||||
(car-safe (window-prev-buffers window)))))
|
(car-safe (window-prev-buffers window)))))
|
||||||
(and
|
(and
|
||||||
prev-buffer
|
prev-buffer
|
||||||
(eq 'exwm-mode (buffer-local-value 'major-mode prev-buffer))
|
(with-current-buffer prev-buffer
|
||||||
|
(derived-mode-p 'exwm-mode))
|
||||||
(push prev-buffer covered-buffers))))))))
|
(push prev-buffer covered-buffers))))))))
|
||||||
;; Set some sensible buffer to vacated windows.
|
;; Set some sensible buffer to vacated windows.
|
||||||
(let ((exwm-layout--other-buffer-exclude-buffers covered-buffers))
|
(let ((exwm-layout--other-buffer-exclude-buffers covered-buffers))
|
||||||
|
@ -320,7 +321,7 @@ selected by `other-buffer'."
|
||||||
(let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
|
(let ((exwm-layout--other-buffer-exclude-exwm-mode-buffers t))
|
||||||
(dolist (window (window-list frame 0))
|
(dolist (window (window-list frame 0))
|
||||||
(with-current-buffer (window-buffer window)
|
(with-current-buffer (window-buffer window)
|
||||||
(when (and (eq major-mode 'exwm-mode)
|
(when (and (derived-mode-p 'exwm-mode)
|
||||||
(or exwm--floating-frame (not (eq frame exwm--frame))))
|
(or exwm--floating-frame (not (eq frame exwm--frame))))
|
||||||
(switch-to-prev-buffer window)))))
|
(switch-to-prev-buffer window)))))
|
||||||
(exwm-layout--set-client-list-stacking)
|
(exwm-layout--set-client-list-stacking)
|
||||||
|
@ -359,7 +360,7 @@ windows."
|
||||||
(cond
|
(cond
|
||||||
((zerop delta)) ;no operation
|
((zerop delta)) ;no operation
|
||||||
((window-minibuffer-p)) ;avoid resize minibuffer-window
|
((window-minibuffer-p)) ;avoid resize minibuffer-window
|
||||||
((not (and (eq major-mode 'exwm-mode) exwm--floating-frame))
|
((not (and (derived-mode-p 'exwm-mode) exwm--floating-frame))
|
||||||
;; Resize on tiling layout
|
;; Resize on tiling layout
|
||||||
(unless (= 0 (window-resizable nil delta horizontal nil t)) ;not resizable
|
(unless (= 0 (window-resizable nil delta horizontal nil t)) ;not resizable
|
||||||
(let ((window-resize-pixelwise t))
|
(let ((window-resize-pixelwise t))
|
||||||
|
@ -461,7 +462,7 @@ See also `exwm-layout-enlarge-window'."
|
||||||
(defun exwm-layout-hide-mode-line ()
|
(defun exwm-layout-hide-mode-line ()
|
||||||
"Hide mode-line."
|
"Hide mode-line."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (and (eq major-mode 'exwm-mode) mode-line-format)
|
(when (and (derived-mode-p 'exwm-mode) mode-line-format)
|
||||||
(let (mode-line-height)
|
(let (mode-line-height)
|
||||||
(when exwm--floating-frame
|
(when exwm--floating-frame
|
||||||
(setq mode-line-height (window-mode-line-height
|
(setq mode-line-height (window-mode-line-height
|
||||||
|
@ -479,7 +480,7 @@ See also `exwm-layout-enlarge-window'."
|
||||||
(defun exwm-layout-show-mode-line ()
|
(defun exwm-layout-show-mode-line ()
|
||||||
"Show mode-line."
|
"Show mode-line."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (and (eq major-mode 'exwm-mode) (not mode-line-format))
|
(when (and (derived-mode-p 'exwm-mode) (not mode-line-format))
|
||||||
(setq mode-line-format exwm--mode-line-format
|
(setq mode-line-format exwm--mode-line-format
|
||||||
exwm--mode-line-format nil)
|
exwm--mode-line-format nil)
|
||||||
(if (not exwm--floating-frame)
|
(if (not exwm--floating-frame)
|
||||||
|
@ -496,7 +497,7 @@ See also `exwm-layout-enlarge-window'."
|
||||||
(defun exwm-layout-toggle-mode-line ()
|
(defun exwm-layout-toggle-mode-line ()
|
||||||
"Toggle the display of mode-line."
|
"Toggle the display of mode-line."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (eq major-mode 'exwm-mode)
|
(when (derived-mode-p 'exwm-mode)
|
||||||
(if mode-line-format
|
(if mode-line-format
|
||||||
(exwm-layout-hide-mode-line)
|
(exwm-layout-hide-mode-line)
|
||||||
(exwm-layout-show-mode-line))))
|
(exwm-layout-show-mode-line))))
|
||||||
|
|
|
@ -506,7 +506,7 @@ for internal use only."
|
||||||
(list
|
(list
|
||||||
(cond
|
(cond
|
||||||
((null current-prefix-arg)
|
((null current-prefix-arg)
|
||||||
(unless (and (eq major-mode 'exwm-mode)
|
(unless (and (derived-mode-p 'exwm-mode)
|
||||||
;; The prompt is invisible in fullscreen mode.
|
;; The prompt is invisible in fullscreen mode.
|
||||||
(exwm-layout--fullscreen-p))
|
(exwm-layout--fullscreen-p))
|
||||||
(let ((exwm-workspace--prompt-add-allowed t)
|
(let ((exwm-workspace--prompt-add-allowed t)
|
||||||
|
@ -644,7 +644,7 @@ Passing a workspace frame as the first option is for internal use only."
|
||||||
(defun exwm-workspace-swap (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)
|
(unless (and (derived-mode-p 'exwm-mode)
|
||||||
;; The prompt is invisible in fullscreen mode.
|
;; The prompt is invisible in fullscreen mode.
|
||||||
(exwm-layout--fullscreen-p))
|
(exwm-layout--fullscreen-p))
|
||||||
(let (w1 w2)
|
(let (w1 w2)
|
||||||
|
@ -684,7 +684,7 @@ before it."
|
||||||
(interactive
|
(interactive
|
||||||
(cond
|
(cond
|
||||||
((null current-prefix-arg)
|
((null current-prefix-arg)
|
||||||
(unless (and (eq major-mode 'exwm-mode)
|
(unless (and (derived-mode-p 'exwm-mode)
|
||||||
;; The prompt is invisible in fullscreen mode.
|
;; The prompt is invisible in fullscreen mode.
|
||||||
(exwm-layout--fullscreen-p))
|
(exwm-layout--fullscreen-p))
|
||||||
(list exwm-workspace--current
|
(list exwm-workspace--current
|
||||||
|
@ -921,7 +921,7 @@ INDEX must not exceed the current number of workspaces."
|
||||||
(rename-buffer (concat " " (buffer-name)))))))))))
|
(rename-buffer (concat " " (buffer-name)))))))))))
|
||||||
(when buffer-or-name
|
(when buffer-or-name
|
||||||
(with-current-buffer buffer-or-name
|
(with-current-buffer buffer-or-name
|
||||||
(if (eq major-mode 'exwm-mode)
|
(if (derived-mode-p 'exwm-mode)
|
||||||
;; EXWM buffer.
|
;; EXWM buffer.
|
||||||
(if (eq exwm--frame exwm-workspace--current)
|
(if (eq exwm--frame exwm-workspace--current)
|
||||||
;; On the current workspace.
|
;; On the current workspace.
|
||||||
|
|
2
exwm.el
2
exwm.el
|
@ -108,7 +108,7 @@
|
||||||
"Reset the state of the selected window (non-fullscreen, line-mode, etc)."
|
"Reset the state of the selected window (non-fullscreen, line-mode, etc)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-current-buffer (window-buffer)
|
(with-current-buffer (window-buffer)
|
||||||
(when (eq major-mode 'exwm-mode)
|
(when (derived-mode-p 'exwm-mode)
|
||||||
(when (exwm-layout--fullscreen-p)
|
(when (exwm-layout--fullscreen-p)
|
||||||
(exwm-layout-unset-fullscreen))
|
(exwm-layout-unset-fullscreen))
|
||||||
;; Force refresh
|
;; Force refresh
|
||||||
|
|
Loading…
Reference in a new issue