Ticket #251 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

drag&drop handling

Reported by: ulidtko Owned by: ulidtko
Priority: Fix available Milestone:
Component: guake Version: 0.4.2
Keywords: Cc:

Description

As a GNOME application, Guake should be integrated with it well. In particular, it should support drag&drop of files, directories, and [ .desktop objects] into the terminal.

Assuming that most of the time terminals in Guake are hosting shell instances, it would be reasonable to insert:

  • filenames of dropped files
  • dirnames of dropped directories
  • depending of the type of dropped Desktop Entry:
    • Exec lines for Desktop Entries of Type=Application
    • URL lines for Desktop Entries of Type=Link

The necessity and proper way to quote and/or escape inserted strings are subject to discuss.

Attachments

dnd.patch Download (1.6 KB) - added by adamof 3 years ago.
accept-drag-n-drop-of-files-and-URIs.patch Download (3.8 KB) - added by ulidtko 3 years ago.
version with better handling of URIs and shell escaping
0001-251-accept-drag-n-drop-of-files-and-URIs.patch Download (3.5 KB) - added by ulidtko 2 years ago.
0002-251-handle-XDG-desktop-entries.patch Download (2.3 KB) - added by ulidtko 2 years ago.

Change History

Changed 3 years ago by ulidtko

  • priority changed from Fix available to major

Changed 3 years ago by adamof

  • owner changed from somebody to adamof
  • status changed from new to assigned

I added that feature. I will just make the code prettier and attack it

Cheers; )

Changed 3 years ago by adamof

Changed 3 years ago by ulidtko

version with better handling of URIs and shell escaping

Changed 3 years ago by ulidtko

attachment:accept-drag-n-drop-of-files-and-URIs.patch Download

Implemented some of the requested behavior: Guake accepts drag-and-drops of MIME type text/uri-list, url-unescapes received uris, then shell-quotes them as necessary and inserts to the terminal. URIs with file scheme are converted to paths, whereas other schemes are left as is (this would allow for e.g. wget'ting of http and ftp uris).

Although i have faced significant problem: Guake loses keyboard focus after drag-and-drops from some applications, and this annoys a lot. self.window.grab_focus() didn't help, and for now i can't resolve this rather important issue.

Changed 2 years ago by ulidtko

  • owner changed from adamof to ulidtko
  • status changed from assigned to new

Changed 2 years ago by pingou

Should we set the priority to "Fix available" now that 2 patches have been proposed ?

Changed 2 years ago by ulidtko

Unfortunately, my patch still has a problem which I didn't solve: Guake loses focus right after accepting dnd. This is incredibly annoying. It has something to do with WM focus transferring policy, as the problem doesn't show up without a WM; but I still didn't solve this, and it's very ugly.

The second patch is somewhat worse, so I guess it's kind of early to set "Fix available" status yet =\

Changed 2 years ago by ulidtko

Changed 2 years ago by ulidtko

Changed 2 years ago by ulidtko

  • priority changed from major to Fix available
  • status changed from new to assigned

Ok, so now I am considering the code as finished. The focus issue I described somehow faded and it's pretty comfortable to use drag-n-drop now.

I also updated the second patch. XDG desktop entries are handled as follows:

  • Entries of type Link are turned into URLs (by looking up the URL key), concatenated along with other files and Link entries and pasted into the terminal.
  • Entries of type Application are treated specially: if drop contains more than one object, they are ignored (this will avoid possible confusion); else the Exec key is being looked up and its contents is pasted into the terminal. This has nice properties that when the user drops *one* Application desktop entry (which he may drag from his quick launch panel, or dock, or main menu) and immediately hits Enter — the application is launched in the terminal like just being clicked on the icon. Off course, before hitting Enter he may setup some shell pipes for logging or anything else.
  • Entries of other types (namely, Directory) are ignored. I haven't found and was not able to produce any desktop entries of type Directory on my Gnome desktop. Produced entries have type URL and point to the target directory by file:// URLs.

Changed 2 years ago by ulidtko

  • status changed from assigned to closed
  • resolution set to fixed

 329f80fb and  dc46f5ae merged in master.

Note: See TracTickets for help on using tickets.