Files disappear when moved to unavailable trash of Nautilus

Use GNOME Files (Nautilus) independently with Hyprland. The trash functionality is unavailable by default (showing “operation not supported”), but the “Move to Trash” button in right-click menu can still be triggered, resulting in that the file just disappears. Where does it go?

You can enable the virtual file system module responsible for trash with services.gvfs.enable = true; NixOS option. Note that you will need to re-log in since the module sets environment variable.

Deleted files from the partition containing your home directory will typically end up under ~/.local/share/Trash – the files themselves will go to files subdirectory and the metadata (e.g. original location) will go to info. On other partitions the directory is .Trash in the root of partition.

Thanks. It works well. By the way, accroding to ArchWiki, there is some mount functionality shipped with Gvfs, which should be enabled by running Files as a daemon or using an additional utility. Is it necessary if I just want to use the trash functionality?

If you are referring to File manager daemon, that section is quite confusingly written. I doubt most desktop environments will start file manager in daemon mode, GNOME certainly does not do that for Nautilus. Nautilus will continue to hang around in the background for ~15 seconds after the last window is closed to avoid startup cost in case a new window is opened shortly after but that’s it for running in background. The relevant section is the Standalone mount application, which is the role of GVfs daemon.

If you really want, you can rebuild gvfs with most of its backends disabled with the services.gvfs.package NixOS option using something lke the following (untested):

services.gvfs.package = (pkgs.gnome.gvfs.override {
  # Disable some optional features
  # See https://github.com/NixOS/nixpkgs/blob/95adb0c1322a8aeda79a0c7c063b24e3f5204f84/pkgs/development/libraries/gvfs/default.nix#L116-L140
  udevSupport = false;
  gnomeSupport = false;
  avahi = null;
  samba = null;
}).overrideAttrs (attrs: {
  mesonFlags = attrs.mesonFlags ++ [
    # Disable some more services.
    # For available options see https://gitlab.gnome.org/GNOME/gvfs/-/blob/1.50.6/meson_options.txt
    # See gvfs(7) for info about various daemons provided https://man.archlinux.org/man/gvfs.7.en
    "-Dafc=false"
    "-Dafp=false"
    # Maybe some more are needed.
  ];
});