Reference

# Module `awful.rules`

Apply rules to clients at startup.

Author:

Julien Danjou <julien@danjou.info>

Copyright© 2009 Julien Danjou

Release: v3.4.13

## Functions

apply (c) | Apply rules to a client.
match (c, rule) | Check if a client match a rule.
match_any (c, rule, rules) | Check if a client match a rule.

## Tables

rules | This is the global rules table.

## Functions

apply (c)
  Apply rules to a client.

  ### Parameters

  - c: The client.
match (c, rule)
  Check if a client match a rule.

  ### Parameters

  - c: The client.
  - rule: The rule to check.

  ### Return value:

  True if it matches, false otherwise.
match_any (c, rule, rules)
  Check if a client match a rule. Multiple clients can be matched

  ### Parameters

  - c: The client.
  - rule:
  - rules: The rule to check.

  ### Return value:

  True if at least one rule is matched, false otherwise.

## Tables

rules
  This is the global rules table.

  You should fill this table with your rule and properties to apply. For example, if you want to set xterm maximized at startup, you can add:
  `{ rule = { class = "xterm" }, properties = { maximized_vertical = true, maximized_horizontal = true } }`

  If you want to set mplayer floating at startup, you can add:
  `{ rule = { name = "MPlayer" }, properties = { floating = true } }`

  If you want to put Firefox on a specific tag at startup, you can add:
  `{ rule = { instance = "firefox" }, properties = { tag = mytagobject } }`

  If you want to put Emacs on a specific tag at startup, and immediately switch to that tag you can add:
  `{ rule = { class = "Emacs" }, properties = { tag = mytagobject, switchtotag = true } }`

  If you want to apply a custom callback to execute when a rule matched, you can add:
  `{ rule = { class = "dosbox" }, callback = awful.placement.centered }`

  Note that all "rule" entries need to match. If any of the entry does not match, the rule won't be applied.

  If a client matches multiple rules, their applied in the order they are put in this global rules table. If the value of a rule is a string, then the match function is used to determine if the client matches the rule.

  To match multiple clients to a rule one need to use slightly different syntax:
  `{ rule_any = { class = { "MPlayer", "Nitrogen" }, instance = { "xterm" } }, properties = { floating = true } }`

  To match multiple clients with an exception one can couple 'except' or 'except_any' with the rules:
  `{ rule = { class = "Firefox" }, except = { instance = "Navigator" }, properties = {floating = true}, },`
  `{ rule_any = { class = { "Pidgin", "Xchat" } }, except_any = { role = { "conversation" } }, properties = { tag = tags[1][1] } }
  `{ rule = {}, except_any = { class = { "Firefox", "Vim" } }, properties = { floating = true } }``