Skip to content

[RFC] Drag and drop in TUI applications with new dnd protocol #9984

@kovidgoyal

Description

@kovidgoyal

Hi all,

After two months of very involved work, I am happy to announce the Drag and drop kitten is ready for testing/comments. It allows you to drag and drop files between your shell and GUI file manager programs/web apps that require you to drag and drop files etc. It even has the bonus feature of working over SSH
so you can actually drag and drop to transfer files between different computers.

To use it install kitty nightly or build from master and::

    kitten dnd file-to-drag.xyz

Then, start dragging with the mouse inside the window, and file-to-drag.xyz will be dragged and you can drop it onto a GUI file manager or another window running this kitten. You can specify directories as well to drag entire trees.

Similarly, dropping works by running the kitten::

    kitten dnd

Then, drag some files from a GUI file manager or another window running the dnd kitten and drop them onto this window. The files will be copied or moved (depending on which area you drop them) into the current working directory.

The best part is this works even over SSH. So if you just want to quickly transfer some files from one computer to another all you need to so is ssh into the remote computer::

    kitten ssh remote-computer-name

Then, run the dnd kitten on the remote computer::

    kitten dnd files-or-dirs-to-drag

This is a large amount of very new code, that has to integrate with very finicky and under specified platform specific drag and drop APIs, so there likely will be bugs, testing is appreciated.

This kitten is based on a new drag and drop protocol which is specified in docs/dnd-protocol.rst

Comments are welcome, in particular if anyone knows of any conflicting uses of the OSC 72 escape code, let me know. While this RFC is open the dnd protocol is considered under development and subject to change. I imagine this protocol will be of interest to developers of TUI file managers, so maintainers of such projects (or any other interested parties) are welcome to raise concerns about the protocol, if they have any.

Pinging a few people I think might be interested, sorry for the noise:
@leiserfg @sxyazi @toonn @Canop @jarun

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions