# \[ANN\] sunaku's Ruby wmiirc - YAML imports

**URL:** <https://www.ruby-forum.com/t/ann-sunakus-ruby-wmiirc-yaml-imports/181016>\
**Category:** Ruby\
**Created:** [January 3, 2010, 9:54pm UTC](https://www.ruby-forum.com/t/ann-sunakus-ruby-wmiirc-yaml-imports/181016 "2010-01-03T21:54:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [January 3, 2010, 9:54pm UTC](https://www.ruby-forum.com/t/ann-sunakus-ruby-wmiirc-yaml-imports/181016/1 "2010-01-03T21:54:14Z")

</div>

Background:

This is a Ruby[1] and YAML[2] based configuration of the wmii[3]  
window manager. It manipulates wmii through the Rumai[4] library,  
which comes with an interactive shell[5] for live experimentation.

[1] [http://ruby-lang.org](http://ruby-lang.org)  
[2] [http://yaml.org](http://yaml.org)  
[3] [http://wmii.suckless.org](http://wmii.suckless.org)  
[4] [rumai(1)](http://snk.tuxfamily.org/lib/rumai/)  
[5] [rumai(1)](http://snk.tuxfamily.org/lib/rumai/#Tutorial)

Announcement:

I’m pleased to announce YAML imports, the next milestone in the  
evolution of my Ruby wmiirc: [http://github.com/sunaku/wmiirc](http://github.com/sunaku/wmiirc).

The big idea, suggested by Nathan Neff, is that the config.yaml file  
should be able to import other YAML files (“partials” as I call them).  
This allows us to share and maintain common code while having a  
different mix of status applets, keyboard shortcuts, color schemes,  
and so on.

The YAML structure has also changed in this new version, so your old  
config.yaml will not work as-is. In particular, the following  
incompatible changes have been made:

(1) The “script” section now defines an array:

```
# Arbitrary logic to execute either before or after processing this

```

file.  
# Any number of “before” and “after” subsections may be defined  
within  
# this section.  
#  
# script:  
# - before:   
# - after:   
# # …  
#  
script:

(2) Keys in the"display:status" section have changed, and the code is  
evaluated inside a Wmiirc::Status object (see “display/status.yaml”  
for details).

# Status bar applets.

# 

# - :

# 

# refresh: \<number of seconds to wait before updating the

label\>

# 

# script: \<Ruby code to evaluate in the Wmiirc::Status

# object that corresponds to this definition.\>

# 

# label: \<Ruby code whose result is displayed as the

# content. This code is placed inside a

# label() method in the Wmiirc::Status object

# that corresponds to this definition.\>

# 

# mouse\_action:

# :

# 

# You can refresh a particular status bar applet in Ruby using:

# 

# Status[“your applet name”].refresh

# 

status:

(3) The “control:grab” section was moved to  
“control:keyboard:grabmod”.

(4) The “control:key” section was split into “control:action” and  
“control:keyboard\_action” so that the same logic can be shared among  
keyboard shortcuts and mouse events.

# Keyboard shortcuts.

# 

# :

# 

# A key sequence may contain ${…} expressions which

# are replaced with the value corresponding to ‘…’ in

# the “control:keyboard” section of this configuration.

# 

# For example, if the “control:keyboard” section was:

# 

# control:

# keyboard:

# foo: Mod4

# bar: y

# 

# and the following key sequence was used:

# 

# ${foo}-${bar},${bar}

# 

# then after ${…} expression replacement,

# that key sequence would appear like this:

# 

# Mod4-y,y

# 

keyboard\_action:

(5) The “program” section was renamed to “prefer”.

I think that’s about it.

Cheers.
