-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: detect kitty through tmux (#406)
This PR adds support for kitty protocol detection when you're using tmux. This means now when you're running tmux inside kitty you no longer need to explicitly configure the image protocol to be kitty-local/remote and it will be instead figured out automatically. This is done by making two kitty graphics protocol queries (and for local and one for remote support) and another widely supported query just in case the emulator doesn't support the kitty protocol and ignores our queries (this is what's suggested [here](https://sw.kovidgoyal.net/kitty/graphics-protocol/#querying-support-and-available-transmission-mediums)). The [third query](https://vt100.net/docs/vt510-rm/DA1.html) being done gets us the terminal capabilities; we figure out whether we support sixel by parsing its output. This means now we always make these queries once regardless of the protocol being used unless you explicitly configure a protocol other than `auto` (the default). The caveat here is that terminal emulators may not support [unicode placeholders](https://sw.kovidgoyal.net/kitty/graphics-protocol/#unicode-placeholders) which is a requirement for the kitty protocol to work while inside tmux. At least wezterm [does not currently support them](wez/wezterm#986) so images printed while inside tmux in it look like crap. The workaround for now is to guess that we're inside wezterm + tmux by checking an env var that wezterm sets. This won't work if you start tmux in another terminal (since it inherits _those_ env vars) but it's the best we can do. The outcome of this is if there's another terminal that does support the kitty protocol but does not have unicode placeholders implemented, images will look bad and users will be forced to [specify the image protocol](https://mfontanini.github.io/presenterm/guides/configuration.html#preferred-image-protocol) to be used by hand.
- Loading branch information
Showing
7 changed files
with
269 additions
and
117 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.