! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Make a "size on disk" for files and directories
Status:
RESOLVED: WONTFIX
Severity:
enhancement

Comments

Description brunoaiss+xfce 2019-10-05 14:40:06 CEST
Created attachment 9085 
Properties window with "size on disk" of explorer

I believe it would be useful to users of Thunar to have a "size on disk" ability incorporated into Thunar itself.
"Size on disk" is a feature explorer has (windows) which shows the real size the selected files are taking on disk. (see attachment)

I believe it makes sense for Thunar to incorporate a "size on disk" for file systems that support compression and equivalent where files may take a larger portion in the storage than their respective size.

In my knowledge only AFS, BtrFS, HFS+, JFS, NTFS and zfs support transparent compression.

I only know how to get the "size on disk" for btrfs but I believe someone can come up with an algorithm for the others. As such, I believe it should be easy enough to plugin ways of getting the size on disk into Thunar's details window.

As for btrfs. The steps, unfortunately, requires superuser; fortunately, this code can run in C and making use of setuid().

The steps are:
ioctl() call: https://github.com/kilobyte/compsize/blob/master/compsize.c#L193
calculations to get the values here: https://github.com/kilobyte/compsize/blob/master/compsize.c#L201-225
final calculations here: https://github.com/kilobyte/compsize/blob/master/compsize.c#L118-178
radix tree used for calculations: https://github.com/kilobyte/compsize/blob/master/radix-tree.c

The license of that code above is GPLv2.
The rest of the code is UI.

How feasible is such feature on Thunar?
Comment 1 alexxcons editbugs 2019-10-05 22:36:22 CEST
Sorry, it does not sound good to me to introduce a feature which only can be used as superuser, and on top only possibly could be of any use for a small fraction of people, running specific filesystems.
( Not to mention that the "size on disk" most times will be nearly the same than the "size" )

If there is a way to get "size on disk" without superuser powers, we can talk again :)
Best write a custom-action for your use-case .. we could than show it here: https://docs.xfce.org/xfce/thunar/custom-actions

Or, if you want to go advanced, you can add an additional tab to the properties dialog by writing a thunar-plugin. (e.g. RabbitVCS does so)
Comment 2 brunoaiss+xfce 2019-10-06 00:55:14 CEST
I want to go advanced.
Where can I find documentation on how to add a tab to properties with content the way I want?
I was looking at the source code of media tags plugin but I didn't fully get how to use thunarx.
Comment 3 alexxcons editbugs 2019-10-06 21:12:22 CEST
media tags plugin is a nice starting point.

Looks like you need to implement the interface  THUNARX_TYPE_PROPERTY_PAGE_PROVIDER  (See https://git.xfce.org/thunar-plugins/thunar-media-tags-plugin/tree/thunar-plugin/media-tags-provider.c#n59 )
Not sure if it is required to as well implement the THUNARX_TYPE_RENAMER_PROVIDER ... probably the first one is sufficient.

If you dont know how to start, just checkout the media tags plugin, rename it relevant parts, and modify it until it fits your needs / drop anything you dont need.

( Actually I never did thunar plugin development ... thats new for me as well ;) )

Bug #16011

Reported by:
brunoaiss+xfce
Reported on: 2019-10-05
Last modified on: 2019-10-06

People

Assignee:
Xfce Bug Triage
CC List:
1 user

Version

Attachments

Additional information