#464 TODO: Items in trash can cannot be opened by applications.

libfm (303)

Items in trash can cannot be opened by other applications. Only "Restore" is available by default.
This is caused by the limitation of GVFS and GIO. That's why gnome/nautilus doesn't support this, either.
I, however, found a good and easy way to overcome this.
The filenames listed in trash:/// by gvfs are carefully encoded to carry important information.

Handling of trashed file name can be found in gvfs source code:
gvfs/daemon/trashlib/trashitem.c: trash_item_escape_name().

The filename listed under trash:/// are encoded according to the real path on disk.
Basically gvfs takes the original real path of the file, and then encode and escape it.
All / characters are replaced by \ and \ chars are replaced by "`\".
So if we can unescape the filename, we can get the real path on disk.
Then we can pass its real path to applications to open them.
Hence we can provide what nautilus can't do.

This should be a TODO item for next release after 0.9.9.


  • PCMan

    PCMan - 2011-08-08
    • priority: 5 --> 7
  • PCMan

    PCMan - 2011-11-18
    • labels: --> libfm
    • milestone: --> 2297538
    • priority: 7 --> 4
  • Lonely Stranger

    Lonely Stranger - 2012-07-16
    • milestone: 2297538 --> 2334041
  • Lonely Stranger

    Lonely Stranger - 2012-07-17
    • status: open --> open-later
  • Lonely Stranger

    Lonely Stranger - 2012-09-23

    I'm afraid it may require own trash:// implementation since gvfs < 1.13.3 cannot be queried for real path.
    Therefore applications that don't handle %u parameter cannot get real file name (%u can be handled as URI for file exists of course).
    Another option is to add 'Try to open' replacement for 'Open' in context menu.

  • Lonely Stranger

    Lonely Stranger - 2012-09-23

    And your solution isn't valid - that is 'original path' which you've described above and that can be retrieved (that's "trash::orig-path" attribute) but file doesn't exist in that place anymore so that will not help. Real file is in .local/Trash, or somedisk://.Trash-XXXXX, etc. Are you want to scan all mounted volumes for trash directories? It will mean exactly creating own trash:// implementation. I'm sorry.

  • Lonely Stranger

    Lonely Stranger - 2013-08-31

    This issue should be handled in 1.2.0-beta0 version of libfm - applications that can open such files are available in context menu and will open those files. Test it, please, when it's possible for you.
    Thank uou very much.

  • Lonely Stranger

    Lonely Stranger - 2013-08-31
    • assigned_to: pcmanx --> lstranger
    • milestone: 2334041 --> 1.2
    • status: open-later --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks