You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dnd-protocol.rst
+29-23Lines changed: 29 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,16 +48,6 @@ The list of MIME types is optional, it is needed if the program wants to accept
48
48
exotic or private use MIME types on platforms such as macOS, where the system
49
49
does not deliver drop events unless the MIME type is registered.
50
50
51
-
The terminal emulator may respond to this escape code with an escape code of
52
-
the form::
53
-
54
-
OSC _dnd_code ; t=a ; machine id ST
55
-
56
-
Here, the :ref:`machine id <machine_id>` is an id that identifies the machine
57
-
the terminal is running on and can be used by the client to determine whether
58
-
to request remote files from the terminal when a drop occurs.
59
-
See :ref:`below <machine_id>` for the semantics of the machine id.
60
-
61
51
When the client is done accepting drops, or at exit, it should send the escape
62
52
code::
63
53
@@ -143,12 +133,17 @@ Dropping from remote machines
143
133
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144
134
145
135
In order to support dropping of files from remote machines, the client
146
-
can use the :ref:`machine id <machine_id>` previously sent by the terminal.
147
-
If it is different from the id of the machine the client is running on, it
148
-
can choose to request remote files, as follows.
136
+
must inform the terminal of its :ref:`machine id <machine_id>` using the escape code::
137
+
138
+
OSC _dnd_code ; t=a:x=1 ; machine id ST
149
139
150
-
Clients can first request the :rfc:`text/uri-list <2483>` MIME
151
-
type to get a list of dropped URIs. For every URI in the list, they can
140
+
Then, the client must first request the :rfc:`text/uri-list <2483>` MIME
141
+
type to get a list of dropped URIs. When responding to this request,
142
+
the terminal will send the usual ``t=r`` responses, but, in addition,
143
+
if the client has sent its machine id and the terminal determines that
144
+
the client is on a different machine based on the id, it will add the ``X=1``
145
+
key to its response. The client should use this key to determine if it wants to
146
+
request data for entries in the URI list. For every URI in the list, the client can
152
147
send the terminal emulator a data request of the form::
153
148
154
149
OSC _dnd_code ; t=r:x=idx:y=subidx ST
@@ -486,11 +481,22 @@ Key Value Default Description
486
481
Machine id
487
482
-----------------
488
483
489
-
The machine id is used to detect when a drag is started on a remote machine. It
490
-
is of the form: ``version:ASCII printable chars``. The leading ``version`` field
491
-
allows for changing the format or semantics of this field in the future. The
492
-
actual id is the machine id (the contents of :file:`/etc/machine-id` on
493
-
Linux/BSD and :file:`HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\MachineGuid` on Windows and ``IOPlatformUUID`` on macOS). This machine id is then hashed using a :rfc:`HMAC <2104>`
494
-
with :rfc:`SHA-256 <6234>` as the digest algorithm and the key being the ASCII bytes:
495
-
``tty-dnd-protocol-machine-id``. The hashing is done so as to not easily leak the
496
-
actual machine id and to ensure that the value is of fixed size.
484
+
The machine id is used to detect when the source and destination machines for a
485
+
drag and drop are different. It is of the form: ``version:ASCII printable
486
+
chars``. The leading ``version`` field allows for changing the format or
487
+
semantics of this field in the future. The actual id is the machine id (the
488
+
contents of :file:`/etc/machine-id` on Linux/BSD and
489
+
:file:`HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography\\MachineGuid` on
490
+
Windows and ``IOPlatformUUID`` on macOS). This machine id is then hashed using
491
+
a :rfc:`HMAC <2104>` with :rfc:`SHA-256 <6234>` as the digest algorithm and the
492
+
key being the ASCII bytes: ``tty-dnd-protocol-machine-id``. The hashing is done
493
+
so as to not easily leak the actual machine id and to ensure that the value is
494
+
of fixed size. This gives a final value of::
495
+
496
+
1:hashed machine id hexadecimal encoded
497
+
498
+
In the future, the ``version`` field may increase if the hashing algorithm is
499
+
changed. If the terminal sees a version it does not understand, it must assume
500
+
that the machine id does not match, aka the source and destination machines are
501
+
different. This assumption means that remote drag and drop will still work, just with
0 commit comments