Comments (5)
this solution works, but is not optimal:
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
from trash-cli.
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.
from trash-cli.
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:
from trash-cli.
Or maybe this: https://help.gnome.org/users/zenity/stable/usage.html.de
from trash-cli.
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.
from trash-cli.
Related Issues (20)
- Cannot restore a file from a mounted cifs volume HOT 10
- verbose output HOT 1
- trash-empty: option to only empty files trashed prior to application start HOT 1
- trash-put: cannot trash regular file @raffaem
- Slow trash-empty taking hours to delete HOT 1
- If a trash fails before everything is deleted, all the files that *were* deleted *cannot be restored* HOT 9
- Provide an option to send deleted items to macOS Desktop Trash. HOT 6
- Hitting return on trash-restore without entering a number results in unclear behavior HOT 1
- Crash while removing file/dir wth utf-8 chars HOT 2
- [Question] How to correctly answer "Proceed? (y/n)" when using trash-empty in script? HOT 4
- Crash with `--volumes`: AttributeError: 'PrintVolumesList' object has no attribute 'run_action' HOT 1
- ZSH completion very slow HOT 3
- Add option to preserve folders containing recently modified files
- ZSH completion does not allow to specify multiple files to trash HOT 1
- Don't force user to install old mock library HOT 10
- I have a number of bind mounts, and `trash-list` shows trashed items without any duplication. HOT 4
- having `--dry-run` for `trash-put` HOT 4
- PermissionError in trash-empty incorrectly user's .Trash folder HOT 1
- Add a way to trash from stdin HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trash-cli.