mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-30 14:38:00 +01:00
Fix multi-monitor/fullscreen issues
* exwm-randr.el (exwm-randr--refresh): Correct the _NET_WORKAREA property. Reconfigure the current workspace when screen changes. (exwm-randr--init): Run `exwm-randr-screen-change-hook' to take into account already attached monitor(s), * exwm.el (exwm--on-ClientMessage): Reconfigure the current workspace when it's fullscreen.
This commit is contained in:
parent
0e4055d339
commit
bc80eefe3f
2 changed files with 17 additions and 4 deletions
|
@ -55,7 +55,8 @@
|
||||||
|
|
||||||
(defun exwm-randr--refresh ()
|
(defun exwm-randr--refresh ()
|
||||||
"Refresh workspaces according to the updated RandR info."
|
"Refresh workspaces according to the updated RandR info."
|
||||||
(let (output-name geometry output-plist default-geometry workareas viewports)
|
(let (output-name geometry output-plist default-geometry workareas
|
||||||
|
workarea-offset viewports)
|
||||||
;; Query all outputs
|
;; Query all outputs
|
||||||
(with-slots (config-timestamp outputs)
|
(with-slots (config-timestamp outputs)
|
||||||
(xcb:+request-unchecked+reply exwm--connection
|
(xcb:+request-unchecked+reply exwm--connection
|
||||||
|
@ -84,6 +85,10 @@
|
||||||
(unless default-geometry ;assume the first output as primary
|
(unless default-geometry ;assume the first output as primary
|
||||||
(setq default-geometry geometry)))))))
|
(setq default-geometry geometry)))))))
|
||||||
(cl-assert (<= 2 (length output-plist)))
|
(cl-assert (<= 2 (length output-plist)))
|
||||||
|
(exwm--log "(randr) outputs: %s" output-plist)
|
||||||
|
(setq workarea-offset (if exwm-workspace-minibuffer-position
|
||||||
|
0
|
||||||
|
(window-pixel-height (minibuffer-window))))
|
||||||
(dotimes (i exwm-workspace-number)
|
(dotimes (i exwm-workspace-number)
|
||||||
(let* ((output (plist-get exwm-randr-workspace-output-plist i))
|
(let* ((output (plist-get exwm-randr-workspace-output-plist i))
|
||||||
(geometry (lax-plist-get output-plist output))
|
(geometry (lax-plist-get output-plist output))
|
||||||
|
@ -98,7 +103,9 @@
|
||||||
(frame-parameter frame
|
(frame-parameter frame
|
||||||
'exwm-workspace)
|
'exwm-workspace)
|
||||||
x y width height)
|
x y width height)
|
||||||
(setq workareas (nconc workareas (list x y width height))
|
(setq workareas
|
||||||
|
(nconc workareas (list x y width (- height
|
||||||
|
workarea-offset)))
|
||||||
viewports (nconc viewports (list x y))))))
|
viewports (nconc viewports (list x y))))))
|
||||||
;; Update _NET_WORKAREA
|
;; Update _NET_WORKAREA
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
|
@ -109,7 +116,9 @@
|
||||||
(make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT
|
(make-instance 'xcb:ewmh:set-_NET_DESKTOP_VIEWPORT
|
||||||
:window exwm--root
|
:window exwm--root
|
||||||
:data (vconcat viewports)))
|
:data (vconcat viewports)))
|
||||||
(xcb:flush exwm--connection)))
|
(xcb:flush exwm--connection))
|
||||||
|
;; Force update workspace settings.
|
||||||
|
(exwm-workspace-switch exwm-workspace-current-index t))
|
||||||
|
|
||||||
(defvar exwm-randr-screen-change-hook nil
|
(defvar exwm-randr-screen-change-hook nil
|
||||||
"Normal hook run when screen changes.")
|
"Normal hook run when screen changes.")
|
||||||
|
@ -126,6 +135,8 @@
|
||||||
(if (or (/= major-version 1) (< minor-version 2))
|
(if (or (/= major-version 1) (< minor-version 2))
|
||||||
(error "[EXWM] The server only support RandR version up to %d.%d"
|
(error "[EXWM] The server only support RandR version up to %d.%d"
|
||||||
major-version minor-version)
|
major-version minor-version)
|
||||||
|
;; External monitor(s) may already be connected.
|
||||||
|
(run-hooks 'exwm-randr-screen-change-hook)
|
||||||
(exwm-randr--refresh)
|
(exwm-randr--refresh)
|
||||||
(xcb:+event exwm--connection 'xcb:randr:ScreenChangeNotify
|
(xcb:+event exwm--connection 'xcb:randr:ScreenChangeNotify
|
||||||
(lambda (_data _synthetic)
|
(lambda (_data _synthetic)
|
||||||
|
|
4
exwm.el
4
exwm.el
|
@ -341,7 +341,9 @@
|
||||||
:window id
|
:window id
|
||||||
:data (vector
|
:data (vector
|
||||||
xcb:Atom:_NET_WM_STATE_FULLSCREEN)))
|
xcb:Atom:_NET_WM_STATE_FULLSCREEN)))
|
||||||
(xcb:flush exwm--connection))))
|
(xcb:flush exwm--connection)))
|
||||||
|
;; Force update workspace settings.
|
||||||
|
(exwm-workspace-switch exwm-workspace-current-index t))
|
||||||
(when buffer ;ensure it's managed
|
(when buffer ;ensure it's managed
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
;; _NET_WM_STATE_MODAL
|
;; _NET_WM_STATE_MODAL
|
||||||
|
|
Loading…
Reference in a new issue