[RESOLVED] Trash module for polybar

Does anyone have a pretty decent trash module for polybar that they would be willing to share?

Thanks -n- Cheers!

I actually found one and reworked it just a bit. I found it here:
Polybar - Trash

Here is the actual script part (not the module entries) with my addition for a true zero instead of it showing 1 even though there isnt any trash.


case "$1" in
        rm -rf $HOME/.local/share/Trash/files
        rm -rf $HOME/.local/share/Trash/info
        mkdir $HOME/.local/share/Trash/files
        mkdir $HOME/.local/share/Trash/info
        # find $HOME/.local/share/Trash/files/ -maxdepth 1 | wc -l
         du -a $HOME/.local/share/Trash/files/* 2>/dev/null | wc -l

I find that du works better and give a true result and probably a bit cleaner. I use du in my mail notification also.


Hmm - since the above works for the graphical side of things (such as using pcmanfm) I also wanted this to work when I’m in a terminal. I come up with this alias (for better or worse, it does work pretty well).

alias rm='mv -t $HOME/.local/share/Trash/files/ $1'

Not only does this move the files, it also works fairly well for directories.
I know there are other options and cleaner ways of doing this, this does work and wanted to throw something together quickly.
And with the addition I added to the 1st posting script, I always get an accurate amount of items in the trash notification.

If anyone wishes to advise on a cleaner way of doing this, I’ll gladly look at them!!


Glad that you got it sorted out, nice solution @Chris