Skip to content
xorg62 edited this page Sep 12, 2010 · 27 revisions

This is now merged with master and this article should also be merged, with the Configuration article.

It is a complete rewrite of amazing’s handling of configuration. It targets awesome versions later than 2.2, and the configuration can be written either in YAML or a Ruby DSL written specifically for amazing.

To get you started you may generate a DSL configuration based on your ~/.awesomerc with the -g or --scaffold switch:

% mkdir -p ~/.amazing
% amazing -g > ~/.amazing/config.rb

Beware: the above command will overwrite any existing ~/.amazing/config.rb

Then, you just edit away ~/.amazing/config.rb to your hearts content. Scroll down to learn more about the DSL configuration.

YAML

The YAML configuration is now structured like this:

awesome:
- screen: <screen> (defaults to 0)
  statusbar: <statusbar> (defaults to "mystatusbar")

  widgets:

  - <identifier name of awesome widget>:

      # be wary of indentation - or use inline syntax

      module: <widget module> (defaults to same as <identifier>)
      # list modules with amazing -w
      # module names can be written in either CamelCase or snake_case

      property: <fallback property if no properties are configured> (defaults to "text")

      interval: <update interval in seconds> (defaults to unspecified)
      # tip: 5:0 means five minutes, 5:0:0 five hours

      <module option>: <option value> (defaults specific to modules)
      # list these with amazing -w <module>

      properties:
        <property>: <ruby>
        # this works as format did before
        # list variables ("fields") with amazing -w <module>
        # and examples with amazing -t <module> ["<option>: <value>, ..."]

DSL

While the DSL is really Ruby, the syntax should hopefully be straight-forward even to people who are not familiar with Ruby.

awesome([options...]) {
  set :screen => <screen> (defaults to 0)
  set :statusbar => <statusbar> (defaults to "mystatusbar")

  widget(<identifier name of awesome widget>, [options...]) {

    set :module => <widget module> (defaults to same as <identifier>)
    # list modules with amazing -w
    # module names can be written in either CamelCase or snake_case

    set :property => <fallback property if no properties are configured> (defaults to "text")

    set :interval => <update interval in seconds> (defaults to unspecified)
    # tip: 5.minutes returns 300, up to x.years is supported (and the suffix "s" is optional)

    set :<module option> => <option value> (defaults specific to modules)
    # list these with amazing -w <module>

    property(<property>) {
      <ruby>
      # this works as format did before
      # list variables ("fields") with amazing -w <module>
      # and examples with amazing -t <module> ["<option>: <value>, ..."]
    }
  }
}

Options

Options can be set in multiple ways. Directly in the element directive:

awesome(:statusbar => “top”, …) { … }

With the set directive:

awesome { set :statusbar => “top”, … }

Sample configurations

Clone this wiki locally