Wednesday, August 20, 2008

Size limits for trash

Some weeks ago, one of our customers asked for a nice
feature that was requested 4 years ago the first time
as far as I can see from the bug tracking system.
He wanted an option to set a maximum size for the users
trash like you can do on Windows or MacOSX to avoid situations
where the trash fills 50% of your hard disc and you wonder why
you can't download emails any more ;)

As you can see in bug 79553 and 111861, there are some more
ideas how to improve the space handling of your desktop trash,
so instead of just implementing a static size limit I started
implement most of the features requested there and 3 days later
we have a nice trash space handling now.

When you right click on your trash icon on the desktop and
choose the 'Properties' entry, the appearing dialog will
offer a new tab 'Size Limits' now as shown in the screen shot

Here you can choose whether files that lie in the trash for
longer than X days shall be deleted automatically or whether
there shall be a size fixed limit.

If a size limit is set and your trash is full already, trying
to put another file into the trash will trigger an action that
can be one of the following:

  • Warn user only: A dialog is shown to inform the user that his trash is full and that he has to remove files manually before he can put new files into the trash
  • Delete oldest files from trash: This will remove files (beginning with the oldest one) successively from the trash until the new file fits in
  • Delete biggest files from trash: This will remove files (beginning with the largest one) successively from the trash until the new file fits in
One of the nice features of the trash standard is, that you can have multiple trashes, one for each mount point.
If your administrator has setup these, the trash configuration dialog will look like below:

Now you can configure different size limits for each trash.

As you may have recognized, this patch is for KDE 3.5.9, because our customer is still running that version. I'll try to push that patch
into KDE 3.5.10 and port it forward to KDE 4.2 as well.


slougi said...

Hi. I don't think specifying the size in percent is a very good idea. For an example of why please see here, search for "cache".

slougi said...

Perhaps my previous comment comes off a tad too negatively, didn't mean it that way. Great work on a feature I have sometimes missed myself. :)

Marco said...

Great addition to the trash can!

Is it possible to add a extra option to change the configuration for all trash cans at once ?


maninalift said...

Some of the proverbial girlfriends, parents and grandparents out there never empty their trash and don't realise they should.

KDE 3.5 gives a warning when the hard disk gets full and asks the user whether they wish to open their file manager to free some space. I think that

(a) it would be good if in this case the the size of the trash was checked and an appropriate message was relayed to the user.

(b) a slightly more friendly and explanatory message than "open your filemanager to free-up space". Like

"you should delete any large files you are no longer using, this can be done from $filemanager.

open $filemanager now?

Note: If you send files to trash instead of deleting them, the trash will have to be emptied to free the space."

Andre said...

Nice work you did there!
I agree with the other poster though, better not use a percentage slider exclusively. The possibility of setting the absolute value is very important! If you reckon the maximum file system size of ext3 is 8 TiB you'd have a minimally settable trash size of 80 GiB.

Leo S said...

Nice feature. Thanks!

That situation isn't quite the same. In that case the option was to set a disk cache for history, which will be much much smaller than a trash. I don't think a percentage of the hard drive space is unreasonable for trash.

I think the comment on that page is funny though: "I have a 4 Gig drive, and don't need 40 MB of cache thank you." Seems like a 40MB cache was considered ludicrously big, when now I think the default in FF is 50MB.

As for the multiple trashes, I didn't know that was even possible! For years I've been pissed off at Linux when I trash a big file from my windows partition and it tries to move it to my linux partition. Gotta figure out how to set that up (should really be automatic).

Tim said...

I think your radio boxes should be check boxes. Might you not want to delete old files *and* limit the total size?

Dread Knight said...

Great job!

(checkboxes make sense as well)

James said...

Awesome work :)

I came here with the purpose of saying check boxes not radio buttons, seems I was beat...

Enderandrew said...

I second Tim's post. I'd like to have a maximum size (total size, not percentage) and simultaneously delete files over a certain age.