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:

  1. diff --git a/misc/donnatella.conf b/misc/donnatella.conf
  2. index 1ab177f..b9810df 100644
  3. --- a/misc/donnatella.conf
  4. +++ b/misc/donnatella.conf
  5. @@ -136,6 +136,7 @@ key_mode_select_foreground=white
  6.  last_location=command:tv_set_location (:active, @config_get_string (donna/last_location))
  7.  marks=command:mark_load (,1)
  8.  registers=command:register_load_all (,1)
  9. +filters=command:filter_load ()
  10.  # enable when using layout "tm"
  11.  #tm=@tv_set_location(tm,task:/)
  12.  
  13. @@ -205,7 +206,7 @@ context_menu_colheader=columns<!columns>,-,:sort_order<!sort_order>,:second_sort
  14.  # some color filters
  15.  
  16.  [defaults/lists/arrangement/color_filters/]
  17. -filter=|*.tar.*|*.tgz|*.zip|*.rar
  18. +filter=|a
  19.  column=name
  20.  foreground=green
  21.  
  22. @@ -231,25 +232,25 @@ foreground-rgba=rgb(108,0,0)
  23.  
  24.  [defaults/lists/arrangement/color_filters/]
  25.  # modified less than an hour ago
  26. -filter=time:A<=1H
  27. +filter=|h
  28.  column=time
  29.  foreground-rgba=rgb(0,80,210)
  30.  
  31.  [defaults/lists/arrangement/color_filters/]
  32.  # modified today
  33. -filter=time:A0d
  34. +filter=|t
  35.  column=time
  36.  foreground-rgba=rgb(0,150,200)
  37.  
  38.  [defaults/lists/arrangement/color_filters/]
  39.  # modified yesterday
  40. -filter=time:A1d
  41. +filter=|y
  42.  column=time
  43.  foreground-rgba=rgb(0,200,160)
  44.  
  45.  [defaults/lists/arrangement/color_filters/]
  46.  # modified this week
  47. -filter=time:A0V
  48. +filter=|w
  49.  column=time
  50.  foreground-rgba=rgb(0,180,0)
  51.  
  52. @@ -783,11 +784,9 @@ trigger=command:tv_start_interactive_search (%o)
  53.  [key_modes/donna/key_f]
  54.  type:key=spec
  55.  spec:spec=lower,upper
  56. -trigger=command:tv_set_visual_filter (%o, @config_get_string (filters/%k), 1)
  57. +trigger=command:tv_set_visual_filter (%o, filter:|%k, 1)
  58.  [key_modes/donna/key_F]
  59. -type:key=spec
  60. -spec:spec=lower,upper
  61. -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)
  62. +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))))
  63.  
  64.  # VF: by age
  65.  [key_modes/donna/key_ampersand]
  66. @@ -797,16 +796,16 @@ custom_chars=HMSdmVY
  67.  combine=age_unit
  68.  [key_modes/donna/key_q]
  69.  combine=age_unit
  70. -trigger=command:tv_set_visual_filter (%o, time:A%m%c)
  71. +trigger=command:tv_set_visual_filter (%o, filter:time:A%m%c)
  72.  [key_modes/donna/key_Q]
  73.  combine=age_unit
  74. -trigger=command:tv_set_visual_filter (%o, time:A<=%m%c)
  75. +trigger=command:tv_set_visual_filter (%o, filter:time:A<=%m%c)
  76.  
  77.  # VF: by size
  78.  [key_modes/donna/key_less]
  79. -trigger=command:tv_set_visual_filter (%o, size:<=%mM)
  80. +trigger=command:tv_set_visual_filter (%o, filter:size:<=%mM)
  81.  [key_modes/donna/key_greater]
  82. -trigger=command:tv_set_visual_filter (%o, size:>=%mM)
  83. +trigger=command:tv_set_visual_filter (%o, filter:size:>=%mM)
  84.  
  85.  
  86.  # F2 to rename
  87. @@ -1054,8 +1053,12 @@ name=Invert Selection
  88.  trigger=command:tv_selection (%o, i, :all)
  89.  
  90.  [context_menus/tree_views/selection_filter]
  91. +type:context-type=combined
  92.  name=Selection Filter...
  93. -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))
  94. +trigger=&donna-sel_filter %o
  95. +container=@<nodes_add (@nodes_add(@mru_get_nodes (mru:sel_filter)), filter:/)
  96. +submenus:enabled=combine
  97. +menu=sel_filter
  98.  
  99.  # Timestamp stuff
  100.  
  101. @@ -1091,6 +1094,12 @@ children:node-type=items
  102.  sort=true
  103.  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))))
  104.  
  105. +# Selection Filters
  106. +[menus/sel_filter]
  107. +sort=false
  108. +submenus:enabled=enabled
  109. +left_click=command:tv_selection_nodes (:active, d, @nodes_filter (@tv_get_nodes (:active, :all), @mru_add_node (mru:sel_filter, %n), :active))
  110. +
  111.  # to show children but not hidden/dotFiles
  112.  [menus/children_not_hidden]
  113.  sort=true
  114. @@ -1181,6 +1190,42 @@ terminal=term
  115.  prefix=!
  116.  terminal=term
  117.  terminal_cmdline=:hold
  118. +[providers/filter/]
  119. +alias=f
  120. +name=No filtering
  121. +icon_name=edit-delete
  122. +filter=
  123. +[providers/filter/]
  124. +alias=h
  125. +name=Within the hour
  126. +filter=time:A<=1H
  127. +[providers/filter/]
  128. +alias=t
  129. +name=Today
  130. +icon_name=vcalendar
  131. +filter=time:A0
  132. +[providers/filter/]
  133. +alias=y
  134. +name=Yesterday
  135. +filter=time:A1d
  136. +[providers/filter/]
  137. +alias=w
  138. +name=This week
  139. +filter=time:A0V
  140. +[providers/filter/]
  141. +alias=v
  142. +name=Videos
  143. +icon_name=video
  144. +filter=desc:* video
  145. +[providers/filter/]
  146. +alias=i
  147. +name=Images
  148. +icon_name=image
  149. +filter=desc:* image
  150. +[providers/filter/]
  151. +alias=a
  152. +name=Archives
  153. +filter=desc:* archive*
  154.  
  155.  
  156.  #
  157. @@ -1201,25 +1246,4 @@ node=config:/
  158.  box=box-orange
  159.  
  160.  
  161. -#
  162. -#       FILTERS
  163. -#
  164. -
  165. -[filters]
  166. -# used to unset current VF (via ff)
  167. -f=
  168. -# today
  169. -t=time:A0
  170. -# yesterday
  171. -y=time:A1d
  172. -# this week
  173. -w=time:A0V
  174. -# videos
  175. -v=desc:* video
  176. -# images
  177. -i=desc:* image
  178. -# archives
  179. -a=desc:* archive*
  180. -
  181. -
  182.  # 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.

Top of Page