mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-23 13:07:59 +01:00
exwm-layout-toggle-fullscreen: work non-interactively
Previous behavior required explicitly passing an ID when called from lisp programs. New behavior attempts to set the ID to window-buffer when not explicitly passed as an argument. A user-error is thrown if current-buffer has no X window ID. See: https://github.com/emacs-exwm/exwm/issues/60
This commit is contained in:
parent
41d1e6c1c3
commit
94c9f369dd
1 changed files with 11 additions and 11 deletions
|
@ -245,17 +245,17 @@ See variable `exwm-layout-auto-iconify'."
|
|||
(exwm-input--grab-keyboard exwm--id))))
|
||||
|
||||
;;;###autoload
|
||||
(cl-defun exwm-layout-toggle-fullscreen (&optional id)
|
||||
"Toggle fullscreen mode of X window ID."
|
||||
(interactive (list (exwm--buffer->id (window-buffer))))
|
||||
(exwm--log "id=#x%x" (or id 0))
|
||||
(unless (or id (derived-mode-p 'exwm-mode))
|
||||
(cl-return-from exwm-layout-toggle-fullscreen))
|
||||
(when id
|
||||
(defun exwm-layout-toggle-fullscreen (&optional id)
|
||||
"Toggle fullscreen mode of X window ID.
|
||||
If ID is non-nil, default to ID of `window-buffer'."
|
||||
(interactive)
|
||||
(setq id (or id (exwm--buffer->id (current-buffer))
|
||||
(user-error "Current buffer has no X window ID")))
|
||||
(exwm--log "id=#x%x" id)
|
||||
(with-current-buffer (exwm--id->buffer id)
|
||||
(if (exwm-layout--fullscreen-p)
|
||||
(exwm-layout-unset-fullscreen id)
|
||||
(exwm-layout-set-fullscreen id)))))
|
||||
(exwm-layout-set-fullscreen id))))
|
||||
|
||||
(defun exwm-layout--other-buffer-predicate (buffer)
|
||||
"Return non-nil when the BUFFER may be displayed in selected frame.
|
||||
|
|
Loading…
Reference in a new issue