Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm Dialog on trash-empty #319

Open
bim4n opened this issue Nov 3, 2023 · 5 comments
Open

Confirm Dialog on trash-empty #319

bim4n opened this issue Nov 3, 2023 · 5 comments

Comments

@bim4n
Copy link

bim4n commented Nov 3, 2023

Empty the trash worx fine, but very silently,
Sometimes need a Confirmation Dialog like this:

Screenshot from 2023-11-05 21-05-36

Can you implement it ?
a.E. trash-empty --confirm

@andreafrancia
Copy link
Owner

Yes, it is something that should be added to trash-empty.

I'm thinking of adding a confirmation prompt, instead of a GUI confirmation.
Something like this:

$ trash-empty
Are you sure? (yes/no) 

I'm not confident to add a GUI prompt right now.
If you already have a command that prepare the GUI prompt we can see how it can be called from trash-empty.

@bim4n
Copy link
Author

bim4n commented Nov 5, 2023

I found this sources for UI-Dialog: https://packages.debian.org/sid/dialog
and: https://packages.debian.org/source/sid/dialog

It would be nice when the confirmation did not always come but only via a parameter.
For terminal: trash-empty --confirm
For automation with GUI Dialog: trash-empty --confirm-ui

What do y think about ?

I use your script for a custom shortcut in kali linux:

Screenshot from 2023-11-05 21-21-52

@bim4n
Copy link
Author

bim4n commented Nov 5, 2023

@bim4n
Copy link
Author

bim4n commented Nov 5, 2023

this solution works, but is not optimal:

Screenshot from 2023-11-05 22-13-39


Script-File: empty-trash.sh

#!/bin/bash

count=$(ls -l ~/.local/share/Trash/files/ | grep -v ^- | tr -d "total ")

if [ $count -eq 0 ]
then
    exit
fi

zenity --question --text="Empty all items from Trash?" --ok-label "Empty Trash" --cancel-label "Cancel"

if [ $? -eq 0 ]
then
    trash-empty
fi

@andreafrancia
Copy link
Owner

I think this is a good solution, and it is good that GUI elements are outside of the trash-cli package.
In this way trash-cli will continue to be easy to be installed in environment that does not have zenity and/or a graphical environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants