about summary refs log tree commit diff
path: root/exwm-input.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-08-24T11·21+0800
committerChris Feng <chris.w.feng@gmail.com>2016-08-24T11·21+0800
commita9136213020efb69672996e2306ae8c26b14e629 (patch)
tree023a42f31784c760b0fa4a08b58955f134587cbe /exwm-input.el
parentcb75d4814daac2f6d52d11550199be65d185f996 (diff)
Add toggle commands
* exwm-input.el (exwm-input-toggle-keyboard): New command for toggling
keyboard mode.
* exwm-layout.el (exwm-layout-toggle-fullscreen): New command for
toggling fullscreen mode.
* exwm-core.el (exwm-mode-menu, exwm-mode-map): Use them.
Diffstat (limited to 'exwm-input.el')
-rw-r--r--exwm-input.el10
1 files changed, 10 insertions, 0 deletions
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))