Re: [dev] [dwm] [wmii] Prompt for client to add to current view

From: Kris Maglione <maglione.k_AT_gmail.com>
Date: Tue, 6 Oct 2009 15:53:53 -0400

On Tue, Oct 06, 2009 at 02:41:20PM -0500, Nathan Neff wrote:
>I changed my config.yaml to look like this:
>
><snip>
> ${mod}-c: | # focus client chosen from a menu
> client = client_menu('invite client:') and client.tag curr_tag
>
></snip>
>
>Thank you very much! I'm going to delve further into your wmiirc
>stuff using the interactive prompt. I don't quite understand how
>config.yaml
>gets turned into "real" ruby code, but will check out the tutorials on the
>website:
>http://snk.tuxfamily.org/lib/rumai/

Black magic... black magic.

Basically, YAML is the same thing as S-exprs or XML. It
represents a tree of nodes. Ruby mangles it into a tree of hash
maps (or whatever ruby calls them). It processes certain nodes
specially --- basically, it just evals them. Keys, for instance,
go something like this:

     CONFIG['control']['key'].each { |k, v|
        bind_key k *(eval "sub { |key| #{v} }")
     }

I'd personally probably stick with pure ruby, but the
config.yaml mangling is straightforward enough.

-- 
Kris Maglione
If you don't think carefully, you might think that programming is just
typing statements in a programming language.
	--Ward Cunningham
Received on Tue Oct 06 2009 - 19:53:53 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 06 2009 - 20:00:02 UTC