diff options
-rw-r--r-- | exwm-core.el | 10 | ||||
-rw-r--r-- | exwm-input.el | 10 | ||||
-rw-r--r-- | exwm-layout.el | 10 |
3 files changed, 22 insertions, 8 deletions
diff --git a/exwm-core.el b/exwm-core.el index 0c92d903394d..e65ad5169093 100644 --- a/exwm-core.el +++ b/exwm-core.el @@ -150,10 +150,7 @@ "*General*" "---" ["Toggle floating" exwm-floating-toggle-floating] - ["Enter fullscreen" exwm-layout-set-fullscreen - (null (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))] - ["Leave fullscreen" exwm-reset - (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)] + ["Toggle fullscreen mode" exwm-layout-toggle-fullscreen] ["Hide window" exwm-floating-hide exwm--floating-frame] "---" @@ -168,10 +165,7 @@ "---" "*Keyboard*" "---" - ["Capture keyboard" exwm-input-release-keyboard exwm--keyboard-grabbed] - ;; It's recommended to use `exwm-reset' rather than - ;; `exwm-input-grab-keyboard' to release keyboard (enter line-mode). - ["Release keyboard" exwm-reset (not exwm--keyboard-grabbed)] + ["Toggle keyboard mode" exwm-input-toggle-keyboard] ["Send key" exwm-input-send-next-key exwm--keyboard-grabbed] ;; This is merely a reference. ("Send simulation key" :filter diff --git a/exwm-input.el b/exwm-input.el index e5828126f9a3..61858e93d2cf 100644 --- a/exwm-input.el +++ b/exwm-input.el @@ -567,6 +567,16 @@ This value should always be overwritten.") (exwm-input--update-mode-line id) (force-mode-line-update)))) +;;;###autoload +(defun exwm-input-toggle-keyboard (&optional id) + "Toggle between 'line-mode' and 'char-mode'." + (interactive (list (exwm--buffer->id (window-buffer)))) + (when id + (with-current-buffer (exwm--id->buffer id) + (if exwm--keyboard-grabbed + (exwm-input-release-keyboard id) + (exwm-reset))))) + (defun exwm-input--fake-key (event) "Fake a key event equivalent to Emacs event EVENT." (let* ((keysym (xcb:keysyms:event->keysym exwm--connection event)) diff --git a/exwm-layout.el b/exwm-layout.el index e8fd8e50c706..355b8346504c 100644 --- a/exwm-layout.el +++ b/exwm-layout.el @@ -260,6 +260,16 @@ (delq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state)) (call-interactively #'exwm-input-grab-keyboard))) +;;;###autoload +(defun exwm-layout-toggle-fullscreen (&optional id) + "Toggle fullscreen mode." + (interactive (list (exwm--buffer->id (window-buffer)))) + (when id + (with-current-buffer (exwm--id->buffer id) + (if (memq xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state) + (exwm-reset) + (exwm-layout-set-fullscreen id))))) + (defvar exwm-layout--other-buffer-exclude-exwm-mode-buffers nil "When non-nil, prevent EXWM buffers from being selected by `other-buffer'.") |