-
-
Notifications
You must be signed in to change notification settings - Fork 136
Description
First of all, thank you for this program! This is the first time I have seriously considered using a file manager in the terminal, rather than just using system utilities to manage files. Since I'm familiar with Vim, using Vifm is a breeze, and it feels light and simple too, as opposed to ranger.
I am facing an issue with configuring the trash directory, so that it is compliant with the XDG Desktop Trash Can Specification, for interoperability with other tools, such as trash-cli
and Dolphin.
In the manual, I found the following information:
Trash directory in vifm differs from the system-wide one by default, because of possible incompatibilities of storing deleted files among different file managers.
This isn't really true, as any compliant tool will store the trashed data in the way defined by the specification, and any non-compliant tool should be fixed. As long as Vifm would be compliant, it shouldn't be blamed, so ideally, using the standard location would be the default.
Now, I wanted to try and work around this regardless.
But one can set 'trashdir' to "~/.local/share/Trash" to use a "standard" trash directory.
The trashdir
option is handy. However, the way Vifm stores trashed files is different to the XDG standard - it does not store files in a files
subdirectory, and their metadata in the info
directory, and instead stores deleted files in the parent directory, and keeps metadata separately. Setting trashdir
to ~/.local/share/Trash
would thus store trashed files in the ~/.local/share/Trash
directory, rather than in ~/.local/share/Trash/files
. There's also the question of filesystem-specific trash directories, which while are supported by Vifm in general, are not taken into account by this advice either.
The best configuration I have found is the following:
set trashdir="%r/.Trash/1000/files,%r/.Trash-1000/files,$HOME/.local/share/Trash/files"
It is, however, far from ideal.
- Since Vifm keeps trash metadata separately, files trashed from Vifm will not be found by other software and vice versa, not allowing for them to be listed, deleted or restored. Emptying the trash completely from either side still works, since that does not require metadata.
- The magic value of
1000
is my UID on the system I'm testing Vifm on. Of course, this can be different on other systems, and requires me to have separate configuration for them, rather than just being able to synchronize one config for all systems. The manual mentions%u
being replaced by the UID, but that only works if it's at the end of the path. - Changing the variable
XDG_DATA_HOME
does not affect the location of the personal trash directory. Changingtrashdir
to use$XDG_DATA_HOME/Trash/files
works if the variable is set, but errors out if it's not, even if the$HOME/.local/share/Trash/files
fallback is provided. - There are other minor differences to the spec, such as that Vifm will not check for the sticky bit or symlinking in filesystem-specific trash directories to ensure security.
I suggest adding an xdgtrash
/standardtrash
option, which would ignore the trashdir
value and enable complete coverage of the XDG specification to cover this usecase. This would preferably be set by default, but if not, that would be fine too.