donnatella, filters, MRUs, scripts, and GTK+ 3.14!
Yes, GTK+ 3.14 has been out for some time now, and it's even been available in Arch's official repos for a little while as well. Unfortunately I haven't been able to find enough time to work on donna as of late, and I didn't follow GTK's developement closely, so when 3.14 was released I had a few patches to rebase, and some to rewrite completely (think rubber band handling, since the internals are now full of gestures).
But I have some (good) news for you, finally.
What's new to next?
First of all, a few things have finally been pushed to branch next
so let's
quickly go over the main ones :
Filters are now a thing.
That is, donna now has a provider "filter" that handles them, and obviously that means a filter can be represented with a node, as is common in donnatella.
The main benefit from this is that now filters can be defined in config, and assigned a name, alias and/or icon name. So when one wants to use a filter, a simple reference to its alias will do the trick, and should that filter need to be updated, it only happens in one simple place. Also, when used in menus they can have a nice name ("e.g. "From yesterday") and/or icon to make things easier.
The location of a filter is that actual filter string itself, with two specials
cases: if it starts with a pipe sign, then what follows is an alias. Note that
when asking for e.g. filter:|y
the node you'll get will be that of the actual
filter, i.e. with for full location e.g. filter:A1d
And, the node filter:
(i.e. with an empty location) refers to a lack of filter, which is a way to set
no filter, or what commands (such as tv_get_visual_filter()
) will return when
no filter is set.
Commands as containers
The node for a command is usually an item that can be triggered. Usually, because it is now possible to prefix the command's name/location with the lesser than sign, in order to get a container instead.
This is obviously only supported for commands that return either a node, or an array of nodes. Then, getting the children of the node/container will trigger the command, returning what the command returned.
This can be useful in e.g. (context) menus; Speaking of which...
A new type of item in context menus
A new context-type combined
has been added when defining a user item in a
context menu. It works like the regular item, with option trigger
for the
trigger/item part, but also reads option container
for the full location of
a container, used for the submenu part of the item.
Obviously, this is intended for used with option "submenus" set to "combine" and allows to define both the item & the submenu part of an item.
Most-Recently Used lists
A new provider "mru" has been added, allowing to manager MRU lists of nodes or
strings. In the later case, the node for the MRU will be an item and the only
way to get items is via command mru_get_strings()
In the former case, the node will be a container, usable just as any other (e.g. in treeviews, menus, etc).
Not unlike filters, asking for the node of an MRU will automatically create it
if it doesn't yet exist, though command mru_new()
allows to perform a
creation, failing if the MRU already exists.
Add $DONNATELLA_CONFIG_DIR and extend $PATH
The environment used when executing things from donna (e.g. from provider exec)
will have an extra variable DONNATELLA_CONFIG_DIR
set to the current
configuration directory, which might be useful for scripts.
Similarly, the $PATH will be extended (unless boolean option donna/extand_path
was set to false) to end with $DONNATELLA_CONFIG_DIR/bin
as well as
subfolder "donnatella/bin" of all system config directories ($XDG_CONFIG_DIRS
)
to e.g. easily run donna-specific scripts.
As an example...
By default the "Selection Filter" item in the list's context menu now makes use
of about all of this, being a item that can be triggered, then using a script
that deals with an MRU of filters, and a submenu made from using some of the new
commands like nodes_add()
to get recently used filters from an MRU as well as
listing all available filters.
So if you're curious about all those changes and wantto known more, have a look at the git log as well as configuration options (and related scripts) regarding the "Selection Filter" menu item.
GTK+ 3.14
Of course a few bugs have been fixed and other minor/internal changes took place. Amongst which is the compatibility with GTK+ 3.14 and the updated patches, also known as gtk3-donnatella.
As hinted earlier, major changes took place in the rubber band handling, as it's been rewritten in GTK+ which now uses GtkGesture to handle all of this. It shouldn't however make any difference from a user point of view, and everything should continue working as before in donna.
Configuration changes
As always, after updating you'll have to update your configuration as well to benefit from all the changes. Here's the diff for this time around, since the last time:
- diff --git a/misc/donnatella.conf b/misc/donnatella.conf
- index 1ab177f..b9810df 100644
- --- a/misc/donnatella.conf
- +++ b/misc/donnatella.conf
- @@ -136,6 +136,7 @@ key_mode_select_foreground=white
- last_location=command:tv_set_location (:active, @config_get_string (donna/last_location))
- marks=command:mark_load (,1)
- registers=command:register_load_all (,1)
- +filters=command:filter_load ()
- # enable when using layout "tm"
- #tm=@tv_set_location(tm,task:/)
- @@ -205,7 +206,7 @@ context_menu_colheader=columns<!columns>,-,:sort_order<!sort_order>,:second_sort
- # some color filters
- [defaults/lists/arrangement/color_filters/]
- -filter=|*.tar.*|*.tgz|*.zip|*.rar
- +filter=|a
- column=name
- foreground=green
- @@ -231,25 +232,25 @@ foreground-rgba=rgb(108,0,0)
- [defaults/lists/arrangement/color_filters/]
- # modified less than an hour ago
- -filter=time:A<=1H
- +filter=|h
- column=time
- foreground-rgba=rgb(0,80,210)
- [defaults/lists/arrangement/color_filters/]
- # modified today
- -filter=time:A0d
- +filter=|t
- column=time
- foreground-rgba=rgb(0,150,200)
- [defaults/lists/arrangement/color_filters/]
- # modified yesterday
- -filter=time:A1d
- +filter=|y
- column=time
- foreground-rgba=rgb(0,200,160)
- [defaults/lists/arrangement/color_filters/]
- # modified this week
- -filter=time:A0V
- +filter=|w
- column=time
- foreground-rgba=rgb(0,180,0)
- @@ -783,11 +784,9 @@ trigger=command:tv_start_interactive_search (%o)
- [key_modes/donna/key_f]
- type:key=spec
- spec:spec=lower,upper
- -trigger=command:tv_set_visual_filter (%o, @config_get_string (filters/%k), 1)
- +trigger=command:tv_set_visual_filter (%o, filter:|%k, 1)
- [key_modes/donna/key_F]
- -type:key=spec
- -spec:spec=lower,upper
- -trigger=command:tv_set_visual_filter (%o, @config_set_string (filters/%k, @ask_text (Enter filter %k,,@config_try_get_string (filters/%k, @tv_get_visual_filter (%o)))), 1)
- +trigger=command:tv_set_visual_filter (%o, @get_node_from (filter, @ask_text (Enter visual filter,, @node_get_property (@tv_get_visual_filter (%o), location))))
- # VF: by age
- [key_modes/donna/key_ampersand]
- @@ -797,16 +796,16 @@ custom_chars=HMSdmVY
- combine=age_unit
- [key_modes/donna/key_q]
- combine=age_unit
- -trigger=command:tv_set_visual_filter (%o, time:A%m%c)
- +trigger=command:tv_set_visual_filter (%o, filter:time:A%m%c)
- [key_modes/donna/key_Q]
- combine=age_unit
- -trigger=command:tv_set_visual_filter (%o, time:A<=%m%c)
- +trigger=command:tv_set_visual_filter (%o, filter:time:A<=%m%c)
- # VF: by size
- [key_modes/donna/key_less]
- -trigger=command:tv_set_visual_filter (%o, size:<=%mM)
- +trigger=command:tv_set_visual_filter (%o, filter:size:<=%mM)
- [key_modes/donna/key_greater]
- -trigger=command:tv_set_visual_filter (%o, size:>=%mM)
- +trigger=command:tv_set_visual_filter (%o, filter:size:>=%mM)
- # F2 to rename
- @@ -1054,8 +1053,12 @@ name=Invert Selection
- trigger=command:tv_selection (%o, i, :all)
- [context_menus/tree_views/selection_filter]
- +type:context-type=combined
- name=Selection Filter...
- -trigger=command:tv_selection_nodes (%o, d, @nodes_filter (@tv_get_nodes (%o, :all), @ask_text (Selection Filter,Enter the selection filter to apply), %o))
- +trigger=&donna-sel_filter %o
- +container=@<nodes_add (@nodes_add(@mru_get_nodes (mru:sel_filter)), filter:/)
- +submenus:enabled=combine
- +menu=sel_filter
- # Timestamp stuff
- @@ -1091,6 +1094,12 @@ children:node-type=items
- sort=true
- left_click=command:tv_goto_line (:active, s+f, @nodes_io (%n, c, @tv_get_location (:active), @ask_text (New Items,Enter the name of the item to create,@node_get_property(%n,name))))
- +# Selection Filters
- +[menus/sel_filter]
- +sort=false
- +submenus:enabled=enabled
- +left_click=command:tv_selection_nodes (:active, d, @nodes_filter (@tv_get_nodes (:active, :all), @mru_add_node (mru:sel_filter, %n), :active))
- +
- # to show children but not hidden/dotFiles
- [menus/children_not_hidden]
- sort=true
- @@ -1181,6 +1190,42 @@ terminal=term
- prefix=!
- terminal=term
- terminal_cmdline=:hold
- +[providers/filter/]
- +alias=f
- +name=No filtering
- +icon_name=edit-delete
- +filter=
- +[providers/filter/]
- +alias=h
- +name=Within the hour
- +filter=time:A<=1H
- +[providers/filter/]
- +alias=t
- +name=Today
- +icon_name=vcalendar
- +filter=time:A0
- +[providers/filter/]
- +alias=y
- +name=Yesterday
- +filter=time:A1d
- +[providers/filter/]
- +alias=w
- +name=This week
- +filter=time:A0V
- +[providers/filter/]
- +alias=v
- +name=Videos
- +icon_name=video
- +filter=desc:* video
- +[providers/filter/]
- +alias=i
- +name=Images
- +icon_name=image
- +filter=desc:* image
- +[providers/filter/]
- +alias=a
- +name=Archives
- +filter=desc:* archive*
- #
- @@ -1201,25 +1246,4 @@ node=config:/
- box=box-orange
- -#
- -# FILTERS
- -#
- -
- -[filters]
- -# used to unset current VF (via ff)
- -f=
- -# today
- -t=time:A0
- -# yesterday
- -y=time:A1d
- -# this week
- -w=time:A0V
- -# videos
- -v=desc:* video
- -# images
- -i=desc:* image
- -# archives
- -a=desc:* archive*
- -
- -
- # EOF
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.