kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
23.63k stars 953 forks source link

Floating windows support #3641

Closed yingzhu146 closed 3 years ago

yingzhu146 commented 3 years ago

Is your feature request related to a problem? Please describe. Many TUI's can't handle all the advanced plotting features kitty can. In my setup, also see kitty responsible for general window management in a TUI environment (because it does it best). To be able to take advantage of kitty's abilities within other terminal applications fully (that does not rely on the TUI supporting the kitty protocol, which unfortunately seems slow going so a workaround would improve the value currently provided).

Describe the solution you'd like it would be important to have floating windows. This would allow things like cursor-position dependent overlays (e.g. show an image/file preview when hovering over an image name in a terminal text editor like neovim).

Describe alternatives you've considered An alternative would be just to use overlays like the scrollback buffer. However this isn't desirable since floating windows reduce context switching (the less pixels are changed from the original layout to the preview, the less context switching), which increases task-switching costs (i.e. floating windows provide 1) fewer milliseconds lost when switching from one context to another, 2) especially if nested/multiple floating windows, allows keeping more contexts in working memory). This makes any sort of explorative work much, much more productive. Here's a web example of one of my favorite websites applying this masterfully with nested floating windows.

https://www.gwern.net/index

kovidgoyal commented 3 years ago

As far as I know, sophisticated terminal editors like vim already support floating windows, in all terminals, I'm afraid I dont much understand the point of adding separate ones to kitty, which in any case would need buy in from the terminal programs to be actually useful.

If some editor or other terminal program developer is interested in this feature, I am happy to discuss it further, but as it stands I am not going to spend time on this without some committments from terminal program developers that it would actually be used, since I have no use for it personally.

yingzhu146 commented 3 years ago

Totally understand your prioritization @kovidgoyal, thanks for the consideration! Nonetheless here's maybe something that can get you excited:

There is a variety of features that implementation on a kitty level would allow, here's two:

1) kitty image protocol support (main one): example workflow: let's say I have a png file path in my terminal, hover over it in vim, show the png with floating window. 2) cross TUI integration: example use case: view a notebook with https://github.com/joouha/euporie. I can already use e to open something in vim, however, this has the same issues with context switching above. floating window provided by kitty would solve this.

kovidgoyal commented 3 years ago

On Wed, May 19, 2021 at 03:36:23PM -0700, yingzhu146 wrote:

Totally understand your prioritization @kovidgoyal, thanks for the consideration! Nonetheless here's maybe something that can get you excited:

There is a variety of features that implementation on a kitty level would allow, here's two:

1) kitty image protocol support (main one): example workflow: let's say I have a png file path in my terminal, hover over it in vim, show the png with floating window.

This would require support from vim, like I said if you can get some interest from vim or any other developers, I am willing to discuss it. And I am not sure why a floating window is best for this, but if you are OK with a non floating window, this can be done already in kitty, you can define a custom action for the hints kitten to do this, opening the image in an overlay window or a new split or tab.

2) cross TUI integration: example use case: view a notebook with https://github.com/joouha/euporie. I can already use e to open something in vim, however, this has the same issues with context switching above. floating window provided by kitty would solve this.

You can do this already with the kitty remote control protocol, have vim open in a split/tab/new OS window instead of takingover the euporie window. See for example the kitty integration in kakoune.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/kovidgoyal/kitty/issues/3641#issuecomment-844542871

--


Dr. Kovid Goyal https://www.kovidgoyal.net https://calibre-ebook.com