How do I convince spaceFM to send files to the trash bin when I hit DELETE? Right now the files are immediately lost no matter if I use DEL or SHIFT+DEL.

  • Ok, so beginners obviously don't receive answers at this place. Where would I find an appropriate forum for Linux beginners? Thanks.
    – hleg
    Jun 1 '18 at 2:24

I'd like the files to be moved to trash when deleted. But SpaceFM, as I see, doesn't offer this option. So I have created a custom command in the right menu as follow.

  1. Right click for any files. Then right click on any item of the right menu.
  2. A new menu will appear. Click "New > Command"
  3. A new window will appear asking a name for new command. I entered "Move to Trash" and pressed OK
  4. A new window appeared asking for the custom command. I entered the following command:

    zenity --list --width=400 --height=150 --title='Confirmation' --text='Are you sure you want to move the following files to trash?' --column='Path' %F; (( $? == 0 )) && trash %F

That's it.

By the way I wanted to hide the built-in "Delete" option from the right context menu. I couldn't remove the built-in command. But in the properties of the menu item, I found "Context" tab which is offers rules when to appear and when disappear. I created a new rule something like "show" when "filename ends with .xyz". So the built-in "Delete" commands start to appear only on ".xyz" files. :)

Hope it helps.

Original post: https://mim.mbirgin.com/?c=posts&id=103

  • thanks but my ubuntu budgie says gtk doesnt like it so I still dont have "move to trash"
    – hleg
    Oct 19 '19 at 11:01
  • I don't know about ubuntu budgie. Is the gtk problem you mentioned because of zenity?
    – podcast
    Oct 23 '19 at 9:56
  • In my ubuntu 18.04, trash %F didn't work. Instead I used gio trash %F as suggested here Sep 14 '20 at 4:59

I made so:

  1. I created a Bookmark to the Trash /home/ste/.local/share/Trash/files (and choose the "Trash" icon for it).

  2. On the Bookmark side-panel I created (Right Click → New → Command) a command named "Empty Trash" with command zenity --question --text="Are you sure you want to empty Trash %F?" && rm -rf ~/.local/share/Trash/* %F

  3. I've taken away the shortcut for "Delete" option: Right Click on a item → Right Click on "Delete" → Properties → Key → Unset

  4. I've hidden the "Delete" option: Right Click on a item → Right Click on "Delete" → Properties → Context → show if... I've added a new "impossible" rule (Filename → contains "sdiofbhvnklsdhfvossdö" oe something like this!)

  5. I've created a new option in the item menu for moving to trash: Right Click on a item → Right Click on something on the apeeared menu → New → Command → now a new command named "Delete" and then a shortkey (→ Key Delete) and then an icon (→ choose → Trash icon!) and then → Command → trash %F.

Now I've the same system as in Thunar or something like this.

  • In my ubuntu 18.04, trash %F didn't work. Instead I used gio trash %F as suggested here. Also, icon Trash is renamed to user-trash Sep 14 '20 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.