Closed nougad closed 14 years ago
make 'display:status' a Ruby 1.9 hash; closed by faa4c5141b1a18088a6c4220f312461004ec66d2
Ruby 1.9 is now required to use this wmiirc because its hashes retains the insertion order of their members and reflect it during iteration.
Without this new Ruby feature, we would need to go back to representing 'display:status' as an array of hashes; thereby losing the ability to address and override things inside a particular status bar applet.
Hi,
today I had some time to look at the new version. It works really well. The idea of splitting the config files into multiple parts makes the whole config more reusable. Especially the possibility to overwrite config settings from imports at config.yaml file is great. But there is a limitation for status buttons. In the merge method you append items into an array. This is ok but makes it impossible to overwrite settings from status buttons.
Example:
FILE display/status/music/mpd.yaml:
FILE config.yaml:
This won't work because mpd is an item of an array. If I want to overwrite part of this it added a new Item: "status" => [{"mpd" => .... }, {"mpd" => ... }]
This will end in an Exception because the "label"-method is not found in one of these items.
MY SOLUTION: I changed all buttons into an Hash: "status" => {"mpd" => ..., "acpi" => ...}
FILE: display/status.yaml:
Now it's possible to overwrite settings. But now a new position field is necessary. I solved this in config.yaml:
And used the position field as filename: file = "#{@definition['position']||0}-#{name}"
What do you think about that? Any better ideas for the position?
(see commits at http://github.com/nougad/wmiirc)