mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-23 19:47:58 +01:00
Add prefix arguments support for various commands
* exwm-workspace.el (exwm-workspace-switch) (exwm-workspace-switch-create, exwm-workspace-move) (exwm-workspace-move-window): Add prefix arguments support.
This commit is contained in:
parent
e141ee6847
commit
cc974555db
1 changed files with 41 additions and 16 deletions
|
@ -500,12 +500,18 @@ workspace frame as the first option or making use of the rest options are
|
||||||
for internal use only."
|
for internal use only."
|
||||||
(interactive
|
(interactive
|
||||||
(list
|
(list
|
||||||
|
(cond
|
||||||
|
((null current-prefix-arg)
|
||||||
(unless (and (eq major-mode 'exwm-mode)
|
(unless (and (eq major-mode 'exwm-mode)
|
||||||
;; The prompt is invisible in fullscreen mode.
|
;; The prompt is invisible in fullscreen mode.
|
||||||
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
||||||
(let ((exwm-workspace--prompt-add-allowed t)
|
(let ((exwm-workspace--prompt-add-allowed t)
|
||||||
(exwm-workspace--prompt-delete-allowed t))
|
(exwm-workspace--prompt-delete-allowed t))
|
||||||
(exwm-workspace--prompt-for-workspace "Switch to [+/-]: ")))))
|
(exwm-workspace--prompt-for-workspace "Switch to [+/-]: "))))
|
||||||
|
((and (integerp current-prefix-arg)
|
||||||
|
(<= 0 current-prefix-arg (exwm-workspace--count)))
|
||||||
|
current-prefix-arg)
|
||||||
|
(t 0))))
|
||||||
(let* ((frame (exwm-workspace--workspace-from-frame-or-index frame-or-index))
|
(let* ((frame (exwm-workspace--workspace-from-frame-or-index frame-or-index))
|
||||||
(old-frame exwm-workspace--current)
|
(old-frame exwm-workspace--current)
|
||||||
(index (exwm-workspace--position frame))
|
(index (exwm-workspace--position frame))
|
||||||
|
@ -600,7 +606,14 @@ for internal use only."
|
||||||
"Switch to workspace INDEX or creating it first if it does not exist yet.
|
"Switch to workspace INDEX or creating it first if it does not exist yet.
|
||||||
|
|
||||||
Passing a workspace frame as the first option is for internal use only."
|
Passing a workspace frame as the first option is for internal use only."
|
||||||
(interactive)
|
(interactive
|
||||||
|
(list
|
||||||
|
(cond
|
||||||
|
((integerp current-prefix-arg)
|
||||||
|
current-prefix-arg)
|
||||||
|
(t 0))))
|
||||||
|
(unless frame-or-index
|
||||||
|
(setq frame-or-index 0))
|
||||||
(if (or (framep frame-or-index)
|
(if (or (framep frame-or-index)
|
||||||
(< frame-or-index (exwm-workspace--count)))
|
(< frame-or-index (exwm-workspace--count)))
|
||||||
(exwm-workspace-switch frame-or-index)
|
(exwm-workspace-switch frame-or-index)
|
||||||
|
@ -654,12 +667,18 @@ Passing a workspace frame as the first option is for internal use only."
|
||||||
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."
|
||||||
(interactive
|
(interactive
|
||||||
|
(cond
|
||||||
|
((null current-prefix-arg)
|
||||||
(unless (and (eq major-mode 'exwm-mode)
|
(unless (and (eq major-mode 'exwm-mode)
|
||||||
;; The prompt is invisible in fullscreen mode.
|
;; The prompt is invisible in fullscreen mode.
|
||||||
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
(memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
|
||||||
(list exwm-workspace--current
|
(list exwm-workspace--current
|
||||||
(exwm-workspace--position
|
(exwm-workspace--position
|
||||||
(exwm-workspace--prompt-for-workspace "Move workspace to: ")))))
|
(exwm-workspace--prompt-for-workspace "Move workspace to: ")))))
|
||||||
|
((and (integerp current-prefix-arg)
|
||||||
|
(<= 0 current-prefix-arg (exwm-workspace--count)))
|
||||||
|
(list exwm-workspace--current current-prefix-arg))
|
||||||
|
(t (list exwm-workspace--current 0))))
|
||||||
(let ((pos (exwm-workspace--position workspace))
|
(let ((pos (exwm-workspace--position workspace))
|
||||||
flag start end index)
|
flag start end index)
|
||||||
(if (= nth pos)
|
(if (= nth pos)
|
||||||
|
@ -723,9 +742,15 @@ INDEX must not exceed the current number of workspaces."
|
||||||
(defun exwm-workspace-move-window (frame-or-index &optional id)
|
(defun exwm-workspace-move-window (frame-or-index &optional id)
|
||||||
"Move window ID to workspace FRAME-OR-INDEX."
|
"Move window ID to workspace FRAME-OR-INDEX."
|
||||||
(interactive (list
|
(interactive (list
|
||||||
|
(cond
|
||||||
|
((null current-prefix-arg)
|
||||||
(let ((exwm-workspace--prompt-add-allowed t)
|
(let ((exwm-workspace--prompt-add-allowed t)
|
||||||
(exwm-workspace--prompt-delete-allowed t))
|
(exwm-workspace--prompt-delete-allowed t))
|
||||||
(exwm-workspace--prompt-for-workspace "Move to [+/-]: "))))
|
(exwm-workspace--prompt-for-workspace "Move to [+/-]: ")))
|
||||||
|
((and (integerp current-prefix-arg)
|
||||||
|
(<= 0 current-prefix-arg (exwm-workspace--count)))
|
||||||
|
current-prefix-arg)
|
||||||
|
(t 0))))
|
||||||
(let ((frame (exwm-workspace--workspace-from-frame-or-index frame-or-index))
|
(let ((frame (exwm-workspace--workspace-from-frame-or-index frame-or-index))
|
||||||
old-frame container)
|
old-frame container)
|
||||||
(unless id (setq id (exwm--buffer->id (window-buffer))))
|
(unless id (setq id (exwm--buffer->id (window-buffer))))
|
||||||
|
|
Loading…
Reference in a new issue