summaryrefslogtreecommitdiffstats
path: root/lisp/xterm-kitty.el
diff options
context:
space:
mode:
authorRavi R Kiran <aine.marina@gmail.com>2021-05-02 19:31:56 (GMT)
committerRavi R Kiran <aine.marina@gmail.com>2021-05-02 19:31:56 (GMT)
commit44e9dc491ddac0ee9497f5b28d0c7e679055ecaf (patch)
tree1182feafd06e4c07a09518af1b11b91151fcabdd /lisp/xterm-kitty.el
parent4c000312c47e47b9d04d1b92204fcffd652f69ac (diff)
downloaddotemacs-44e9dc491ddac0ee9497f5b28d0c7e679055ecaf.zip
dotemacs-44e9dc491ddac0ee9497f5b28d0c7e679055ecaf.tar.gz
dotemacs-44e9dc491ddac0ee9497f5b28d0c7e679055ecaf.tar.bz2
Finally figured out a way to make variables terminal-local
Diffstat (limited to 'lisp/xterm-kitty.el')
-rw-r--r--lisp/xterm-kitty.el16
1 files changed, 5 insertions, 11 deletions
diff --git a/lisp/xterm-kitty.el b/lisp/xterm-kitty.el
index 7d30e20..809bff3 100644
--- a/lisp/xterm-kitty.el
+++ b/lisp/xterm-kitty.el
@@ -353,10 +353,6 @@ function is almost equivalent to 'event-convert-list'."
(vector (xterm-kitty--add-modifier-list modifiers key))
default))
-(defun xterm-kitty-remove-keyboard ()
- "Reset keyboard to prior status, if modified by kitty-escape-codes."
- (send-string-to-terminal "\e[<u"))
-
;; To do: debug the reason that the table method does not work
;; - the table does not seem to be reflected in input-decode-map
;; - the table method is needed for those packages which advice
@@ -376,7 +372,8 @@ function is almost equivalent to 'event-convert-list'."
(unless keymap ; default keymap was used
(message "Applying xterm-kitty changes")
(send-string-to-terminal "\e[>1;u")
- (add-hook 'kill-emacs-hook 'xterm-kitty-remove-keyboard))
+ (push "\e[>1;u" (terminal-parameter nil 'tty-mode-set-strings))
+ (push "\e[<u" (terminal-parameter nil 'tty-mode-reset-strings)))
(if xterm-kitty-use-table-method
(xterm-kitty--insert-decode-table kmap)
(define-key kmap xterm-kitty-escape-prefix #'xterm-kitty--handle-escape-code)))
@@ -391,11 +388,8 @@ function is almost equivalent to 'event-convert-list'."
(add-hook 'terminal-init-xterm-hook 'xterm-kitty-save-window-id)
(xterm-kitty-add-select-frame-set-input-focus-advice)))
-(defvar xterm-kitty--window-id-hash-table ; private storage
- (make-hash-table :test #'equal)
- "Map of terminals (windows in kitty parlance) to kitty window ids")
(defun xterm-kitty-window-id (&optional terminal) ; public API
- (gethash (terminal-name terminal) xterm-kitty--window-id-hash-table))
+ (terminal-parameter terminal 'kitty-window-id))
(defun xterm-kitty--remote-control-response ()
(let ((str "")
@@ -429,7 +423,7 @@ function is almost equivalent to 'event-convert-list'."
(gethash "windows" tab)))
(gethash "tabs" os-win)))
response-json)
- (puthash (terminal-name) window-id xterm-kitty--window-id-hash-table)))
+ (set-terminal-parameter nil 'kitty-window-id window-id)))
(defun xterm-kitty-save-window-id ()
"Save kitty window ID of current terminal"
@@ -447,7 +441,7 @@ function is almost equivalent to 'event-convert-list'."
(let* ((frame (if (windowp frame-or-window)
(window-frame frame-or-window)
frame-or-window))
- (kitty-window-id (and xterm-kitty-in-use (xterm-kitty-window-id frame))))
+ (kitty-window-id (and xterm-kitty-in-use (xterm-kitty-window-id (frame-terminal frame)))))
;; (message "Window id %d for %s" kitty-window-id frame)
(when kitty-window-id
(send-string-to-terminal (format xterm-kitty--focus-window-command-string kitty-window-id)))))