Adapt dynamic workspace for RandR module
* exwm-workspace.el (exwm-workspace-list-change-hook): New hook run when the workspace list is modified. * exwm-randr.el (exwm-randr--init, exwm-randr--exit): * exwm-workspace.el (exwm-workspace-swap, exwm-workspace-move) (exwm-workspace--add-frame-as-workspace) (exwm-workspace--remove-frame-as-workspace): Use it.
This commit is contained in:
		
							parent
							
								
									4c9afc25b3
								
							
						
					
					
						commit
						2ebeec1257
					
				
					 2 changed files with 15 additions and 6 deletions
				
			
		| 
						 | 
					@ -154,10 +154,12 @@
 | 
				
			||||||
                           ;;            xcb:randr:NotifyMask:OutputProperty
 | 
					                           ;;            xcb:randr:NotifyMask:OutputProperty
 | 
				
			||||||
                           ;;            xcb:randr:NotifyMask:CrtcChange))
 | 
					                           ;;            xcb:randr:NotifyMask:CrtcChange))
 | 
				
			||||||
                           ))
 | 
					                           ))
 | 
				
			||||||
        (xcb:flush exwm--connection)))))
 | 
					        (xcb:flush exwm--connection)
 | 
				
			||||||
 | 
					        (add-hook 'exwm-workspace-list-change-hook #'exwm-randr--refresh)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun exwm-randr--exit ()
 | 
					(defun exwm-randr--exit ()
 | 
				
			||||||
  "Exit the RandR module.")
 | 
					  "Exit the RandR module."
 | 
				
			||||||
 | 
					  (remove-hook 'exwm-workspace-list-change-hook #'exwm-randr--refresh))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun exwm-randr-enable ()
 | 
					(defun exwm-randr-enable ()
 | 
				
			||||||
  "Enable RandR support for EXWM."
 | 
					  "Enable RandR support for EXWM."
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -449,6 +449,9 @@ The optional FORCE option is for internal use only."
 | 
				
			||||||
      (xcb:flush exwm--connection))
 | 
					      (xcb:flush exwm--connection))
 | 
				
			||||||
    (run-hooks 'exwm-workspace-switch-hook)))
 | 
					    (run-hooks 'exwm-workspace-switch-hook)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defvar exwm-workspace-list-change-hook nil
 | 
				
			||||||
 | 
					  "Normal hook run when the workspace list is changed (workspace added,
 | 
				
			||||||
 | 
					deleted, moved, etc).")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;###autoload
 | 
					;;;###autoload
 | 
				
			||||||
(defun exwm-workspace-swap (workspace1 workspace2)
 | 
					(defun exwm-workspace-swap (workspace1 workspace2)
 | 
				
			||||||
| 
						 | 
					@ -476,7 +479,8 @@ The optional FORCE option is for internal use only."
 | 
				
			||||||
        ;; With the current workspace involved, lots of stuffs need refresh.
 | 
					        ;; With the current workspace involved, lots of stuffs need refresh.
 | 
				
			||||||
        (set-frame-parameter exwm-workspace--current 'exwm-selected-window
 | 
					        (set-frame-parameter exwm-workspace--current 'exwm-selected-window
 | 
				
			||||||
                             (selected-window))
 | 
					                             (selected-window))
 | 
				
			||||||
        (exwm-workspace-switch exwm-workspace--current t)))))
 | 
					        (exwm-workspace-switch exwm-workspace--current t))
 | 
				
			||||||
 | 
					      (run-hooks 'exwm-workspace-list-change-hook))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;###autoload
 | 
					;;;###autoload
 | 
				
			||||||
(defun exwm-workspace-move (workspace nth)
 | 
					(defun exwm-workspace-move (workspace nth)
 | 
				
			||||||
| 
						 | 
					@ -511,7 +515,8 @@ before it."
 | 
				
			||||||
        ;; With the current workspace involved, lots of stuffs need refresh.
 | 
					        ;; With the current workspace involved, lots of stuffs need refresh.
 | 
				
			||||||
        (set-frame-parameter exwm-workspace--current 'exwm-selected-window
 | 
					        (set-frame-parameter exwm-workspace--current 'exwm-selected-window
 | 
				
			||||||
                             (selected-window))
 | 
					                             (selected-window))
 | 
				
			||||||
        (exwm-workspace-switch exwm-workspace--current t)))))
 | 
					        (exwm-workspace-switch exwm-workspace--current t))
 | 
				
			||||||
 | 
					      (run-hooks 'exwm-workspace-list-change-hook))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;###autoload
 | 
					;;;###autoload
 | 
				
			||||||
(defun exwm-workspace-add (&optional index)
 | 
					(defun exwm-workspace-add (&optional index)
 | 
				
			||||||
| 
						 | 
					@ -1055,7 +1060,8 @@ INDEX must not exceed the current number of workspaces."
 | 
				
			||||||
                                                 'fullscreen 'fullboth)))
 | 
					                                                 '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)
 | 
				
			||||||
 | 
					    (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."
 | 
				
			||||||
| 
						 | 
					@ -1096,7 +1102,8 @@ INDEX must not exceed the current number of workspaces."
 | 
				
			||||||
    ;; Update EWMH properties.
 | 
					    ;; Update EWMH properties.
 | 
				
			||||||
    (exwm-workspace--update-ewmh-props)
 | 
					    (exwm-workspace--update-ewmh-props)
 | 
				
			||||||
    ;; Update switch history.
 | 
					    ;; Update switch history.
 | 
				
			||||||
    (setq exwm-workspace--switch-history-outdated t))))
 | 
					    (setq exwm-workspace--switch-history-outdated t)
 | 
				
			||||||
 | 
					    (run-hooks 'exwm-workspace-list-change-hook))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(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."
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue