benjaminor / kkp

Emacs support for the Kitty Keyboard Protocol
GNU General Public License v3.0
39 stars 6 forks source link

Not working in TMUX, and questions about usage #12

Closed markjfisher closed 8 months ago

markjfisher commented 8 months ago

Hi there, thanks for writing kkp. I have a couple of questions and an issue.

I'm using ARCH, with emacs 29.2. I start emacs in daemon mode at startup of Hyprland, and then connect to it with emacs -nw.

I have a tmux session open in kitty, if I hit kitty keyboard bindings (e.g. ctrl-shift-backspace), font size resets as the kitty configuration is setup, new tabs etc all work. However, when I run (kkp-status) invoked from emacs -nw, it reports:

KKP not supported in this terminal

If I run it outside of tmux, I get the better response:

KKP supported in this terminal. KKP active in this terminal. Enabled enhancements: report-alternate-keys and disambiguate-escape-codes

Two questions:

  1. Is it possible to get this working in tmux?
  2. When it is working (outside tmux at the moment) how do I see its effects?

I ask the 2nd question, as when I try a key chord like c-s-c c-s-c (which I have for multiple cursors) nothing happens, despite status telling me it's active. In fact, non of my c-s- bindings work with kkp enabled, so I'm wondering what I'm doing wrong. My assumption was that enabling kkp would make emacs in kitty work like a native window, where c-s- bindings would just work. Hoping that's what this does!

Many thanks.

Hajitorus commented 8 months ago

re: tmux support of kitty keyboard protocol, it looks like this is the most recent info: https://github.com/tmux/tmux/issues/3796 which is sort of a followup of this: https://github.com/tmux/tmux/issues/3335

markjfisher commented 8 months ago

Thanks, seems like it's been left to the community to support rather than the authors of tmux.

Do you know why, or suggest how I could investigate further why key strokes like c-s-c are not being passed through with kkp enabled in emacs in a terminal session?

benjaminor commented 8 months ago

Hi, often the keybinding "Ctrl-Shift-c" is mapped to "copy to clipboard" in terminals. Could you maybe check if this is not set in your kitty.conf? view-lossage should also show you if Emacs saw your "C-S-c" input.

LionyxML commented 8 months ago

Just "endossing" @markjfisher request. Having kkp working inside tmux would be a killer feature to have full Emacs support on my workflow :)

benjaminor commented 8 months ago

Closing this issue: tmux support is out of scope unfortunately, as much as I would like to have it as well. You'll have to refer to the tmux issues mentioned by @Hajitorus.

Regarding the other issue, I can verify "C-S" bindings work for me with kkp. For example, in wezterm, (define-key global-map (kbd "C-S-o") #'kkp-status) let's me call kkp-status with C-S-o. Other keybindings do not work (e.g., "C-S-c"), I highly suspect they are intercepted/used by the terminal itself. By the way, these keybindings do not work for me in the terminal regardless of kkp being enabled or not.