Fluid time format and custom properties in donnatella
Freshly pushed to the branch next
on donnatella's
github are a few commits,
some fixes and other improvements here and there of course, as well as the
introduction of a new time format called "fluid" and some changes regarding
custom properties.
First off, the obligatory screenshot that might make everything obvious in seconds:
The "fluid" format
As seen previously, donnatella allows you to use a format string to chose how dates/times should be represented, and besides the many usual specifiers, even adds one to show the age (e.g. 42 min ago).
Now I'm adding another one, which you might actually already be familiar with since, giving proper credits, it's very much inspired from what the GTK2 file chooser uses.
The idea is that when the file (let's make this easy and pretend we're talking about the modified timestamp of a file) was modified today, only the time will be shown. If it was modified yesterday, the time will be prefixed with "Yesterday". If modified within the last 7 days, the weekday will then be prefixed instead; And when modified before that, the date is then shown.
This actually makes for a very simple way to get a sense of when a file was
modified, while still getting the actual information (e.g. as opposed to using
the age). Of course, the actual time & date formats used can be configured via
new options (fluid_time_format
and fluid_date_format
), and you can also
decide whether to use the full or abbreviated weekday via boolean option
fluid_short_weekday
.
When showing the date, only the date format is used, allowing you to choose whether to only shown the date and also include the time, as you wish. In the screenshot above, for example, the time was included in the time format as well.
You might also suspect that a new column option was introduced for a few
columntypes, such as time: align
So you can align the column's content on
left, center or right as you please.
It might be worth noting that this is (obviously) implemented in donnatella, which means you get pretty much the same behavior as with GTK2 filechooser (only customizable). Because things changed with GTK3, and though the filechooser still uses similar formatting rules, it's a bit different: e.g. it will show only the time not when the file was modified today, but when it was done within the last 24 hours. How is that an improvement and not just annoyingly confusing I don't know, but then again recent changes in GTK3 have left me perplexed before... Luckily donna isn't affected here.
Why the name, "fluid" ?
Short version: the specifier f
was available, and it seemed to match somehow.
Long version: See short version.
Incompatible changes regarding custom properties
From now on, the output parsed by donnatella to refresh custom properties has
changed a bit: instead of using colon (:
) as separator, the pipe sign (|
)
should now be used.
So any definition or scripts you might have been using will need to be updated.
Why? Simply because it works just as well, but given its special meaning on a shell, I'll guess files are less likely to contain a pipe sign than they are a colon.
Custom properties: new option "use_nuls"
Why if you have files with pipe signs in them? Well, set new option use_nuls
to true
when defining your custom properties, and a different parser will be
used, one that still use pipe sign as separator (though no more LF), but also
expects both filename and property value to be NUL-terminated strings.
For example an output could look like the following:
<FILENAME><NUL>|<PROPERTY>|<VALUE><NUL><FILENAME><NUL>|<PROPERTY>|<VALUE><NUL>
What's the "Uncomp." column in the screenshot?
Just another example of what can be done with custom properties in donna. Specifically, this column shows the uncompressed size of each file.
How does it do that? Well, xz
can give the information so all you need is to
create a custom property to get it, e.g:
[custom_properties/]
domain=fs
filter=name:"+f" AND name:"$.xz"
[custom_properties//uncompressed_size]
type:cp-type=uint
cmdline=sh -c 'xz -l --robot %:n | awk '"'"'/^name/{print $2"|"} /^file/{print "|uncompressed_size|"$5}'"'"
Now imagine you have a column defined as such:
[defaults/lists/columns/uncompressed_size]
type:ct=size
property=uncompressed_size
title=Uncomp.
width=80
And you could get something like what you saw in the screenshot earlier. Simple as that.
Where to get it?
For Arch Linux users, you can use donnatella-git in the AUR to easilly get it. Or simply clone the git repo from github and compile things yourself.
For a a complete list of all changes/bug fixes please refer to the git log.
And in case you read all that and are wondering what donnatella is, or are looking for more information, download links, etc please refer to donnatella.
As always, bug reports, suggestions or any other form of constructive criticism is very much welcome. You can open issues on github, use the thread on Arch Linux forums, or simply email me.