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
 | 
				
			||||||
    (unless (and (eq major-mode 'exwm-mode)
 | 
					    (cond
 | 
				
			||||||
                 ;; The prompt is invisible in fullscreen mode.
 | 
					     ((null current-prefix-arg)
 | 
				
			||||||
                 (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
 | 
					      (unless (and (eq major-mode 'exwm-mode)
 | 
				
			||||||
      (let ((exwm-workspace--prompt-add-allowed t)
 | 
					                   ;; The prompt is invisible in fullscreen mode.
 | 
				
			||||||
            (exwm-workspace--prompt-delete-allowed t))
 | 
					                   (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
 | 
				
			||||||
        (exwm-workspace--prompt-for-workspace "Switch to [+/-]: ")))))
 | 
					        (let ((exwm-workspace--prompt-add-allowed t)
 | 
				
			||||||
 | 
					              (exwm-workspace--prompt-delete-allowed t))
 | 
				
			||||||
 | 
					          (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
 | 
				
			||||||
   (unless (and (eq major-mode 'exwm-mode)
 | 
					   (cond
 | 
				
			||||||
                ;; The prompt is invisible in fullscreen mode.
 | 
					    ((null current-prefix-arg)
 | 
				
			||||||
                (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
 | 
					     (unless (and (eq major-mode 'exwm-mode)
 | 
				
			||||||
     (list exwm-workspace--current
 | 
					                  ;; The prompt is invisible in fullscreen mode.
 | 
				
			||||||
           (exwm-workspace--position
 | 
					                  (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
 | 
				
			||||||
            (exwm-workspace--prompt-for-workspace "Move workspace to: ")))))
 | 
					       (list exwm-workspace--current
 | 
				
			||||||
 | 
					             (exwm-workspace--position
 | 
				
			||||||
 | 
					              (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
 | 
				
			||||||
                (let ((exwm-workspace--prompt-add-allowed t)
 | 
					                (cond
 | 
				
			||||||
                      (exwm-workspace--prompt-delete-allowed t))
 | 
					                 ((null current-prefix-arg)
 | 
				
			||||||
                  (exwm-workspace--prompt-for-workspace "Move to [+/-]: "))))
 | 
					                  (let ((exwm-workspace--prompt-add-allowed t)
 | 
				
			||||||
 | 
					                        (exwm-workspace--prompt-delete-allowed t))
 | 
				
			||||||
 | 
					                    (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…
	
	Add table
		Add a link
		
	
		Reference in a new issue