andreafrancia / trash-cli

Command line interface to the freedesktop.org trashcan.
GNU General Public License v2.0
3.58k stars 179 forks source link

Trash-cli doesn't send the file to macOS's recycle bin or allows to send to another trash path #284

Closed petrocino closed 10 months ago

petrocino commented 1 year ago

It's a weird behavior of it. It sends to a local hidden dir on home:

ls -la .local/share/Trash  
total 0
drwx------@ 4 petrocin  staff  128 Jan 18 09:13 .
drwxr-xr-x@ 3 petrocin  staff   96 Jan 18 09:13 ..
drwx------@ 9 petrocin  staff  288 Jan 18 12:02 files
drwx------@ 9 petrocin  staff  288 Jan 18 12:02 info

trash-cli version 0.22.10.20

Are you using the latest version of trash-cli? Yes

Have you tried if the bug is present in the latest version of trash-cli? Yes

Operating system:

To Reproduce Copy and paste the commands (and their output) to execute in order to reproduce the behavior:

ls -la .local/share/Trash  
total 0
drwx------@ 4 petrocin  staff  128 Jan 18 09:13 .
drwxr-xr-x@ 3 petrocin  staff   96 Jan 18 09:13 ..
drwx------@ 9 petrocin  staff  288 Jan 18 12:02 files
drwx------@ 9 petrocin  staff  288 Jan 18 12:02 info

Expected behavior I would like to define where my trash will be located (eg. $HOME/garbage), or send it to macOS recycle bin, which is more reasonable to me.

I know that I can use the --trash-dir TRASHDIR option, but would be much better to have a .trash-config file, or somehow a way to define it on .zshrc file

andreafrancia commented 1 year ago

https://github.com/andreafrancia/trash-cli/issues/284

Alternative to trash-cli in macOS

trash-cli is designed for Linux, on macOS I suggest to use the trash command by Ali Rantakari. It is available at https://hasseg.org/trash/ This program work well with the Bin of macOS.

You can install it with:

$ brew install trash

The trash API in macOS is broken and does not track the original path. This trash command can work around this problem with the -F option that make it to uses the Finder application as backend.

I've put this alias in my .zshrc:

alias trash='/opt/homebrew/Cellar/trash/0.9.2/bin/trash -F'

~/.trash-config file

At the present trash-cli does not support a config file. The workaround is using aliases in your .zshrc file.

Example:

alias trash-put='trash-put --trash-dir ~/garbage'