Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag&drop URL to kitty #2441

Closed
ondrejj opened this issue Mar 18, 2020 · 19 comments
Closed

Drag&drop URL to kitty #2441

ondrejj opened this issue Mar 18, 2020 · 19 comments

Comments

@ondrejj
Copy link

ondrejj commented Mar 18, 2020

Please, allow dropping URL from browser to kitty.

In most cases I need to download some files from browser to a remote ssh session. It's too complicated to download them to local machine and then send to server. It's easier to drag&drop them to terminal's ssh session.

In other terminals I can just type "wget " command and then drag&drop multiple URLs to this command.

It would be nice to configure, how this URL will look in terminal, for example add one space at end or send it in apostrophes or quotation marks.

Currently it's possible to copy URL from browser and paste it to kitty terminal, but doing this for multiple URLs takes too long time.

@kovidgoyal
Copy link
Owner

I dont understand. You are asking for the ability to drag and drop
selected text into the terminal? Why not just middle click?

@ondrejj
Copy link
Author

ondrejj commented Mar 18, 2020

For example sometimes I am installing packages on Fedora/CentOS from koji. I should open this url:
https://koji.fedoraproject.org/koji/buildinfo?buildID=1478496
And download/install some packages on my system. Before I used gnome-terminal, where I was able to drag&drop these URL links to terminal, which results in pasting URLs to currently typed command (for example wget). So it's easy to copy files from web to terminal, same for installation files, images, documents, ...
In kitty I have to right-click on URL, select Copy URL link and paste.
For 5 or more files this is very complicated.

@Luflosi
Copy link
Contributor

Luflosi commented Mar 18, 2020

fyi this already works on macOS. ofc it would be nice if this also worked on Linux.

@kovidgoyal
Copy link
Owner

yeah you dont need to right click, etc. Just select the url and then
middle click in kitty. Much easier than drag and drop.

@ondrejj
Copy link
Author

ondrejj commented Mar 18, 2020

How I can select an URL in firefox? If I click it, then it's opened directly. Unable to select URL in browser, I only can copy address link by right-clicking and selecting copy URL ... :-(

@kovidgoyal
Copy link
Owner

How are you selecting it for drag and drop? And the usul way is to start
the lick just outside the URL and drag

@ondrejj
Copy link
Author

ondrejj commented Mar 18, 2020

URL is not displayed on page, unable to select it. Firefox on drag of a href element will drag it's URL (href link), not selected text below.
I don't understand. What do you mean with "start the lick"?
Try on my URL mentioned below. First "download" link (in src) should result in:
https://kojipkgs.fedoraproject.org//packages/firefox/74.0/9.fc31/src/firefox-74.0-9.fc31.src.rpm

@kovidgoyal
Copy link
Owner

start the click. not start the lick, typo. If the URL is not displayed then obviously it wont work.

@ondrejj
Copy link
Author

ondrejj commented Mar 18, 2020

How I can start the click but do not click?
Obviously "a href" URLs are not displayed and an text about them is displayed.
Works perfectly with all terminals except kitty. :-(
I like kitty, everything works well in it except this.

@trygveaa
Copy link
Sponsor Contributor

It took me a bit to understand that you mean a link where the text isn't the url itself. It would have been clearer if the link you posted here on github didn't contain the url in the text.

So, what you mean is that with this link, you would have to right click to be able to copy it, while if you could drag it, right clicking wouldn't be necessary.

@kovidgoyal
Copy link
Owner

well that's a bug in firefox. It is producing a drag and drop event
without the standard mime type text/uri-list, which kitty supports.
Instead it has text/x-moz-url and _NETSCAPE_URL

@trygveaa
Copy link
Sponsor Contributor

trygveaa commented Mar 18, 2020

It doesn't work with chrome either for me. Though, for me it doesn't work with any other terminals either (I tried xterm, urxvt, alacritty and termite). But it works between chrome and firefox.

@ondrejj
Copy link
Author

ondrejj commented Mar 18, 2020

Any chance to support text/x-moz-url and _NETSCAPE_URL in kitty? Looks like all other terminals supports this. Curious, that this works in macos, as mentioned in comment #3.

@Luflosi
Copy link
Contributor

Luflosi commented Mar 18, 2020

It works on macOS because NSPasteboardTypeString is accepted as a dragged type:

[self registerForDraggedTypes:@[NSPasteboardTypeFileURL, NSPasteboardTypeString]];

I implemented this in #1921.

@ondrejj
Copy link
Author

ondrejj commented Mar 18, 2020

Your patch is working well. Thank you very much.

@ondrejj
Copy link
Author

ondrejj commented Mar 19, 2020

One more thing. As I described in issue description, it would be nice to have configurable dropping/pasting in terminal. For example drag&dropping multiple URLs serially requires to add space after each paste.

Is it possible to configure this or to write kitten to do this? For example if URL starts with http:// or https://, then an space after it is a good idea.

Some better terminals already implement this.

@kovidgoyal
Copy link
Owner

seems like a bad idea to me. How is kitty to know what trailing character
is required? Could be a quote or a space or something else, depending on
the situation. Simply type the character after dropping a URL.

@ondrejj
Copy link
Author

ondrejj commented Mar 19, 2020

Should be configurable, what character should be used. But mostly one space is better than nothing.

Yes, I can type a space manually, but then this procedure should be used:

  1. drag&drop url from firefox to kitty
  2. switch to kitty by clicking on it
  3. press space
  4. switch to firefox again

4th step can be sometimes skipped, if URL is still visible, but not always.
When a space is added, then it's only one step.

At least it's possible to extend dropping in kittens?
Can I map some commands to drop events?

@kovidgoyal
Copy link
Owner

kovidgoyal commented Mar 19, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants