mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 06:48:00 +01:00
satisfy checkdoc
* exwm-background.el (exwm-background--connected-p): Add docstring. (exwm-background--connect): Add docstring. * exwm-core.el (exwm-debug-log-time-function): (exwm-debug): Rename to exwm-debug-mode; define obsolete alias for old name. (exwm--debug): Update docstring to reflect above name change. (exwm--log): condition on exwm-debug-mode (exwm-mode-map): update exwm-debug-mode binding * exwm-floating.el (exwm-floating--set-allowed-actions): Rename TILLING parameter to TILED-P; update docstring. (exwm-floating--start-moveresize): Add parameters to docstring. (exwm-floating--do-moveresize): Add parameter to docstring. * exwm-input.el (exwm-input-prefix-keys): Remove embedded keybinding from docstring. (exwm-input--on-PropertyNotify): Add parameter to docstring. (exwm-input--on-EnterNotify): Add parameter to docstring. (exwm-input--on-keysyms-update): Add docstring. (exwm-input--set-active-window): Add parameter to docstring. (exwm-input--on-ButtonPress): Add parameter to docstring. (exwm-input--on-KeyPress): Add parameter to docstring. (exwm-input--on-CreateNotify): Add parameter to docstring. (exwm-input--grab-global-prefix-keys): Add docstring. (exwm-input--set-key): Add docstring. (exwm-input-set-key): Add parameter to docstring. (exwm-input--unread-event): Add docstring. (exwm-input--translate): Add docstring. (exwm-input--cache-event): Add parameter to docstring. (exwm-input--on-KeyPress-line-mode): Rename parameter; add parameter to docstring. (exwm-input--on-KeyPress-char-mode): Rename parameter; add parameter to docstring. (exwm-input-grab-keyboard): Add parameter to docstring. (exwm-input-release-keyboard): Add parameter to docstring. (exwm-input-toggle-keyboard): Add parameter to docstring. (exwm-input-send-next-key): Rename parameter; mention limit in docstring. (exwm-input--set-simulation-keys): Rename parameter; add parameter to docstring. (exwm-input--read-keys): Add docstring. (exwm-input-set-simulation-key): Add parameters to docstring. (exwm-input-send-simulation-key): Rename parameter; add parameter to docstring. * exwm-randr.el (exwm-randr--on-ScreenChangeNotify): Add parameter to docstring. (exwm-randr--on-Notify): Add parameter to docstring. (exwm-randr--on-ConfigureNotify): Add parameter to docstring. * exwm-xim.el (exwm-xim--on-ClientMessage): Add parameter to docstring. * exwm.el (exwm-restart): Remove question mark from prompt arg (exwm-enable): Remove question mark from prompt arg; add parameter to docstring. (exwm--confirm-kill-terminal): Remove question mark from prompt arg. (exwm--confirm-kill-emacs): Ensure prompt ends in question mark.
This commit is contained in:
parent
588f6ca043
commit
9e965fd2af
7 changed files with 79 additions and 60 deletions
|
@ -156,10 +156,12 @@ may kill this connection when they replace it.")
|
||||||
(xcb:flush exwm-background--connection))
|
(xcb:flush exwm-background--connection))
|
||||||
|
|
||||||
(defun exwm-background--connected-p ()
|
(defun exwm-background--connected-p ()
|
||||||
|
"Return t if a live background connection process exists and is connected."
|
||||||
(and exwm-background--connection
|
(and exwm-background--connection
|
||||||
(process-live-p (slot-value exwm-background--connection 'process))))
|
(process-live-p (slot-value exwm-background--connection 'process))))
|
||||||
|
|
||||||
(defun exwm-background--connect ()
|
(defun exwm-background--connect ()
|
||||||
|
"Establish background Pixmap connection."
|
||||||
(unless (exwm-background--connected-p)
|
(unless (exwm-background--connected-p)
|
||||||
(setq exwm-background--connection (xcb:connect))
|
(setq exwm-background--connection (xcb:connect))
|
||||||
;;prevent query message on exit
|
;;prevent query message on exit
|
||||||
|
|
15
exwm-core.el
15
exwm-core.el
|
@ -38,12 +38,12 @@
|
||||||
:group 'exwm)
|
:group 'exwm)
|
||||||
|
|
||||||
(defcustom exwm-debug-log-time-function #'exwm-debug-log-uptime
|
(defcustom exwm-debug-log-time-function #'exwm-debug-log-uptime
|
||||||
"Function used for generating timestamps in `exwm-debug' logs.
|
"Function used for generating timestamps in debug log.
|
||||||
|
|
||||||
Here are some predefined candidates:
|
Here are some predefined candidates:
|
||||||
`exwm-debug-log-uptime': Display the uptime of this Emacs instance.
|
`exwm-debug-log-uptime': Display the uptime of this Emacs instance.
|
||||||
`exwm-debug-log-time': Display time of day.
|
`exwm-debug-log-time': Display time of day.
|
||||||
`nil': Disable timestamp."
|
nil: Disable timestamp."
|
||||||
:type `(choice (const :tag "Emacs uptime" ,#'exwm-debug-log-uptime)
|
:type `(choice (const :tag "Emacs uptime" ,#'exwm-debug-log-uptime)
|
||||||
(const :tag "Time of day" ,#'exwm-debug-log-time)
|
(const :tag "Time of day" ,#'exwm-debug-log-time)
|
||||||
(const :tag "Off" nil)
|
(const :tag "Off" nil)
|
||||||
|
@ -98,14 +98,15 @@ Here are some predefined candidates:
|
||||||
(declare-function exwm-workspace-switch "exwm-workspace.el"
|
(declare-function exwm-workspace-switch "exwm-workspace.el"
|
||||||
(frame-or-index &optional force))
|
(frame-or-index &optional force))
|
||||||
|
|
||||||
(define-minor-mode exwm-debug
|
(define-minor-mode exwm-debug-mode
|
||||||
"Debug-logging enabled if non-nil."
|
"Debug-logging enabled if non-nil."
|
||||||
:global t
|
:global t
|
||||||
:group 'exwm-debug)
|
:group 'exwm-debug)
|
||||||
|
(define-obsolete-function-alias 'exwm-debug 'exwm-debug-mode "0.30")
|
||||||
|
|
||||||
(defmacro exwm--debug (&rest forms)
|
(defmacro exwm--debug (&rest forms)
|
||||||
"Evaluate FORMS if mode `exwm-debug' is active."
|
"Evaluate FORMS if `exwm-debug-mode' is active."
|
||||||
(when exwm-debug `(progn ,@forms)))
|
(when exwm-debug-mode `(progn ,@forms)))
|
||||||
|
|
||||||
(defmacro exwm--log (&optional format-string &rest objects)
|
(defmacro exwm--log (&optional format-string &rest objects)
|
||||||
"Emit a message prepending the name of the function being executed.
|
"Emit a message prepending the name of the function being executed.
|
||||||
|
@ -113,7 +114,7 @@ Here are some predefined candidates:
|
||||||
FORMAT-STRING is a string specifying the message to output, as in
|
FORMAT-STRING is a string specifying the message to output, as in
|
||||||
`format'. The OBJECTS arguments specify the substitutions."
|
`format'. The OBJECTS arguments specify the substitutions."
|
||||||
(unless format-string (setq format-string ""))
|
(unless format-string (setq format-string ""))
|
||||||
`(when exwm-debug
|
`(when exwm-debug-mode
|
||||||
(xcb-debug:message ,(concat "%s%s:\t" format-string "\n")
|
(xcb-debug:message ,(concat "%s%s:\t" format-string "\n")
|
||||||
(if exwm-debug-log-time-function
|
(if exwm-debug-log-time-function
|
||||||
(funcall exwm-debug-log-time-function)
|
(funcall exwm-debug-log-time-function)
|
||||||
|
@ -285,7 +286,7 @@ One of `line-mode' or `char-mode'.")
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map "\C-c\C-d\C-l" #'xcb-debug:clear)
|
(define-key map "\C-c\C-d\C-l" #'xcb-debug:clear)
|
||||||
(define-key map "\C-c\C-d\C-m" #'xcb-debug:mark)
|
(define-key map "\C-c\C-d\C-m" #'xcb-debug:mark)
|
||||||
(define-key map "\C-c\C-d\C-t" #'exwm-debug)
|
(define-key map "\C-c\C-d\C-t" #'exwm-debug-mode)
|
||||||
(define-key map "\C-c\C-f" #'exwm-layout-set-fullscreen)
|
(define-key map "\C-c\C-f" #'exwm-layout-set-fullscreen)
|
||||||
(define-key map "\C-c\C-h" #'exwm-floating-hide)
|
(define-key map "\C-c\C-h" #'exwm-floating-hide)
|
||||||
(define-key map "\C-c\C-k" #'exwm-input-release-keyboard)
|
(define-key map "\C-c\C-k" #'exwm-input-release-keyboard)
|
||||||
|
|
|
@ -125,13 +125,14 @@ This hook runs in the context of the corresponding buffer."
|
||||||
(declare-function exwm-workspace--update-offsets "exwm-workspace.el" ())
|
(declare-function exwm-workspace--update-offsets "exwm-workspace.el" ())
|
||||||
(declare-function exwm-workspace--workarea "exwm-workspace.el" (frame))
|
(declare-function exwm-workspace--workarea "exwm-workspace.el" (frame))
|
||||||
|
|
||||||
(defun exwm-floating--set-allowed-actions (id tilling)
|
(defun exwm-floating--set-allowed-actions (id tiled-p)
|
||||||
"Set _NET_WM_ALLOWED_ACTIONS."
|
"Set _NET_WM_ALLOWED_ACTIONS for window with ID.
|
||||||
|
If TILED-P is non-nil, set actions for tiled window."
|
||||||
(exwm--log "#x%x" id)
|
(exwm--log "#x%x" id)
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:ewmh:set-_NET_WM_ALLOWED_ACTIONS
|
(make-instance 'xcb:ewmh:set-_NET_WM_ALLOWED_ACTIONS
|
||||||
:window id
|
:window id
|
||||||
:data (if tilling
|
:data (if tiled-p
|
||||||
(vector xcb:Atom:_NET_WM_ACTION_MINIMIZE
|
(vector xcb:Atom:_NET_WM_ACTION_MINIMIZE
|
||||||
xcb:Atom:_NET_WM_ACTION_FULLSCREEN
|
xcb:Atom:_NET_WM_ACTION_FULLSCREEN
|
||||||
xcb:Atom:_NET_WM_ACTION_CHANGE_DESKTOP
|
xcb:Atom:_NET_WM_ACTION_CHANGE_DESKTOP
|
||||||
|
@ -466,7 +467,9 @@ This hook runs in the context of the corresponding buffer."
|
||||||
(select-frame-set-input-focus exwm-workspace--current)))
|
(select-frame-set-input-focus exwm-workspace--current)))
|
||||||
|
|
||||||
(defun exwm-floating--start-moveresize (id &optional type)
|
(defun exwm-floating--start-moveresize (id &optional type)
|
||||||
"Start move/resize."
|
"Start move/resize for window with ID.
|
||||||
|
When non-nil, TYPE indicates the type of move/resize.
|
||||||
|
Float resizing is stopped when TYPE is nil."
|
||||||
(exwm--log "#x%x" id)
|
(exwm--log "#x%x" id)
|
||||||
(let ((buffer-or-id (or (exwm--id->buffer id) id))
|
(let ((buffer-or-id (or (exwm--id->buffer id) id))
|
||||||
frame container-or-id x y width height cursor)
|
frame container-or-id x y width height cursor)
|
||||||
|
@ -672,7 +675,7 @@ This hook runs in the context of the corresponding buffer."
|
||||||
(setq exwm-floating--moveresize-calculate nil)))
|
(setq exwm-floating--moveresize-calculate nil)))
|
||||||
|
|
||||||
(defun exwm-floating--do-moveresize (data _synthetic)
|
(defun exwm-floating--do-moveresize (data _synthetic)
|
||||||
"Perform move/resize."
|
"Perform move/resize on floating window with DATA."
|
||||||
(when exwm-floating--moveresize-calculate
|
(when exwm-floating--moveresize-calculate
|
||||||
(let* ((obj (make-instance 'xcb:MotionNotify))
|
(let* ((obj (make-instance 'xcb:MotionNotify))
|
||||||
result value-mask x y width height buffer-or-id container-or-id)
|
result value-mask x y width height buffer-or-id container-or-id)
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
'(?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-& ?\M-:)
|
'(?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-& ?\M-:)
|
||||||
"List of prefix keys EXWM should forward to Emacs when in `line-mode'.
|
"List of prefix keys EXWM should forward to Emacs when in `line-mode'.
|
||||||
|
|
||||||
The point is to make keys like `C-x C-f' forwarded to Emacs in `line-mode'.
|
|
||||||
There is no need to add prefix keys for global/simulation keys or those
|
There is no need to add prefix keys for global/simulation keys or those
|
||||||
defined in `exwm-mode-map' here."
|
defined in `exwm-mode-map' here."
|
||||||
:type '(repeat key-sequence)
|
:type '(repeat key-sequence)
|
||||||
|
@ -231,7 +230,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
(xcb:flush exwm--connection))
|
(xcb:flush exwm--connection))
|
||||||
|
|
||||||
(defun exwm-input--on-PropertyNotify (data _synthetic)
|
(defun exwm-input--on-PropertyNotify (data _synthetic)
|
||||||
"Handle PropertyNotify events."
|
"Handle PropertyNotify events with DATA."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(when exwm-input--timestamp-callback
|
(when exwm-input--timestamp-callback
|
||||||
(let ((obj (make-instance 'xcb:PropertyNotify)))
|
(let ((obj (make-instance 'xcb:PropertyNotify)))
|
||||||
|
@ -246,7 +245,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
(defvar exwm-input--last-enter-notify-position nil)
|
(defvar exwm-input--last-enter-notify-position nil)
|
||||||
|
|
||||||
(defun exwm-input--on-EnterNotify (data _synthetic)
|
(defun exwm-input--on-EnterNotify (data _synthetic)
|
||||||
"Handle EnterNotify events."
|
"Handle EnterNotify events with DATA."
|
||||||
(let ((evt (make-instance 'xcb:EnterNotify))
|
(let ((evt (make-instance 'xcb:EnterNotify))
|
||||||
buffer window frame frame-xid edges fake-evt)
|
buffer window frame frame-xid edges fake-evt)
|
||||||
(xcb:unmarshal evt data)
|
(xcb:unmarshal evt data)
|
||||||
|
@ -292,6 +291,7 @@ ARGS are additional arguments to CALLBACK."
|
||||||
(setq exwm-input--last-enter-notify-position (vector root-x root-y)))))
|
(setq exwm-input--last-enter-notify-position (vector root-x root-y)))))
|
||||||
|
|
||||||
(defun exwm-input--on-keysyms-update ()
|
(defun exwm-input--on-keysyms-update ()
|
||||||
|
"Update global prefix keys."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(let ((exwm-input--global-prefix-keys nil))
|
(let ((exwm-input--global-prefix-keys nil))
|
||||||
(exwm-input--update-global-prefix-keys)))
|
(exwm-input--update-global-prefix-keys)))
|
||||||
|
@ -386,7 +386,8 @@ attempt later."
|
||||||
(xcb:flush exwm--connection)))))))
|
(xcb:flush exwm--connection)))))))
|
||||||
|
|
||||||
(defun exwm-input--set-active-window (&optional id)
|
(defun exwm-input--set-active-window (&optional id)
|
||||||
"Set _NET_ACTIVE_WINDOW."
|
"Set _NET_ACTIVE_WINDOW.
|
||||||
|
When non-nil, ID is passed as the window data."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:ewmh:set-_NET_ACTIVE_WINDOW
|
(make-instance 'xcb:ewmh:set-_NET_ACTIVE_WINDOW
|
||||||
|
@ -394,7 +395,7 @@ attempt later."
|
||||||
:data (or id xcb:Window:None))))
|
:data (or id xcb:Window:None))))
|
||||||
|
|
||||||
(defun exwm-input--on-ButtonPress (data _synthetic)
|
(defun exwm-input--on-ButtonPress (data _synthetic)
|
||||||
"Handle ButtonPress event."
|
"Handle ButtonPress event with DATA."
|
||||||
(let ((obj (make-instance 'xcb:ButtonPress))
|
(let ((obj (make-instance 'xcb:ButtonPress))
|
||||||
(mode xcb:Allow:SyncPointer)
|
(mode xcb:Allow:SyncPointer)
|
||||||
button-event window buffer frame fake-last-command)
|
button-event window buffer frame fake-last-command)
|
||||||
|
@ -466,7 +467,7 @@ attempt later."
|
||||||
(run-hooks 'exwm-input--event-hook))
|
(run-hooks 'exwm-input--event-hook))
|
||||||
|
|
||||||
(defun exwm-input--on-KeyPress (data _synthetic)
|
(defun exwm-input--on-KeyPress (data _synthetic)
|
||||||
"Handle KeyPress event."
|
"Handle KeyPress event with DATA."
|
||||||
(with-current-buffer (window-buffer (selected-window))
|
(with-current-buffer (window-buffer (selected-window))
|
||||||
(let ((obj (make-instance 'xcb:KeyPress)))
|
(let ((obj (make-instance 'xcb:KeyPress)))
|
||||||
(xcb:unmarshal obj data)
|
(xcb:unmarshal obj data)
|
||||||
|
@ -482,7 +483,7 @@ attempt later."
|
||||||
(run-hooks 'exwm-input--event-hook)))
|
(run-hooks 'exwm-input--event-hook)))
|
||||||
|
|
||||||
(defun exwm-input--on-CreateNotify (data _synthetic)
|
(defun exwm-input--on-CreateNotify (data _synthetic)
|
||||||
"Handle CreateNotify events."
|
"Handle CreateNotify events with DATA."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(let ((evt (make-instance 'xcb:CreateNotify)))
|
(let ((evt (make-instance 'xcb:CreateNotify)))
|
||||||
(xcb:unmarshal evt data)
|
(xcb:unmarshal evt data)
|
||||||
|
@ -505,6 +506,7 @@ attempt later."
|
||||||
'children))))))
|
'children))))))
|
||||||
|
|
||||||
(defun exwm-input--grab-global-prefix-keys (&rest xwins)
|
(defun exwm-input--grab-global-prefix-keys (&rest xwins)
|
||||||
|
"Grab global prefix keys in XWINS."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(let ((req (make-instance 'xcb:GrabKey
|
(let ((req (make-instance 'xcb:GrabKey
|
||||||
:owner-events 0
|
:owner-events 0
|
||||||
|
@ -539,6 +541,7 @@ attempt later."
|
||||||
(xcb:flush exwm--connection)))
|
(xcb:flush exwm--connection)))
|
||||||
|
|
||||||
(defun exwm-input--set-key (key command)
|
(defun exwm-input--set-key (key command)
|
||||||
|
"Set KEY to COMMAND."
|
||||||
(exwm--log "key: %s, command: %s" key command)
|
(exwm--log "key: %s, command: %s" key command)
|
||||||
(global-set-key key command)
|
(global-set-key key command)
|
||||||
(cl-pushnew key exwm-input--global-keys))
|
(cl-pushnew key exwm-input--global-keys))
|
||||||
|
@ -566,9 +569,9 @@ Notes:
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun exwm-input-set-key (key command)
|
(defun exwm-input-set-key (key command)
|
||||||
"Set a global key binding.
|
"Set a global KEY binding to COMMAND.
|
||||||
|
|
||||||
The new key binding only takes effect in real time when this command is
|
The new binding only takes effect in real time when this command is
|
||||||
called interactively, and is lost when this session ends unless it's
|
called interactively, and is lost when this session ends unless it's
|
||||||
specifically saved in the Customize interface for `exwm-input-global-keys'.
|
specifically saved in the Customize interface for `exwm-input-global-keys'.
|
||||||
|
|
||||||
|
@ -583,6 +586,7 @@ instead."
|
||||||
(exwm-input--update-global-prefix-keys)))
|
(exwm-input--update-global-prefix-keys)))
|
||||||
|
|
||||||
(defsubst exwm-input--unread-event (event)
|
(defsubst exwm-input--unread-event (event)
|
||||||
|
"Append EVENT to `unread-command-events'."
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
(setq unread-command-events
|
(setq unread-command-events
|
||||||
(append unread-command-events `((t . ,event)))))
|
(append unread-command-events `((t . ,event)))))
|
||||||
|
@ -602,6 +606,7 @@ instead."
|
||||||
event)
|
event)
|
||||||
|
|
||||||
(cl-defun exwm-input--translate (key)
|
(cl-defun exwm-input--translate (key)
|
||||||
|
"Translate KEY."
|
||||||
(let (translation)
|
(let (translation)
|
||||||
(dolist (map (list input-decode-map
|
(dolist (map (list input-decode-map
|
||||||
local-function-key-map
|
local-function-key-map
|
||||||
|
@ -614,7 +619,8 @@ instead."
|
||||||
key)
|
key)
|
||||||
|
|
||||||
(defun exwm-input--cache-event (event &optional temp-line-mode)
|
(defun exwm-input--cache-event (event &optional temp-line-mode)
|
||||||
"Cache EVENT."
|
"Cache EVENT.
|
||||||
|
When non-nil, TEMP-LINE-MODE temporarily puts the window in line mode."
|
||||||
(exwm--log "%s" event)
|
(exwm--log "%s" event)
|
||||||
(setq exwm-input--line-mode-cache
|
(setq exwm-input--line-mode-cache
|
||||||
(vconcat exwm-input--line-mode-cache (vector event)))
|
(vconcat exwm-input--line-mode-cache (vector event)))
|
||||||
|
@ -681,9 +687,9 @@ Current buffer must be an `exwm-mode' buffer."
|
||||||
(error-message-string err))
|
(error-message-string err))
|
||||||
(xcb-debug:backtrace))))
|
(xcb-debug:backtrace))))
|
||||||
|
|
||||||
(defun exwm-input--on-KeyPress-line-mode (key-press raw-data)
|
(defun exwm-input--on-KeyPress-line-mode (keypress raw-data)
|
||||||
"Parse X KeyPress event to Emacs key event and then feed the command loop."
|
"Feed parsed X KEYPRESS event with RAW-DATA to Emacs command loop."
|
||||||
(with-slots (detail state) key-press
|
(with-slots (detail state) keypress
|
||||||
(let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
|
(let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
|
||||||
event raw-event mode)
|
event raw-event mode)
|
||||||
(exwm--log "%s" keysym)
|
(exwm--log "%s" keysym)
|
||||||
|
@ -707,7 +713,7 @@ Current buffer must be an `exwm-mode' buffer."
|
||||||
(xcb:+request exwm--connection
|
(xcb:+request exwm--connection
|
||||||
(make-instance 'xcb:SendEvent
|
(make-instance 'xcb:SendEvent
|
||||||
:propagate 0
|
:propagate 0
|
||||||
:destination (slot-value key-press 'event)
|
:destination (slot-value keypress 'event)
|
||||||
:event-mask xcb:EventMask:NoEvent
|
:event-mask xcb:EventMask:NoEvent
|
||||||
:event raw-data)))
|
:event raw-data)))
|
||||||
(when event
|
(when event
|
||||||
|
@ -722,9 +728,9 @@ Current buffer must be an `exwm-mode' buffer."
|
||||||
:time xcb:Time:CurrentTime))
|
:time xcb:Time:CurrentTime))
|
||||||
(xcb:flush exwm--connection))))
|
(xcb:flush exwm--connection))))
|
||||||
|
|
||||||
(defun exwm-input--on-KeyPress-char-mode (key-press &optional _raw-data)
|
(defun exwm-input--on-KeyPress-char-mode (keypress &optional _raw-data)
|
||||||
"Handle KeyPress event in `char-mode'."
|
"Handle `char-mode' KEYPRESS event."
|
||||||
(with-slots (detail state) key-press
|
(with-slots (detail state) keypress
|
||||||
(let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
|
(let ((keysym (xcb:keysyms:keycode->keysym exwm--connection detail state))
|
||||||
event raw-event)
|
event raw-event)
|
||||||
(exwm--log "%s" keysym)
|
(exwm--log "%s" keysym)
|
||||||
|
@ -840,7 +846,8 @@ button event."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun exwm-input-grab-keyboard (&optional id)
|
(defun exwm-input-grab-keyboard (&optional id)
|
||||||
"Switch to `line-mode'."
|
"Switch to `line-mode`.
|
||||||
|
When ID is non-nil, grab key events on its corresponding window."
|
||||||
(interactive (list (when (derived-mode-p 'exwm-mode)
|
(interactive (list (when (derived-mode-p 'exwm-mode)
|
||||||
(exwm--buffer->id (window-buffer)))))
|
(exwm--buffer->id (window-buffer)))))
|
||||||
(when id
|
(when id
|
||||||
|
@ -851,7 +858,8 @@ button event."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun exwm-input-release-keyboard (&optional id)
|
(defun exwm-input-release-keyboard (&optional id)
|
||||||
"Switch to `char-mode`."
|
"Switch to `char-mode`.
|
||||||
|
When ID is non-nil, release keyboard events on its corresponding window."
|
||||||
(interactive (list (when (derived-mode-p 'exwm-mode)
|
(interactive (list (when (derived-mode-p 'exwm-mode)
|
||||||
(exwm--buffer->id (window-buffer)))))
|
(exwm--buffer->id (window-buffer)))))
|
||||||
(when id
|
(when id
|
||||||
|
@ -862,7 +870,8 @@ button event."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun exwm-input-toggle-keyboard (&optional id)
|
(defun exwm-input-toggle-keyboard (&optional id)
|
||||||
"Toggle between `line-mode' and `char-mode'."
|
"Toggle between `line-mode' and `char-mode'.
|
||||||
|
When ID is non-nil, toggle in its correpsonding window."
|
||||||
(interactive (list (when (derived-mode-p 'exwm-mode)
|
(interactive (list (when (derived-mode-p 'exwm-mode)
|
||||||
(exwm--buffer->id (window-buffer)))))
|
(exwm--buffer->id (window-buffer)))))
|
||||||
(when id
|
(when id
|
||||||
|
@ -904,25 +913,24 @@ button event."
|
||||||
(xcb:flush exwm--connection)))
|
(xcb:flush exwm--connection)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(cl-defun exwm-input-send-next-key (times &optional end-key)
|
(cl-defun exwm-input-send-next-key (n &optional end-key)
|
||||||
"Send next key to client window.
|
"Send next N keys to client window.
|
||||||
|
N is currently capped at 12.
|
||||||
EXWM will prompt for the key to send. This command can be prefixed to send
|
EXWM will prompt for the key to send.
|
||||||
multiple keys. If END-KEY is non-nil, stop sending keys if it's pressed."
|
If END-KEY is non-nil, stop sending keys if it's pressed."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(unless (derived-mode-p 'exwm-mode)
|
(unless (derived-mode-p 'exwm-mode) (cl-return-from exwm-input-send-next-key))
|
||||||
(cl-return-from exwm-input-send-next-key))
|
(setq n (min n 12))
|
||||||
(when (> times 12) (setq times 12))
|
|
||||||
(let (key keys)
|
(let (key keys)
|
||||||
(dotimes (i times)
|
(dotimes (i n)
|
||||||
;; Skip events not from keyboard
|
;; Skip events not from keyboard
|
||||||
(let ((exwm-input-line-mode-passthrough t))
|
(let ((exwm-input-line-mode-passthrough t))
|
||||||
(catch 'break
|
(catch 'break
|
||||||
(while t
|
(while t
|
||||||
(setq key (read-key (format "Send key: %s (%d/%d) %s"
|
(setq key (read-key (format "Send key: %s (%d/%d) %s"
|
||||||
(key-description keys)
|
(key-description keys)
|
||||||
(1+ i) times
|
(1+ i) n
|
||||||
(if end-key
|
(if end-key
|
||||||
(concat "To exit, press: "
|
(concat "To exit, press: "
|
||||||
(key-description
|
(key-description
|
||||||
|
@ -933,10 +941,11 @@ multiple keys. If END-KEY is non-nil, stop sending keys if it's pressed."
|
||||||
(when (eq key end-key) (cl-return-from exwm-input-send-next-key))
|
(when (eq key end-key) (cl-return-from exwm-input-send-next-key))
|
||||||
(exwm-input--fake-key key))))
|
(exwm-input--fake-key key))))
|
||||||
|
|
||||||
(defun exwm-input--set-simulation-keys (simulation-keys &optional no-refresh)
|
(defun exwm-input--set-simulation-keys (keys &optional cache)
|
||||||
"Set simulation keys."
|
"Set simulation KEYS.
|
||||||
(exwm--log "%s" simulation-keys)
|
If CACHE is non-nil reuse `exwm-input--simulation-keys' cache."
|
||||||
(unless no-refresh
|
(exwm--log "%s" keys)
|
||||||
|
(unless cache
|
||||||
;; Unbind simulation keys.
|
;; Unbind simulation keys.
|
||||||
(let ((hash (buffer-local-value 'exwm-input--simulation-keys
|
(let ((hash (buffer-local-value 'exwm-input--simulation-keys
|
||||||
(current-buffer))))
|
(current-buffer))))
|
||||||
|
@ -949,7 +958,7 @@ multiple keys. If END-KEY is non-nil, stop sending keys if it's pressed."
|
||||||
hash)))
|
hash)))
|
||||||
;; Abandon the old hash table.
|
;; Abandon the old hash table.
|
||||||
(setq exwm-input--simulation-keys (make-hash-table :test #'equal)))
|
(setq exwm-input--simulation-keys (make-hash-table :test #'equal)))
|
||||||
(dolist (i simulation-keys)
|
(dolist (i keys)
|
||||||
(let ((original (vconcat (car i)))
|
(let ((original (vconcat (car i)))
|
||||||
(simulated (cdr i)))
|
(simulated (cdr i)))
|
||||||
(setq simulated (if (sequencep simulated)
|
(setq simulated (if (sequencep simulated)
|
||||||
|
@ -1013,6 +1022,7 @@ Notes:
|
||||||
:type '(repeat function))
|
:type '(repeat function))
|
||||||
|
|
||||||
(cl-defun exwm-input--read-keys (prompt stop-key)
|
(cl-defun exwm-input--read-keys (prompt stop-key)
|
||||||
|
"Read keys with PROMPT until STOP-KEY pressed."
|
||||||
(let ((cursor-in-echo-area t)
|
(let ((cursor-in-echo-area t)
|
||||||
keys key)
|
keys key)
|
||||||
(while (not (eq key stop-key))
|
(while (not (eq key stop-key))
|
||||||
|
@ -1026,7 +1036,7 @@ Notes:
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun exwm-input-set-simulation-key (original-key simulated-key)
|
(defun exwm-input-set-simulation-key (original-key simulated-key)
|
||||||
"Set a simulation key.
|
"Set ORIGINAL-KEY to SIMULATED-KEY.
|
||||||
|
|
||||||
The simulation key takes effect in real time, but is lost when this session
|
The simulation key takes effect in real time, but is lost when this session
|
||||||
ends unless it's specifically saved in the Customize interface for
|
ends unless it's specifically saved in the Customize interface for
|
||||||
|
@ -1069,15 +1079,15 @@ where both ORIGINAL-KEY and SIMULATED-KEY are key sequences."
|
||||||
(exwm-input--set-simulation-keys simulation-keys)))
|
(exwm-input--set-simulation-keys simulation-keys)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(cl-defun exwm-input-send-simulation-key (times)
|
(cl-defun exwm-input-send-simulation-key (n)
|
||||||
"Fake a key event according to the last input key sequence."
|
"Fake N key events according to the last input key sequence."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(unless (derived-mode-p 'exwm-mode)
|
(unless (derived-mode-p 'exwm-mode)
|
||||||
(cl-return-from exwm-input-send-simulation-key))
|
(cl-return-from exwm-input-send-simulation-key))
|
||||||
(let ((keys (gethash (this-single-command-keys)
|
(let ((keys (gethash (this-single-command-keys)
|
||||||
exwm-input--simulation-keys)))
|
exwm-input--simulation-keys)))
|
||||||
(dotimes (_ times)
|
(dotimes (_ n)
|
||||||
(dolist (key keys)
|
(dolist (key keys)
|
||||||
(exwm-input--fake-key key)))))
|
(exwm-input--fake-key key)))))
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ In a mirroring setup some monitors overlap and should be treated as one."
|
||||||
(run-hooks 'exwm-randr-refresh-hook))))
|
(run-hooks 'exwm-randr-refresh-hook))))
|
||||||
|
|
||||||
(defun exwm-randr--on-ScreenChangeNotify (data _synthetic)
|
(defun exwm-randr--on-ScreenChangeNotify (data _synthetic)
|
||||||
"Handle `ScreenChangeNotify' event.
|
"Handle `ScreenChangeNotify' event with DATA.
|
||||||
|
|
||||||
Run `exwm-randr-screen-change-hook' (usually user scripts to configure RandR)."
|
Run `exwm-randr-screen-change-hook' (usually user scripts to configure RandR)."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
|
@ -276,7 +276,7 @@ Run `exwm-randr-screen-change-hook' (usually user scripts to configure RandR)."
|
||||||
(run-hooks 'exwm-randr-screen-change-hook)))))
|
(run-hooks 'exwm-randr-screen-change-hook)))))
|
||||||
|
|
||||||
(defun exwm-randr--on-Notify (data _synthetic)
|
(defun exwm-randr--on-Notify (data _synthetic)
|
||||||
"Handle `CrtcChangeNotify' and `OutputChangeNotify' events.
|
"Handle `CrtcChangeNotify' and `OutputChangeNotify' events with DATA.
|
||||||
|
|
||||||
Refresh when any CRTC/output changes."
|
Refresh when any CRTC/output changes."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
|
@ -296,7 +296,7 @@ Refresh when any CRTC/output changes."
|
||||||
(setq exwm-randr--last-timestamp timestamp)))))))
|
(setq exwm-randr--last-timestamp timestamp)))))))
|
||||||
|
|
||||||
(defun exwm-randr--on-ConfigureNotify (data _synthetic)
|
(defun exwm-randr--on-ConfigureNotify (data _synthetic)
|
||||||
"Handle `ConfigureNotify' event.
|
"Handle `ConfigureNotify' event with DATA.
|
||||||
|
|
||||||
Refresh when any RandR 1.5 monitor changes."
|
Refresh when any RandR 1.5 monitor changes."
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
|
|
|
@ -269,7 +269,7 @@ this client."
|
||||||
(xcb:flush exwm-xim--conn))))
|
(xcb:flush exwm-xim--conn))))
|
||||||
|
|
||||||
(cl-defun exwm-xim--on-ClientMessage (data _synthetic)
|
(cl-defun exwm-xim--on-ClientMessage (data _synthetic)
|
||||||
"Handle ClientMessage event on IMS communication window (request).
|
"Handle ClientMessage event DATA on IMS communication window (request).
|
||||||
|
|
||||||
Such events would be received when clients request for _XIM_PROTOCOL.
|
Such events would be received when clients request for _XIM_PROTOCOL.
|
||||||
The actual XIM request is in client message data or a property."
|
The actual XIM request is in client message data or a property."
|
||||||
|
|
11
exwm.el
11
exwm.el
|
@ -139,7 +139,7 @@ After this time, the server will be killed.")
|
||||||
"Restart EXWM."
|
"Restart EXWM."
|
||||||
(interactive)
|
(interactive)
|
||||||
(exwm--log)
|
(exwm--log)
|
||||||
(when (exwm--confirm-kill-emacs "Restart?" 'no-check)
|
(when (exwm--confirm-kill-emacs "Restart" 'no-check)
|
||||||
(let* ((attr (process-attributes (emacs-pid)))
|
(let* ((attr (process-attributes (emacs-pid)))
|
||||||
(args (cdr (assq 'args attr)))
|
(args (cdr (assq 'args attr)))
|
||||||
(ppid (cdr (assq 'ppid attr)))
|
(ppid (cdr (assq 'ppid attr)))
|
||||||
|
@ -976,7 +976,10 @@ FRAME, if given, indicates the X display EXWM should manage."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun exwm-enable (&optional undo)
|
(defun exwm-enable (&optional undo)
|
||||||
"Enable/Disable EXWM."
|
"Enable/Disable EXWM.
|
||||||
|
Optional argument UNDO may be either of the following symbols:
|
||||||
|
- `undo' prevents reinitialization.
|
||||||
|
- `undo-all' attempts to revert all hooks and advice."
|
||||||
(exwm--log "%s" undo)
|
(exwm--log "%s" undo)
|
||||||
(pcase undo
|
(pcase undo
|
||||||
(`undo ;prevent reinitialization
|
(`undo ;prevent reinitialization
|
||||||
|
@ -1062,7 +1065,7 @@ FUNCTION is the function to be evaluated, ARGS are the arguments."
|
||||||
;; This is invoked instead of `save-buffers-kill-emacs' (C-x C-c) on client
|
;; This is invoked instead of `save-buffers-kill-emacs' (C-x C-c) on client
|
||||||
;; frames.
|
;; frames.
|
||||||
(if (exwm--terminal-p)
|
(if (exwm--terminal-p)
|
||||||
(exwm--confirm-kill-emacs "Kill terminal?")
|
(exwm--confirm-kill-emacs "Kill terminal")
|
||||||
t))
|
t))
|
||||||
|
|
||||||
(defun exwm--confirm-kill-emacs (prompt &optional force)
|
(defun exwm--confirm-kill-emacs (prompt &optional force)
|
||||||
|
@ -1087,7 +1090,7 @@ If FORCE is any other non-nil value, force killing of Emacs."
|
||||||
(`break (y-or-n-p prompt))
|
(`break (y-or-n-p prompt))
|
||||||
(x x)))
|
(x x)))
|
||||||
(t
|
(t
|
||||||
(yes-or-no-p (format "[EXWM] %d X window(s) will be destroyed. %s"
|
(yes-or-no-p (format "[EXWM] %d X window(s) will be destroyed. %s?"
|
||||||
(length exwm--id-buffer-alist) prompt))))
|
(length exwm--id-buffer-alist) prompt))))
|
||||||
;; Run `kill-emacs-hook' (`server-force-stop' excluded) before Emacs
|
;; Run `kill-emacs-hook' (`server-force-stop' excluded) before Emacs
|
||||||
;; frames are unmapped so that errors (if any) can be visible.
|
;; frames are unmapped so that errors (if any) can be visible.
|
||||||
|
|
Loading…
Reference in a new issue