diff options
author | Vincent Ambo <mail@tazj.in> | 2024-06-10T07·51+0300 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2024-06-10T07·51+0300 |
commit | 179a4e36d7419394494a19a5f005b0ff4a1dffe9 (patch) | |
tree | ded977fbf971fc8825b9b0ba4c2ebdf23f3b1f45 /third_party/exwm/exwm-core.el | |
parent | 533c3dabab62d23bcbcf924c3242e92945e31020 (diff) | |
parent | 3e6bfe36afc8356bf72d89eff940282db6ea7cba (diff) |
subtree(3p/exwm): update to EXWM 0.30 r/8238
Merge commit '3e6bfe36afc8356bf72d89eff940282db6ea7cba' into HEAD Change-Id: Ieebca600b409765d9109fd2b718bd74e533c12e1
Diffstat (limited to 'third_party/exwm/exwm-core.el')
-rw-r--r-- | third_party/exwm/exwm-core.el | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/third_party/exwm/exwm-core.el b/third_party/exwm/exwm-core.el index e0d644d941ed..a7fdfce71097 100644 --- a/third_party/exwm/exwm-core.el +++ b/third_party/exwm/exwm-core.el @@ -82,6 +82,7 @@ Here are some predefined candidates: (defvar exwm-input--simulation-keys) (defvar exwm-input-line-mode-passthrough) (defvar exwm-input-prefix-keys) +(defvar exwm-workspace--list) (declare-function exwm-input--fake-key "exwm-input.el" (event)) (declare-function exwm-input--on-KeyPress-line-mode "exwm-input.el" (key-press raw-data)) @@ -94,6 +95,8 @@ Here are some predefined candidates: (declare-function exwm-manage--kill-buffer-query-function "exwm-manage.el") (declare-function exwm-workspace-move-window "exwm-workspace.el" (frame-or-index &optional id)) +(declare-function exwm-workspace-switch "exwm-workspace.el" + (frame-or-index &optional force)) (define-minor-mode exwm-debug "Debug-logging enabled if non-nil." @@ -229,6 +232,14 @@ If CONN is non-nil, use it instead of the value of the variable (setq ret-depth depth)) (list ret-visual ret-depth ret-colormap))) +(defun exwm--mode-name () + "Mode name string used in `exwm-mode' buffers." + (let ((name "EXWM")) + (if (cl-some (lambda (i) (frame-parameter i 'exwm-urgency)) + exwm-workspace--list) + (propertize name 'face 'font-lock-warning-face) + name))) + ;; Internal variables (defvar-local exwm--id nil) ;window ID (defvar-local exwm--configurations nil) ;initial configurations. @@ -311,7 +322,7 @@ One of `line-mode' or `char-mode'.") ;; Also, inactive entries should be disabled rather than hidden. (easy-menu-define exwm-mode-menu exwm-mode-map "Menu for `exwm-mode'." - '("EXWM" + `("EXWM" "---" "*General*" "---" @@ -336,22 +347,20 @@ One of `line-mode' or `char-mode'.") ["Send key" exwm-input-send-next-key (eq exwm--input-mode 'line-mode)] ;; This is merely a reference. ("Send simulation key" :filter - (lambda (&rest _args) - (let (result) - (maphash - (lambda (key value) - (when (sequencep key) - (setq result (append result - `([ - ,(format "Send '%s'" - (key-description value)) - (lambda () - (interactive) - (dolist (i ',value) - (exwm-input--fake-key i))) - :keys ,(key-description key)]))))) - exwm-input--simulation-keys) - result))) + ,(lambda (&rest _args) + (let (result) + (maphash + (lambda (key value) + (when (sequencep key) + (setq result (append result + `([,(format "Send '%s'" + (key-description value)) + ,(lambda () + (interactive) + (mapc #'exwm-input--fake-key value)) + :keys ,(key-description key)]))))) + exwm-input--simulation-keys) + result))) ["Define global binding" exwm-input-set-key] @@ -368,26 +377,20 @@ One of `line-mode' or `char-mode'.") ["Switch workspace" exwm-workspace-switch] ;; Place this entry at bottom to avoid selecting others by accident. ("Switch to" :filter - (lambda (&rest _args) - (mapcar (lambda (i) - `[,(format "Workspace %d" i) - (lambda () - (interactive) - (exwm-workspace-switch ,i)) - (/= ,i exwm-workspace-current-index)]) - (number-sequence 0 (1- (exwm-workspace--count)))))))) + ,(lambda (&rest _args) + (mapcar (lambda (i) + `[,(format "Workspace %d" i) + ,(lambda () + (interactive) + (exwm-workspace-switch i)) + (/= ,i exwm-workspace-current-index)]) + (number-sequence 0 (1- (length exwm-workspace--list)))))))) (define-derived-mode exwm-mode nil "EXWM" "Major mode for managing X windows. \\{exwm-mode-map}" - ;; - (setq mode-name - '(:eval (propertize "EXWM" 'face - (when (cl-some (lambda (i) - (frame-parameter i 'exwm-urgency)) - exwm-workspace--list) - 'font-lock-warning-face)))) + :interactive nil :abbrev-table nil :syntax-table nil ;; Change major-mode is not allowed (add-hook 'change-major-mode-hook #'kill-buffer nil t) ;; Kill buffer -> close window @@ -396,7 +399,8 @@ One of `line-mode' or `char-mode'.") ;; Redirect events when executing keyboard macros. (push `(executing-kbd-macro . ,exwm--kmacro-map) minor-mode-overriding-map-alist) - (setq buffer-read-only t + (setq mode-name '(:eval (exwm--mode-name)) + buffer-read-only t cursor-type nil left-margin-width nil right-margin-width nil |