I want to make a trash icon for my dock. Dash to Dock does not have a trash icon that I can add, so I was going to make one. I want the Trash full icon when something gets added to the trash, and I want the Trash Empty icon for when there is nothing in the trash. Can somebody please tell me how to do this? Here is my desktop file:
[Desktop Entry]
Type=Application
Name=Trash
Comment=Trash
Icon=user-trash
Exec=nautilus trash://
Categories=Utility;
Actions=trash;
[Desktop Action trash]
Name=Empty Trash
Exec=/home/zacharygough/trash.sh -e
Automatically change the icon of a .desktop file, depending on the state of the trash can
The tiny scrip uses
Gio.Filemonitor
to watch the state (empty or not) oftrash:///
How to use
watchout.py
Replace in the lines:
...the
self.fpath
, and if you want theself.iconempty
and theself.iconfull
Run the script with the command:
That's it!
If all works fine, add the very same command to Startup Applications.
The script