mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-23 13:07:59 +01:00
; Improve debug logs.
This commit is contained in:
parent
fe8274ca7e
commit
58f7916619
8 changed files with 116 additions and 20 deletions
|
@ -83,6 +83,7 @@ This is also used by X window containers.")
|
|||
|
||||
(defun exwm-floating--set-allowed-actions (id tilling)
|
||||
"Set _NET_WM_ALLOWED_ACTIONS."
|
||||
(exwm--log "#x%x" id)
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:ewmh:set-_NET_WM_ALLOWED_ACTIONS
|
||||
:window id
|
||||
|
@ -326,6 +327,7 @@ This is also used by X window containers.")
|
|||
|
||||
(defun exwm-floating--unset-floating (id)
|
||||
"Make window ID non-floating."
|
||||
(exwm--log "#x%x" id)
|
||||
(let ((buffer (exwm--id->buffer id)))
|
||||
(with-current-buffer buffer
|
||||
(when exwm--floating-frame
|
||||
|
@ -400,6 +402,7 @@ This is also used by X window containers.")
|
|||
(cl-defun exwm-floating-toggle-floating ()
|
||||
"Toggle the current window between floating and non-floating states."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(unless (derived-mode-p 'exwm-mode)
|
||||
(cl-return-from exwm-floating-toggle-floating))
|
||||
(with-current-buffer (window-buffer)
|
||||
|
@ -411,6 +414,7 @@ This is also used by X window containers.")
|
|||
(defun exwm-floating-hide ()
|
||||
"Hide the current floating X window (which would show again when selected)."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(when (and (derived-mode-p 'exwm-mode)
|
||||
exwm--floating-frame)
|
||||
(exwm-layout--hide exwm--id)
|
||||
|
@ -418,6 +422,7 @@ This is also used by X window containers.")
|
|||
|
||||
(defun exwm-floating--start-moveresize (id &optional type)
|
||||
"Start move/resize."
|
||||
(exwm--log "#x%x" id)
|
||||
(let ((buffer-or-id (or (exwm--id->buffer id) id))
|
||||
frame container-or-id x y width height cursor)
|
||||
(if (bufferp buffer-or-id)
|
||||
|
@ -581,6 +586,7 @@ This is also used by X window containers.")
|
|||
|
||||
(defun exwm-floating--stop-moveresize (&rest _args)
|
||||
"Stop move/resize."
|
||||
(exwm--log)
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:UngrabPointer :time xcb:Time:CurrentTime))
|
||||
(when exwm-floating--moveresize-calculate
|
||||
|
@ -641,6 +647,7 @@ This is also used by X window containers.")
|
|||
"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."
|
||||
(exwm--log "delta-x: %s, delta-y: %s" delta-x delta-y)
|
||||
(unless (and (derived-mode-p 'exwm-mode) exwm--floating-frame)
|
||||
(user-error "[EXWM] `exwm-floating-move' is only for floating X windows"))
|
||||
(unless delta-x (setq delta-x 1))
|
||||
|
@ -663,6 +670,7 @@ Both DELTA-X and DELTA-Y default to 1. This command should be bound locally."
|
|||
|
||||
(defun exwm-floating--init ()
|
||||
"Initialize floating module."
|
||||
(exwm--log)
|
||||
;; Check border width.
|
||||
(unless (and (integerp exwm-floating-border-width)
|
||||
(> exwm-floating-border-width 0))
|
||||
|
@ -708,7 +716,8 @@ Both DELTA-X and DELTA-Y default to 1. This command should be bound locally."
|
|||
(xcb:cursor:load-cursor exwm--connection "left_side")))
|
||||
|
||||
(defun exwm-floating--exit ()
|
||||
"Exit the floating module.")
|
||||
"Exit the floating module."
|
||||
(exwm--log))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
(with-slots (time root event root-x root-y event-x event-y state) evt
|
||||
(setq buffer (exwm--id->buffer event)
|
||||
window (get-buffer-window buffer t))
|
||||
(exwm--log "EnterNotify: buffer=%s; window=%s" buffer window)
|
||||
(exwm--log "buffer=%s; window=%s" buffer window)
|
||||
(when (and buffer window (not (eq window (selected-window))))
|
||||
(setq frame (window-frame window)
|
||||
frame-xid (frame-parameter frame 'exwm-id))
|
||||
|
@ -257,6 +257,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
(xcb:flush exwm--connection)))))
|
||||
|
||||
(defun exwm-input--on-keysyms-update ()
|
||||
(exwm--log)
|
||||
(let ((exwm-input--global-prefix-keys nil))
|
||||
(exwm-input--update-global-prefix-keys)))
|
||||
|
||||
|
@ -486,6 +487,7 @@ ARGS are additional arguments to CALLBACK."
|
|||
(xcb:flush exwm--connection)))
|
||||
|
||||
(defun exwm-input--set-key (key command)
|
||||
(exwm--log "key: %s, command: %s" key command)
|
||||
(global-set-key key command)
|
||||
(cl-pushnew key exwm-input--global-keys))
|
||||
|
||||
|
@ -567,6 +569,7 @@ instead."
|
|||
|
||||
(defun exwm-input--cache-event (event &optional temp-line-mode)
|
||||
"Cache EVENT."
|
||||
(exwm--log "%s" event)
|
||||
(setq exwm-input--line-mode-cache
|
||||
(vconcat exwm-input--line-mode-cache (vector event)))
|
||||
;; Attempt to translate this key sequence.
|
||||
|
@ -673,6 +676,7 @@ The return value is used as event_mode to release the original
|
|||
button event."
|
||||
(with-current-buffer buffer
|
||||
(let ((read-event (exwm-input--mimic-read-event button-event)))
|
||||
(exwm--log "%s" read-event)
|
||||
(if (and read-event
|
||||
(exwm-input--event-passthrough-p read-event))
|
||||
;; The event should be forwarded to emacs
|
||||
|
@ -687,10 +691,12 @@ button event."
|
|||
"Handle button events in char-mode.
|
||||
The return value is used as event_mode to release the original
|
||||
button event."
|
||||
(exwm--log)
|
||||
xcb:Allow:ReplayPointer)
|
||||
|
||||
(defun exwm-input--update-mode-line (id)
|
||||
"Update the propertized `mode-line-process' for window ID."
|
||||
(exwm--log "#x%x" id)
|
||||
(let (help-echo cmd mode)
|
||||
(cl-case exwm--input-mode
|
||||
(line-mode
|
||||
|
@ -822,6 +828,7 @@ button event."
|
|||
EXWM will prompt for the key to send. This command can be prefixed to send
|
||||
multiple keys."
|
||||
(interactive "p")
|
||||
(exwm--log)
|
||||
(unless (derived-mode-p 'exwm-mode)
|
||||
(cl-return-from exwm-input-send-next-key))
|
||||
(when (> times 12) (setq times 12))
|
||||
|
@ -840,6 +847,7 @@ multiple keys."
|
|||
|
||||
(defun exwm-input--set-simulation-keys (simulation-keys &optional no-refresh)
|
||||
"Set simulation keys."
|
||||
(exwm--log "%s" simulation-keys)
|
||||
(unless no-refresh
|
||||
;; Unbind simulation keys.
|
||||
(let ((hash (buffer-local-value 'exwm-input--simulation-keys
|
||||
|
@ -941,6 +949,7 @@ ends unless it's specifically saved in the Customize interface for
|
|||
(format "Simulate %s as" (key-description original))
|
||||
?\C-g)))
|
||||
(list original simulated)))
|
||||
(exwm--log "original: %s, simulated: %s" original-key simulated-key)
|
||||
(when (and original-key simulated-key)
|
||||
(let ((entry `((,original-key . ,simulated-key))))
|
||||
(setq exwm-input-simulation-keys (append exwm-input-simulation-keys
|
||||
|
@ -949,6 +958,7 @@ ends unless it's specifically saved in the Customize interface for
|
|||
|
||||
(defun exwm-input--unset-simulation-keys ()
|
||||
"Clear simulation keys and key bindings defined."
|
||||
(exwm--log)
|
||||
(when (hash-table-p exwm-input--simulation-keys)
|
||||
(maphash (lambda (key _value)
|
||||
(when (sequencep key)
|
||||
|
@ -961,6 +971,7 @@ ends unless it's specifically saved in the Customize interface for
|
|||
|
||||
SIMULATION-KEYS is an alist of the form (original-key . simulated-key),
|
||||
where both ORIGINAL-KEY and SIMULATED-KEY are key sequences."
|
||||
(exwm--log)
|
||||
(make-local-variable 'exwm-input--simulation-keys)
|
||||
(use-local-map (copy-keymap exwm-mode-map))
|
||||
(let ((exwm-input--local-simulation-keys t))
|
||||
|
@ -970,6 +981,7 @@ where both ORIGINAL-KEY and SIMULATED-KEY are key sequences."
|
|||
(cl-defun exwm-input-send-simulation-key (times)
|
||||
"Fake a key event according to the last input key sequence."
|
||||
(interactive "p")
|
||||
(exwm--log)
|
||||
(unless (derived-mode-p 'exwm-mode)
|
||||
(cl-return-from exwm-input-send-simulation-key))
|
||||
(let ((keys (gethash (this-single-command-keys)
|
||||
|
@ -989,6 +1001,7 @@ where both ORIGINAL-KEY and SIMULATED-KEY are key sequences."
|
|||
|
||||
(defun exwm-input--init ()
|
||||
"Initialize the keyboard module."
|
||||
(exwm--log)
|
||||
;; Refresh keyboard mapping
|
||||
(xcb:keysyms:init exwm--connection #'exwm-input--on-keysyms-update)
|
||||
;; Create the X window and intern the atom used to fetch timestamp.
|
||||
|
@ -1046,10 +1059,12 @@ where both ORIGINAL-KEY and SIMULATED-KEY are key sequences."
|
|||
|
||||
(defun exwm-input--post-init ()
|
||||
"The second stage in the initialization of the input module."
|
||||
(exwm--log)
|
||||
(exwm-input--update-global-prefix-keys))
|
||||
|
||||
(defun exwm-input--exit ()
|
||||
"Exit the input module."
|
||||
(exwm--log)
|
||||
(exwm-input--unset-simulation-keys)
|
||||
(remove-hook 'pre-command-hook #'exwm-input--on-pre-command)
|
||||
(remove-hook 'post-command-hook #'exwm-input--on-post-command)
|
||||
|
|
|
@ -479,6 +479,7 @@ windows."
|
|||
|
||||
See also `exwm-layout-enlarge-window'."
|
||||
(interactive "p")
|
||||
(exwm--log "%s" delta)
|
||||
(exwm-layout-enlarge-window delta t))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -487,6 +488,7 @@ See also `exwm-layout-enlarge-window'."
|
|||
|
||||
See also `exwm-layout-enlarge-window'."
|
||||
(interactive "p")
|
||||
(exwm--log "%s" delta)
|
||||
(exwm-layout-enlarge-window (- delta)))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -495,6 +497,7 @@ See also `exwm-layout-enlarge-window'."
|
|||
|
||||
See also `exwm-layout-enlarge-window'."
|
||||
(interactive "p")
|
||||
(exwm--log "%s" delta)
|
||||
(exwm-layout-enlarge-window (- delta) t))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -565,7 +565,7 @@ Would you like to kill it? "
|
|||
(with-slots (window x y width height
|
||||
border-width sibling stack-mode value-mask)
|
||||
obj
|
||||
(exwm--log "ConfigureRequest from #x%x (#x%x) @%dx%d%+d%+d; \
|
||||
(exwm--log "#x%x (#x%x) @%dx%d%+d%+d; \
|
||||
border-width: %d; sibling: #x%x; stack-mode: %d"
|
||||
window value-mask width height x y
|
||||
border-width sibling stack-mode)
|
||||
|
@ -663,7 +663,7 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
|||
(progn (xcb:+request exwm--connection
|
||||
(make-instance 'xcb:MapWindow :window window))
|
||||
(xcb:flush exwm--connection))
|
||||
(exwm--log "MapRequest from #x%x" window)
|
||||
(exwm--log "#x%x" window)
|
||||
(exwm-manage--manage-window window))))))
|
||||
|
||||
(defun exwm-manage--on-UnmapNotify (data _synthetic)
|
||||
|
@ -705,7 +705,7 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
|||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:DestroyNotify)))
|
||||
(xcb:unmarshal obj data)
|
||||
(exwm--log "DestroyNotify from #x%x" (slot-value obj 'window))
|
||||
(exwm--log "#x%x" (slot-value obj 'window))
|
||||
(exwm-manage--unmanage-window (slot-value obj 'window)))))
|
||||
|
||||
(defun exwm-manage--init ()
|
||||
|
@ -732,6 +732,7 @@ border-width: %d; sibling: #x%x; stack-mode: %d"
|
|||
|
||||
(defun exwm-manage--exit ()
|
||||
"Exit the manage module."
|
||||
(exwm--log)
|
||||
(dolist (pair exwm--id-buffer-alist)
|
||||
(exwm-manage--unmanage-window (car pair) 'quit))
|
||||
(remove-hook 'after-make-frame-functions #'exwm-manage--add-frame)
|
||||
|
|
|
@ -123,12 +123,12 @@ corresponding monitors whenever the monitors are active.
|
|||
:width width
|
||||
:height height)
|
||||
monitor-plist (plist-put monitor-plist monitor-name geometry))
|
||||
(exwm--log "%s: %sx%s+%s+%s" monitor-name x y width height)
|
||||
;; Save primary monitor when available (fallback to the first one).
|
||||
(when (or (/= 0 primary)
|
||||
(not primary-monitor))
|
||||
(setq primary-monitor monitor-name)))))
|
||||
(exwm--log "Primary monitor: %s" primary-monitor)
|
||||
(exwm--log "Monitors: %s" monitor-plist)
|
||||
(list primary-monitor monitor-plist)))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -233,6 +233,7 @@ Refresh when any RandR 1.5 monitor changes."
|
|||
|
||||
(defun exwm-randr--init ()
|
||||
"Initialize RandR extension and EXWM RandR module."
|
||||
(exwm--log)
|
||||
(if (= 0 (slot-value (xcb:get-extension-data exwm--connection 'xcb:randr)
|
||||
'present))
|
||||
(error "[EXWM] RandR extension is not supported by the server")
|
||||
|
@ -270,10 +271,12 @@ Refresh when any RandR 1.5 monitor changes."
|
|||
|
||||
(defun exwm-randr--exit ()
|
||||
"Exit the RandR module."
|
||||
(exwm--log)
|
||||
(remove-hook 'exwm-workspace-list-change-hook #'exwm-randr-refresh))
|
||||
|
||||
(defun exwm-randr-enable ()
|
||||
"Enable RandR support for EXWM."
|
||||
(exwm--log)
|
||||
(add-hook 'exwm-init-hook #'exwm-randr--init)
|
||||
(add-hook 'exwm-exit-hook #'exwm-randr--exit))
|
||||
|
||||
|
|
|
@ -86,13 +86,13 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--embed (icon)
|
||||
"Embed an icon."
|
||||
(exwm--log "(System Tray) Try to embed #x%x" icon)
|
||||
(exwm--log "Try to embed #x%x" icon)
|
||||
(let ((info (xcb:+request-unchecked+reply exwm-systemtray--connection
|
||||
(make-instance 'xcb:xembed:get-_XEMBED_INFO
|
||||
:window icon)))
|
||||
width* height* visible)
|
||||
(when info
|
||||
(exwm--log "(System Tray) Embed #x%x" icon)
|
||||
(exwm--log "Embed #x%x" icon)
|
||||
(with-slots (width height)
|
||||
(xcb:+request-unchecked+reply exwm-systemtray--connection
|
||||
(make-instance 'xcb:GetGeometry :drawable icon))
|
||||
|
@ -101,7 +101,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
(when (< width* exwm-systemtray--icon-min-size)
|
||||
(setq width* exwm-systemtray--icon-min-size
|
||||
height* (round (* height (/ (float width*) width)))))
|
||||
(exwm--log "(System Tray) Resize from %dx%d to %dx%d"
|
||||
(exwm--log "Resize from %dx%d to %dx%d"
|
||||
width height width* height*))
|
||||
;; Add this icon to save-set.
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
|
@ -151,7 +151,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
;; Default to visible.
|
||||
(setq visible t))
|
||||
(when visible
|
||||
(exwm--log "(System Tray) Map the window")
|
||||
(exwm--log "Map the window")
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
(make-instance 'xcb:MapWindow :window icon)))
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
|
@ -175,7 +175,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--unembed (icon)
|
||||
"Unembed an icon."
|
||||
(exwm--log "(System Tray) Unembed #x%x" icon)
|
||||
(exwm--log "Unembed #x%x" icon)
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
(make-instance 'xcb:UnmapWindow :window icon))
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
|
@ -189,6 +189,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--refresh ()
|
||||
"Refresh the system tray."
|
||||
(exwm--log)
|
||||
;; Make sure to redraw the embedder.
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
(make-instance 'xcb:UnmapWindow
|
||||
|
@ -222,6 +223,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--on-DestroyNotify (data _synthetic)
|
||||
"Unembed icons on DestroyNotify."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:DestroyNotify)))
|
||||
(xcb:unmarshal obj data)
|
||||
(with-slots (window) obj
|
||||
|
@ -230,6 +232,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--on-ReparentNotify (data _synthetic)
|
||||
"Unembed icons on ReparentNotify."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:ReparentNotify)))
|
||||
(xcb:unmarshal obj data)
|
||||
(with-slots (window parent) obj
|
||||
|
@ -239,6 +242,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--on-ResizeRequest (data _synthetic)
|
||||
"Resize the tray icon on ResizeRequest."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:ResizeRequest))
|
||||
attr)
|
||||
(xcb:unmarshal obj data)
|
||||
|
@ -266,6 +270,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--on-PropertyNotify (data _synthetic)
|
||||
"Map/Unmap the tray icon on PropertyNotify."
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:PropertyNotify))
|
||||
attr info visible)
|
||||
(xcb:unmarshal obj data)
|
||||
|
@ -279,7 +284,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
(when info
|
||||
(setq visible (/= 0 (logand (slot-value info 'flags)
|
||||
xcb:xembed:MAPPED)))
|
||||
(exwm--log "(System Tray) #x%x visible? %s" window visible)
|
||||
(exwm--log "#x%x visible? %s" window visible)
|
||||
(if visible
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
(make-instance 'xcb:MapWindow :window window))
|
||||
|
@ -297,6 +302,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
(when (eq type xcb:Atom:_NET_SYSTEM_TRAY_OPCODE)
|
||||
(setq data32 (slot-value data 'data32)
|
||||
opcode (elt data32 1))
|
||||
(exwm--log "opcode: %s" opcode)
|
||||
(cond ((= opcode xcb:systemtray:opcode:REQUEST-DOCK)
|
||||
(unless (assoc (elt data32 2) exwm-systemtray--list)
|
||||
(exwm-systemtray--embed (elt data32 2))))
|
||||
|
@ -304,10 +310,11 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
((or (= opcode xcb:systemtray:opcode:BEGIN-MESSAGE)
|
||||
(= opcode xcb:systemtray:opcode:CANCEL-MESSAGE)))
|
||||
(t
|
||||
(exwm--log "(System Tray) Unknown opcode message: %s" obj)))))))
|
||||
(exwm--log "Unknown opcode message: %s" obj)))))))
|
||||
|
||||
(defun exwm-systemtray--on-KeyPress (data _synthetic)
|
||||
"Forward all KeyPress events to Emacs frame."
|
||||
(exwm--log)
|
||||
;; This function is only executed when there's no autohide minibuffer,
|
||||
;; a workspace frame has the input focus and the pointer is over a
|
||||
;; tray icon.
|
||||
|
@ -325,6 +332,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--on-workspace-switch ()
|
||||
"Reparent/Refresh the system tray in `exwm-workspace-switch-hook'."
|
||||
(exwm--log)
|
||||
(unless (exwm-workspace--minibuffer-own-frame-p)
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
(make-instance 'xcb:ReparentWindow
|
||||
|
@ -339,6 +347,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--on-randr-refresh ()
|
||||
"Reposition/Refresh the system tray in `exwm-randr-refresh-hook'."
|
||||
(exwm--log)
|
||||
(unless (exwm-workspace--minibuffer-own-frame-p)
|
||||
(xcb:+request exwm-systemtray--connection
|
||||
(make-instance 'xcb:ConfigureWindow
|
||||
|
@ -353,6 +362,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(cl-defun exwm-systemtray--init ()
|
||||
"Initialize system tray module."
|
||||
(exwm--log)
|
||||
(cl-assert (not exwm-systemtray--connection))
|
||||
(cl-assert (not exwm-systemtray--list))
|
||||
(cl-assert (not exwm-systemtray--selection-owner-window))
|
||||
|
@ -493,6 +503,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray--exit ()
|
||||
"Exit the systemtray module."
|
||||
(exwm--log)
|
||||
(when exwm-systemtray--connection
|
||||
;; Hide & reparent out the embedder before disconnection to prevent
|
||||
;; embedded icons from being reparented to an Emacs frame (which is the
|
||||
|
@ -521,6 +532,7 @@ You shall use the default value if using auto-hide minibuffer."
|
|||
|
||||
(defun exwm-systemtray-enable ()
|
||||
"Enable system tray support for EXWM."
|
||||
(exwm--log)
|
||||
(add-hook 'exwm-init-hook #'exwm-systemtray--init)
|
||||
(add-hook 'exwm-exit-hook #'exwm-systemtray--exit))
|
||||
|
||||
|
|
|
@ -307,7 +307,8 @@ NIL if FRAME is not a workspace"
|
|||
;; Make left/top processed first.
|
||||
(push struts* exwm-workspace--struts)
|
||||
(setq exwm-workspace--struts
|
||||
(append exwm-workspace--struts (list struts*))))))))))
|
||||
(append exwm-workspace--struts (list struts*))))))))
|
||||
(exwm--log "%s" exwm-workspace--struts)))
|
||||
|
||||
(defun exwm-workspace--update-workareas ()
|
||||
"Update `exwm-workspace--workareas'."
|
||||
|
@ -371,6 +372,7 @@ NIL if FRAME is not a workspace"
|
|||
;; Save the result.
|
||||
(setq exwm-workspace--workareas workareas)
|
||||
(xcb:flush exwm--connection))
|
||||
(exwm--log "%s" exwm-workspace--workareas)
|
||||
(run-hooks 'exwm-workspace--update-workareas-hook))
|
||||
|
||||
(defun exwm-workspace--set-active (frame active)
|
||||
|
@ -451,7 +453,8 @@ NIL if FRAME is not a workspace"
|
|||
:window (frame-parameter exwm-workspace--minibuffer
|
||||
'exwm-outer-id)
|
||||
:value-mask xcb:ConfigWindow:Width
|
||||
:width width))))
|
||||
:width width))
|
||||
(exwm--log "y: %s, width: %s" y width)))
|
||||
|
||||
(defun exwm-workspace--switch-map-nth-prefix (&optional prefix-digits)
|
||||
"Allow selecting a workspace by number.
|
||||
|
@ -647,6 +650,7 @@ Passing a workspace frame as the first option is for internal use only."
|
|||
(t 0))))
|
||||
(unless frame-or-index
|
||||
(setq frame-or-index 0))
|
||||
(exwm--log "%s" frame-or-index)
|
||||
(if (or (framep frame-or-index)
|
||||
(< frame-or-index (exwm-workspace--count)))
|
||||
(exwm-workspace-switch frame-or-index)
|
||||
|
@ -747,6 +751,7 @@ before it."
|
|||
|
||||
INDEX must not exceed the current number of workspaces."
|
||||
(interactive)
|
||||
(exwm--log "%s" index)
|
||||
(if (and index
|
||||
;; No need to move if it's the last one.
|
||||
(< index (exwm-workspace--count)))
|
||||
|
@ -757,6 +762,7 @@ INDEX must not exceed the current number of workspaces."
|
|||
(defun exwm-workspace-delete (&optional frame-or-index)
|
||||
"Delete the workspace FRAME-OR-INDEX."
|
||||
(interactive)
|
||||
(exwm--log "%s" frame-or-index)
|
||||
(when (< 1 (exwm-workspace--count))
|
||||
(delete-frame
|
||||
(if frame-or-index
|
||||
|
@ -765,6 +771,7 @@ INDEX must not exceed the current number of workspaces."
|
|||
|
||||
(defun exwm-workspace--set-desktop (id)
|
||||
"Set _NET_WM_DESKTOP for X window ID."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(let ((desktop (exwm-workspace--position exwm--frame)))
|
||||
(setq exwm--desktop desktop)
|
||||
|
@ -789,6 +796,7 @@ INDEX must not exceed the current number of workspaces."
|
|||
(let ((frame (exwm-workspace--workspace-from-frame-or-index frame-or-index))
|
||||
old-frame container)
|
||||
(unless id (setq id (exwm--buffer->id (window-buffer))))
|
||||
(exwm--log "Moving #x%x to %s" id frame-or-index)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (eq exwm--frame frame)
|
||||
(unless exwm-workspace-show-all-buffers
|
||||
|
@ -984,6 +992,7 @@ INDEX must not exceed the current number of workspaces."
|
|||
|
||||
(defun exwm-workspace--x-create-frame (orig-fun params)
|
||||
"Set override-redirect on the frame created by `x-create-frame'."
|
||||
(exwm--log)
|
||||
(let ((frame (funcall orig-fun params)))
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:ChangeWindowAttributes
|
||||
|
@ -1005,6 +1014,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(defun exwm-workspace-attach-minibuffer ()
|
||||
"Attach the minibuffer so that it always shows."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(when (and (exwm-workspace--minibuffer-own-frame-p)
|
||||
(not (exwm-workspace--minibuffer-attached-p)))
|
||||
;; Reset the frame size.
|
||||
|
@ -1029,6 +1039,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(defun exwm-workspace-detach-minibuffer ()
|
||||
"Detach the minibuffer so that it automatically hides."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(when (and (exwm-workspace--minibuffer-own-frame-p)
|
||||
(exwm-workspace--minibuffer-attached-p))
|
||||
(setq exwm-workspace--attached-minibuffer-height 0)
|
||||
|
@ -1046,6 +1057,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(defun exwm-workspace-toggle-minibuffer ()
|
||||
"Attach the minibuffer if it's detached, or detach it if it's attached."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(when (exwm-workspace--minibuffer-own-frame-p)
|
||||
(if (exwm-workspace--minibuffer-attached-p)
|
||||
(exwm-workspace-detach-minibuffer)
|
||||
|
@ -1071,6 +1083,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(when (and (integerp max-mini-window-height)
|
||||
(> height max-mini-window-height))
|
||||
(setq height max-mini-window-height))
|
||||
(exwm--log "%s" height)
|
||||
(set-frame-height exwm-workspace--minibuffer height))))
|
||||
|
||||
(defun exwm-workspace--on-ConfigureNotify (data _synthetic)
|
||||
|
@ -1081,6 +1094,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
(with-slots (window height) obj
|
||||
(when (eq (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id)
|
||||
window)
|
||||
(exwm--log)
|
||||
(when (and (floatp max-mini-window-height)
|
||||
(> height (* max-mini-window-height
|
||||
(exwm-workspace--current-height))))
|
||||
|
@ -1122,6 +1136,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
|
||||
(defun exwm-workspace--show-minibuffer ()
|
||||
"Show the minibuffer frame."
|
||||
(exwm--log)
|
||||
;; Cancel pending timer.
|
||||
(when exwm-workspace--display-echo-area-timer
|
||||
(cancel-timer exwm-workspace--display-echo-area-timer)
|
||||
|
@ -1143,6 +1158,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
|
||||
(defun exwm-workspace--hide-minibuffer ()
|
||||
"Hide the minibuffer frame."
|
||||
(exwm--log)
|
||||
;; Hide the minibuffer frame.
|
||||
(if (exwm-workspace--minibuffer-attached-p)
|
||||
(xcb:+request exwm--connection
|
||||
|
@ -1164,6 +1180,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
|
||||
(defun exwm-workspace--on-minibuffer-setup ()
|
||||
"Run in minibuffer-setup-hook to show the minibuffer and its container."
|
||||
(exwm--log)
|
||||
(when (and (= 1 (minibuffer-depth))
|
||||
(not (exwm-workspace--client-p)))
|
||||
(add-hook 'post-command-hook #'exwm-workspace--update-minibuffer-height)
|
||||
|
@ -1185,6 +1202,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
|
||||
(defun exwm-workspace--on-minibuffer-exit ()
|
||||
"Run in minibuffer-exit-hook to hide the minibuffer container."
|
||||
(exwm--log)
|
||||
(when (and (= 1 (minibuffer-depth))
|
||||
(not (exwm-workspace--client-p)))
|
||||
(remove-hook 'post-command-hook #'exwm-workspace--update-minibuffer-height)
|
||||
|
@ -1216,6 +1234,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
|
||||
(defun exwm-workspace--set-desktop-geometry ()
|
||||
"Set _NET_DESKTOP_GEOMETRY."
|
||||
(exwm--log)
|
||||
;; We don't support large desktop so it's the same with screen size.
|
||||
(xcb:+request exwm--connection
|
||||
(make-instance 'xcb:ewmh:set-_NET_DESKTOP_GEOMETRY
|
||||
|
@ -1225,6 +1244,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
|
||||
(defun exwm-workspace--add-frame-as-workspace (frame)
|
||||
"Configure frame FRAME to be treated as a workspace."
|
||||
(exwm--log "%s" frame)
|
||||
(setq exwm-workspace--list (nconc exwm-workspace--list (list frame)))
|
||||
(let ((outer-id (string-to-number (frame-parameter frame
|
||||
'outer-window-id)))
|
||||
|
@ -1389,6 +1409,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
|
||||
(defun exwm-workspace--update-ewmh-props ()
|
||||
"Update EWMH properties to match the workspace list."
|
||||
(exwm--log)
|
||||
(let ((num-workspaces (exwm-workspace--count)))
|
||||
;; Avoid setting 0 desktops.
|
||||
(when (= 0 num-workspaces)
|
||||
|
@ -1408,6 +1429,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first."
|
|||
NEW-X-PARAMETERS is an alist of frame parameters, merged into current
|
||||
`window-system-default-frame-alist' for the X Window System. The parameters are
|
||||
applied to all subsequently created X frames."
|
||||
(exwm--log)
|
||||
;; The parameters are modified in place; take current
|
||||
;; ones or insert a new X-specific list.
|
||||
(let ((x-parameters (or (assq 'x window-system-default-frame-alist)
|
||||
|
@ -1427,6 +1449,7 @@ applied to all subsequently created X frames."
|
|||
(interactive "e"))
|
||||
|
||||
(defun exwm-workspace--init-minibuffer-frame ()
|
||||
(exwm--log)
|
||||
;; Initialize workspaces without minibuffers.
|
||||
(setq exwm-workspace--minibuffer
|
||||
(make-frame '((window-system . x) (minibuffer . only)
|
||||
|
@ -1497,6 +1520,7 @@ applied to all subsequently created X frames."
|
|||
:test #'equal))
|
||||
|
||||
(defun exwm-workspace--exit-minibuffer-frame ()
|
||||
(exwm--log)
|
||||
;; Only on minibuffer-frame.
|
||||
(remove-hook 'minibuffer-setup-hook #'exwm-workspace--on-minibuffer-setup)
|
||||
(remove-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit)
|
||||
|
@ -1520,6 +1544,7 @@ applied to all subsequently created X frames."
|
|||
|
||||
(defun exwm-workspace--init ()
|
||||
"Initialize workspace module."
|
||||
(exwm--log)
|
||||
;; Prevent unexpected exit
|
||||
(setq exwm-workspace--fullscreen-frame-count 0)
|
||||
(exwm-workspace--modify-all-x-frames-parameters
|
||||
|
@ -1584,6 +1609,7 @@ applied to all subsequently created X frames."
|
|||
|
||||
(defun exwm-workspace--exit ()
|
||||
"Exit the workspace module."
|
||||
(exwm--log)
|
||||
(when (exwm-workspace--minibuffer-own-frame-p)
|
||||
(exwm-workspace--exit-minibuffer-frame))
|
||||
(advice-remove 'x-create-frame #'exwm-workspace--x-create-frame)
|
||||
|
@ -1618,6 +1644,7 @@ applied to all subsequently created X frames."
|
|||
|
||||
(defun exwm-workspace--post-init ()
|
||||
"The second stage in the initialization of the workspace module."
|
||||
(exwm--log)
|
||||
(when exwm-workspace--client
|
||||
;; Reset the 'fullscreen' frame parameter to make emacsclinet frames
|
||||
;; fullscreen (even without the RandR module enabled).
|
||||
|
|
36
exwm.el
36
exwm.el
|
@ -107,6 +107,7 @@
|
|||
(defun exwm-reset ()
|
||||
"Reset the state of the selected window (non-fullscreen, line-mode, etc)."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(with-current-buffer (window-buffer)
|
||||
(when (derived-mode-p 'exwm-mode)
|
||||
(when (exwm-layout--fullscreen-p)
|
||||
|
@ -119,6 +120,7 @@
|
|||
(defun exwm-restart ()
|
||||
"Restart EXWM."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(when (exwm--confirm-kill-emacs "[EXWM] Restart? " 'no-check)
|
||||
(let* ((attr (process-attributes (emacs-pid)))
|
||||
(args (cdr (assq 'args attr)))
|
||||
|
@ -146,6 +148,7 @@
|
|||
|
||||
(defun exwm--update-desktop (xwin)
|
||||
"Update _NET_WM_DESKTOP."
|
||||
(exwm--log "#x%x" xwin)
|
||||
(with-current-buffer (exwm--id->buffer xwin)
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
(make-instance 'xcb:ewmh:get-_NET_WM_DESKTOP
|
||||
|
@ -172,6 +175,7 @@
|
|||
|
||||
(defun exwm--update-window-type (id &optional force)
|
||||
"Update _NET_WM_WINDOW_TYPE."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm-window-type (not force))
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
|
@ -182,6 +186,7 @@
|
|||
|
||||
(defun exwm--update-class (id &optional force)
|
||||
"Update WM_CLASS."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm-instance-name exwm-class-name (not force))
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
|
@ -194,6 +199,7 @@
|
|||
|
||||
(defun exwm--update-utf8-title (id &optional force)
|
||||
"Update _NET_WM_NAME."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(when (or force (not exwm-title))
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
|
@ -206,6 +212,7 @@
|
|||
|
||||
(defun exwm--update-ctext-title (id &optional force)
|
||||
"Update WM_NAME."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (or exwm--title-is-utf8
|
||||
(and exwm-title (not force)))
|
||||
|
@ -218,11 +225,13 @@
|
|||
|
||||
(defun exwm--update-title (id)
|
||||
"Update _NET_WM_NAME or WM_NAME."
|
||||
(exwm--log "#x%x" id)
|
||||
(exwm--update-utf8-title id)
|
||||
(exwm--update-ctext-title id))
|
||||
|
||||
(defun exwm--update-transient-for (id &optional force)
|
||||
"Update WM_TRANSIENT_FOR."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm-transient-for (not force))
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
|
@ -233,6 +242,7 @@
|
|||
|
||||
(defun exwm--update-normal-hints (id &optional force)
|
||||
"Update WM_NORMAL_HINTS."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and (not force)
|
||||
(or exwm--normal-hints-x exwm--normal-hints-y
|
||||
|
@ -280,6 +290,7 @@
|
|||
|
||||
(defun exwm--update-hints (id &optional force)
|
||||
"Update WM_HINTS."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and (not force) exwm--hints-input exwm--hints-urgency)
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
|
@ -301,6 +312,7 @@
|
|||
|
||||
(defun exwm--update-protocols (id &optional force)
|
||||
"Update WM_PROTOCOLS."
|
||||
(exwm--log "#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(unless (and exwm--protocols (not force))
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
|
@ -311,6 +323,7 @@
|
|||
|
||||
(defun exwm--update-struts-legacy (id)
|
||||
"Update _NET_WM_STRUT."
|
||||
(exwm--log "#x%x" id)
|
||||
(let ((pair (assq id exwm-workspace--id-struts-alist))
|
||||
reply struts)
|
||||
(unless (and pair (< 4 (length (cdr pair))))
|
||||
|
@ -331,6 +344,7 @@
|
|||
|
||||
(defun exwm--update-struts-partial (id)
|
||||
"Update _NET_WM_STRUT_PARTIAL."
|
||||
(exwm--log "#x%x" id)
|
||||
(let ((reply (xcb:+request-unchecked+reply exwm--connection
|
||||
(make-instance 'xcb:ewmh:get-_NET_WM_STRUT_PARTIAL
|
||||
:window id)))
|
||||
|
@ -350,6 +364,7 @@
|
|||
|
||||
(defun exwm--update-struts (id)
|
||||
"Update _NET_WM_STRUT_PARTIAL or _NET_WM_STRUT."
|
||||
(exwm--log "#x%x" id)
|
||||
(exwm--update-struts-partial id)
|
||||
(exwm--update-struts-legacy id))
|
||||
|
||||
|
@ -386,9 +401,10 @@
|
|||
((= atom xcb:Atom:WM_PROTOCOLS)
|
||||
(exwm--update-protocols id t))
|
||||
((= atom xcb:Atom:_NET_WM_USER_TIME)) ;ignored
|
||||
(t (exwm--log "Unhandled PropertyNotify: %s(%d)"
|
||||
(x-get-atom-name atom exwm-workspace--current)
|
||||
atom)))))))
|
||||
(t
|
||||
(exwm--log "Unhandled: %s(%d)"
|
||||
(x-get-atom-name atom exwm-workspace--current)
|
||||
atom)))))))
|
||||
|
||||
(defun exwm--on-ClientMessage (raw-data _synthetic)
|
||||
"Handle ClientMessage event."
|
||||
|
@ -534,11 +550,13 @@
|
|||
(= (elt data 0) xcb:icccm:WM_STATE:IconicState))
|
||||
(with-current-buffer buffer
|
||||
(bury-buffer)))))
|
||||
(t (exwm--log "Unhandled client message: %s" obj)))))
|
||||
(t
|
||||
(exwm--log "Unhandled: %s(%d)"
|
||||
(x-get-atom-name type exwm-workspace--current) type)))))
|
||||
|
||||
(defun exwm--on-SelectionClear (data _synthetic)
|
||||
"Handle SelectionClear events."
|
||||
(exwm--log "SelectionClear")
|
||||
(exwm--log)
|
||||
(let ((obj (make-instance 'xcb:SelectionClear))
|
||||
owner selection)
|
||||
(xcb:unmarshal obj data)
|
||||
|
@ -550,6 +568,7 @@
|
|||
|
||||
(defun exwm--init-icccm-ewmh ()
|
||||
"Initialize ICCCM/EWMH support."
|
||||
(exwm--log)
|
||||
;; Handle PropertyNotify event
|
||||
(xcb:+event exwm--connection 'xcb:PropertyNotify #'exwm--on-PropertyNotify)
|
||||
;; Handle relevant client messages
|
||||
|
@ -693,6 +712,7 @@
|
|||
|
||||
REPLACE specifies what to do in case there already is a window
|
||||
manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
||||
(exwm--log "%s" replace)
|
||||
(with-slots (owner)
|
||||
(xcb:+request-unchecked+reply exwm--connection
|
||||
(make-instance 'xcb:GetSelectionOwner
|
||||
|
@ -767,6 +787,7 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
(cl-defun exwm-init (&optional frame)
|
||||
"Initialize EXWM."
|
||||
(interactive)
|
||||
(exwm--log "%s" frame)
|
||||
(if frame
|
||||
;; The frame might not be selected if it's created by emacslicnet.
|
||||
(select-frame-set-input-focus frame)
|
||||
|
@ -825,6 +846,7 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
(defun exwm-exit ()
|
||||
"Exit EXWM."
|
||||
(interactive)
|
||||
(exwm--log)
|
||||
(run-hooks 'exwm-exit-hook)
|
||||
(setq confirm-kill-emacs nil)
|
||||
;; Exit modules.
|
||||
|
@ -840,6 +862,7 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
|
||||
(defun exwm-enable (&optional undo)
|
||||
"Enable/Disable EXWM."
|
||||
(exwm--log "%s" undo)
|
||||
(pcase undo
|
||||
(`undo ;prevent reinitialization
|
||||
(remove-hook 'window-setup-hook #'exwm-init)
|
||||
|
@ -866,6 +889,7 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
|
||||
(defun exwm--server-stop ()
|
||||
"Stop the subordinate Emacs server."
|
||||
(exwm--log)
|
||||
(server-force-delete exwm--server-name)
|
||||
(when exwm--server-process
|
||||
(delete-process exwm--server-process)
|
||||
|
@ -874,6 +898,7 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
(defun exwm--server-eval-at (&rest args)
|
||||
"Wrapper of `server-eval-at' used to advice subrs."
|
||||
;; Start the subordinate Emacs server if it's not alive
|
||||
(exwm--log "%s" args)
|
||||
(unless (server-running-p exwm--server-name)
|
||||
(when exwm--server-process (delete-process exwm--server-process))
|
||||
(setq exwm--server-process
|
||||
|
@ -912,6 +937,7 @@ manager. If t, replace it, if nil, abort and ask the user if `ask'."
|
|||
|
||||
(defun exwm--confirm-kill-emacs (prompt &optional force)
|
||||
"Confirm before exiting Emacs."
|
||||
(exwm--log)
|
||||
(when (cond
|
||||
((and force (not (eq force 'no-check)))
|
||||
;; Force killing Emacs.
|
||||
|
|
Loading…
Reference in a new issue