Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1---------------------------------------------------------------------------
2--- Apply properties to a new client based on pre-determined rules.
3--
4-- This module applies @{rules} to clients during startup (via @{client.manage},
5-- but its functions can be used for client matching in general.
6--
7-- All existing `client` properties can be used in rules. It is also possible
8-- to add random properties that will be later accessible as `c.property_name`
9-- (where `c` is a valid client object)
10--
…lines 11–720 unchanged (710 lines)

After

1---------------------------------------------------------------------------
2--- Apply properties to a new client based on pre-determined rules.
3--
4-- This module applies @{rules} to clients during startup (via @{client.manage}),
5-- but its functions can be used for client matching in general.
6--
7-- All existing `client` properties can be used in rules. It is also possible
8-- to add random properties that will be later accessible as `c.property_name`
9-- (where `c` is a valid client object)
10--
…lines 11–720 unchanged (710 lines)

Before

chunk
comment
-- "--"
comment_content "------------------------------------------------------------"...
comment
-- "--"
comment_content "- Apply properties to a new client based on pre-determined r"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This module applies @{rules} to clients during startup (via"...
comment
-- "--"
comment_content " but its functions can be used for client matching in genera"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " All existing `client` properties can be used in rules. It i"...
comment
-- "--"
comment_content " to add random properties that will be later accessible as `"...
comment
-- "--"
comment_content " (where `c` is a valid client object)"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Syntax"
comment
-- "--"
comment_content " ==="
comment
-- "--"
comment_content " You should fill this table with your rule and properties to"...
comment
-- "--"
comment_content " For example, if you want to set xterm maximized at startup,"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_maximized_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to set mplayer floating at startup, you can add"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_floating_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to put Firefox on a specific tag at startup. It"...
comment
-- "--"
comment_content " specify the tag with it's object or by name:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_tags_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to put Thunderbird on a specific screen at star"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_screens_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to put Emacs on a specific tag at startup, and "...
comment
-- "--"
comment_content " to that tag you can add:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_switch_to_tags_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to apply a custom callback to execute when a ru"...
comment
-- "--"
comment_content " for example to pause playing music from mpd when you start "...
comment
-- "--"
comment_content " can add:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule = { class = \"dosbox\" },"
comment
-- "--"
comment_content " callback = function(c)"
comment
-- "--"
comment_content " awful.spawn('mpc pause')"
comment
-- "--"
comment_content " end }"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Note that all \"rule\" entries need to match. If any of the e"...
comment
-- "--"
comment_content " match, the rule won't be applied."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If a client matches multiple rules, they are applied in the"...
comment
-- "--"
comment_content " put in this global rules table. If the value of a rule is a"...
comment
-- "--"
comment_content " match function is used to determine if the client matches t"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If the value of a property is a function, that function get"...
comment
-- "--"
comment_content " function's return value is used for the property."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " To match multiple clients to a rule one need to use slightl"...
comment
-- "--"
comment_content " syntax:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule_any = { class = { \"MPlayer\", \"Nitrogen\" }, insta"...
comment
-- "--"
comment_content " properties = { floating = true } }"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " To match multiple clients with an exception one can couple "...
comment
-- "--"
comment_content " `rules.except_any` with the rules:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule = { class = \"Firefox\" },"
comment
-- "--"
comment_content " except = { instance = \"Navigator\" },"
comment
-- "--"
comment_content " properties = {floating = true},"
comment
-- "--"
comment_content " },"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule_any = { class = { \"Pidgin\", \"Xchat\" } },"
comment
-- "--"
comment_content " except_any = { role = { \"conversation\" } },"
comment
-- "--"
comment_content " properties = { tag = \"1\" }"
comment
-- "--"
comment_content " }"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule = {},"
comment
-- "--"
comment_content " except_any = { class = { \"Firefox\", \"Vim\" } },"
comment
-- "--"
comment_content " properties = { floating = true }"
comment
-- "--"
comment_content " }"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Note that all rules can have an `id` field. This can then b"...
comment
-- "--"
comment_content " the rule. For example, it can be used in `remove_rule` inst"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Flowchart"
comment
-- "--"
comment_content " ========="
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " ![Client rules](../images/client_rules.svg)"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Applicable client properties"
comment
-- "--"
comment_content " ==="
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " The table below holds the list of default client properties"...
comment
-- "--"
comment_content " some extra properties that are specific to the rules. Note "...
comment
-- "--"
comment_content " can be set in the rules and interpreted by user provided co"...
comment
-- "--"
comment_content " only represent those offered by default."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content "@DOC_client_rules_index_COMMON@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @author Julien Danjou <julien@danjou.info>"
comment
-- "--"
comment_content " @copyright 2009 Julien Danjou"
comment
-- "--"
comment_content " @ruleslib ruled.client"
comment
-- "--"
comment_content "------------------------------------------------------------"...
comment
-- "--"
comment_content " Grab environment we need"
variable_declaration (+29 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "table"
= "="
expression_list
identifier "table"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "type"
= "="
expression_list
identifier "type"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "ipairs"
= "="
expression_list
identifier "ipairs"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "pairs"
= "="
expression_list
identifier "pairs"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "atag"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.tag"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gobject"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.object"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gtable"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.table"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "a_place"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.placement"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "protected_call"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.protected_call"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "aspawn"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.spawn"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gdebug"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.debug"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gmatcher"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.matcher"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "amouse"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.mouse"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "akeyboard"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.keyboard"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "unpack"
= "="
expression_list
binary_expression
identifier "unpack"
or "or"
dot_index_expression
identifier "table"
. "."
identifier "unpack"
comment
-- "--"
comment_content " luacheck: globals unpack (compatibility with Lua 5.1)"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "module"
= "="
expression_list
table_constructor
{ "{"
} "}"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "crules"
= "="
expression_list
function_call
identifier "gmatcher"
arguments
( "("
) ")"
comment
-- "--"
comment_content "- Check if a client matches a rule."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table rule The rule to check."
comment
-- "--"
comment_content " @treturn bool True if it matches, false otherwise."
comment
-- "--"
comment_content " @staticfct ruled.client.match"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Check if a client matches any part of a rule."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table rule The rule to check."
comment
-- "--"
comment_content " @treturn bool True if at least one rule is matched, false o"...
comment
-- "--"
comment_content " @staticfct ruled.client.match_any"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Does a given rule entry match a client?"
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table entry Rule entry (with keys `rule`, `rule_any"...
comment
-- "--"
comment_content " `except_any`)."
comment
-- "--"
comment_content " @treturn bool"
comment
-- "--"
comment_content " @staticfct ruled.client.matches"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Get list of matching rules for a client."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table rules The rules to check. List with \"rule\", \""...
comment
-- "--"
comment_content " \"except_any\" keys."
comment
-- "--"
comment_content " @treturn table The list of matched rules."
comment
-- "--"
comment_content " @staticfct ruled.client.matching_rules"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Check if a client matches a given set of rules."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table rules The rules to check. List of tables with"...
comment
-- "--"
comment_content " `except` and `except_any` keys."
comment
-- "--"
comment_content " @treturn bool True if at least one rule is matched, false o"...
comment
-- "--"
comment_content " @staticfct ruled.client.matches_list"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Remove a source."
comment
-- "--"
comment_content " @tparam string name The source name."
comment
-- "--"
comment_content " @treturn boolean If the source was removed."
comment
-- "--"
comment_content " @staticfct ruled.client.remove_rule_source"
function_declaration (+24 nodes collapsed)
comment
-- "--"
comment_content "- Apply ruled.client.rules to a client."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @noreturn"
comment
-- "--"
comment_content " @staticfct ruled.client.apply"
function_declaration (+21 nodes collapsed)
comment
-- "--"
comment_content "- Add a new rule to the default set."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tparam table rule A valid rule."
function_declaration (+26 nodes collapsed)
comment
-- "--"
comment_content "- Add a new rules to the default set."
comment
-- "--"
comment_content " @tparam table rules A table with rules."
function_declaration (+26 nodes collapsed)
comment
-- "--"
comment_content "- Remove a new rule to the default set."
comment
-- "--"
comment_content " @tparam table|string rule A valid rule or a name passed in "...
comment
-- "--"
comment_content " when calling `append_rule`."
function_declaration (+26 nodes collapsed)
comment
-- "--"
comment_content "- Add a new rule source."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " A rule source is a provider called when a client is managed"...
comment
-- "--"
comment_content " allows to configure the client by providing properties that"...
comment
-- "--"
comment_content " By default, Awesome provides 2 sources:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `awful.rules`: A declarative matcher"
comment
-- "--"
comment_content " * `awful.spawn`: Launch clients with pre-defined properties"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " It is possible to register new callbacks to modify the prop"...
comment
-- "--"
comment_content " before it is applied. Each provider is executed sequentiall"...
comment
-- "--"
comment_content " same table. If the first provider set a property, then the "...
comment
-- "--"
comment_content " override it, then the third, etc. Once the providers are ex"...
comment
-- "--"
comment_content " properties are applied on the client."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " It is important to note that properties themselves have the"...
comment
-- "--"
comment_content " dependencies. For example, a `tag` property implies a `scre"...
comment
-- "--"
comment_content " a `screen` is already specified, then it will be ignored wh"...
comment
-- "--"
comment_content " executed. Properties also have their own priorities. For ex"...
comment
-- "--"
comment_content " `titlebar` and `border_width` need to be applied before the"...
comment
-- "--"
comment_content " positions are set. Otherwise, it will be off or the client "...
comment
-- "--"
comment_content " upward everytime Awesome is restarted. A rule source *canno"...
comment
-- "--"
comment_content " It is up to the callback to be aware of the dependencies an"...
comment
-- "--"
comment_content " introduce issues. For example, if the source wants to set a"...
comment
-- "--"
comment_content " to check if the `tag`, `tags` or `new_tag` are on that `scr"...
comment
-- "--"
comment_content " those properties. Otherwise, they will be ignored once the "...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tparam string name The provider name. It must be unique."
comment
-- "--"
comment_content " @tparam function callback The callback that is called to pr"...
comment
-- "--"
comment_content " @tparam client callback.c The client"
comment
-- "--"
comment_content " @tparam table callback.properties The current properties. T"...
comment
-- "--"
comment_content " add to and overwrite properties in this table"
comment
-- "--"
comment_content " @tparam table callback.callbacks A table of all callbacks s"...
comment
-- "--"
comment_content " executed after the main properties are applied."
comment
-- "--"
comment_content " @tparam[opt={}] table depends_on A list of names of sources"...
comment
-- "--"
comment_content " (sources that must be executed *before* `name`."
comment
-- "--"
comment_content " @tparam[opt={}] table precede A list of names of sources th"...
comment
-- "--"
comment_content " priority over."
comment
-- "--"
comment_content " @treturn boolean Returns false if a dependency conflict was"...
comment
-- "--"
comment_content " @staticfct ruled.client.add_rule_source"
function_declaration (+50 nodes collapsed)
comment
-- "--"
comment_content "- The default `ruled.client` source."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " It is called `awful.rules` for historical reasons."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " **Has priority over:**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " *nothing*"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @rulesources awful.rules"
function_call (+29 nodes collapsed)
comment
-- "--"
comment_content " Add startup_id overridden properties"
function_declaration (+130 nodes collapsed)
comment
-- "--"
comment_content "- The rule source for clients spawned by `awful.spawn`."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " **Has priority over:**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `awful.rules`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @rulesources awful.spawn"
function_call (+27 nodes collapsed)
function_declaration (+267 nodes collapsed)
comment
-- "--"
comment_content "- The rule source for clients spawned by `awful.spawn.once` "...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " **Has priority over:**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `awful.rules`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " **Depends on:**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `awful.spawn`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @rulesources awful.spawn_once"
function_call (+32 nodes collapsed)
function_declaration (+57 nodes collapsed)
comment
-- "--"
comment_content "- Extra rules properties."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " These properties are used in the rules only and are not sen"...
comment
-- "--"
comment_content " afterward."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " To add a new properties, just do:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " function ruled.client.extra_properties.my_new_property(c"...
comment
-- "--"
comment_content " -- do something"
comment
-- "--"
comment_content " end"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " By default, the table has the following functions:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * geometry"
comment
-- "--"
comment_content " * placement"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tfield table ruled.client.extra_properties"
assignment_statement
variable_list
dot_index_expression
identifier "module"
. "."
identifier "extra_properties"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "- Extra high priority properties."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Some properties, such as anything related to tags, geometry"...
comment
-- "--"
comment_content " cause a race condition if set in the main property section."...
comment
-- "--"
comment_content " they have a section for them."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " To add a new properties, just do:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " function ruled.client.high_priority_properties.my_new_pr"...
comment
-- "--"
comment_content " -- do something"
comment
-- "--"
comment_content " end"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " By default, the table has the following functions:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * tag"
comment
-- "--"
comment_content " * new_tag"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tfield table ruled.client.high_priority_properties"
assignment_statement
variable_list
dot_index_expression
identifier "module"
. "."
identifier "high_priority_properties"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "- Delayed properties."
comment
-- "--"
comment_content " Properties applied after all other categories."
comment
-- "--"
comment_content " @tfield table ruled.client.delayed_properties"
comment
-- "--"
comment_content " By default, the table has the following functions:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * switch_to_tags"
assignment_statement
variable_list
dot_index_expression
identifier "module"
. "."
identifier "delayed_properties"
= "="
expression_list
table_constructor
{ "{"
} "}"
variable_declaration (+69 nodes collapsed)
function_declaration (+194 nodes collapsed)
function_declaration (+48 nodes collapsed)
function_declaration (+51 nodes collapsed)
function_declaration (+193 nodes collapsed)
function_declaration (+280 nodes collapsed)
function_declaration (+182 nodes collapsed)
function_declaration (+259 nodes collapsed)
comment
-- "--"
comment_content "- Apply properties and callbacks to a client."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table props Properties to apply."
comment
-- "--"
comment_content " @tparam[opt={}] table callbacks Callbacks to apply."
comment
-- "--"
comment_content " @noreturn"
comment
-- "--"
comment_content " @staticfct ruled.client.execute"
comment
-- "--"
comment_content " @request client titlebars rules granted The `titlebars_enab"...
comment
-- "--"
comment_content " rules."
assignment_statement (+1029 nodes collapsed)
function_declaration (+21 nodes collapsed)
comment
-- "--"
comment_content " TODO v5 deprecate this"
function_declaration (+29 nodes collapsed)
function_call
dot_index_expression
identifier "gobject"
. "."
identifier "_setup_class_signals"
arguments
( "("
identifier "module"
) ")"
function_call
dot_index_expression
dot_index_expression
identifier "capi"
. "."
identifier "client"
. "."
identifier "connect_signal"
arguments
( "("
string
" "\""
string_content "request::manage"
" "\""
, ","
dot_index_expression
identifier "module"
. "."
identifier "apply"
) ")"
comment
-- "--"
comment_content " Request rules to be added **after** all modules are loaded,"...
comment
-- "--"
comment_content " clients are managed. This allows module to listen to rules "...
comment
-- "--"
comment_content " either modify them or add their own in the right order."
function_declaration (+21 nodes collapsed)
function_call
dot_index_expression
dot_index_expression
identifier "capi"
. "."
identifier "client"
. "."
identifier "connect_signal"
arguments
( "("
string
" "\""
string_content "scanning"
" "\""
, ","
identifier "request_rules"
) ")"
comment
-- "--"
comment_content "@DOC_rule_COMMON@"
return_statement (+269 nodes collapsed)
comment
-- "--"
comment_content " vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabs"...

After

chunk
comment
-- "--"
comment_content "------------------------------------------------------------"...
comment
-- "--"
comment_content "- Apply properties to a new client based on pre-determined r"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This module applies @{rules} to clients during startup (via"...
comment
-- "--"
comment_content " but its functions can be used for client matching in genera"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " All existing `client` properties can be used in rules. It i"...
comment
-- "--"
comment_content " to add random properties that will be later accessible as `"...
comment
-- "--"
comment_content " (where `c` is a valid client object)"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Syntax"
comment
-- "--"
comment_content " ==="
comment
-- "--"
comment_content " You should fill this table with your rule and properties to"...
comment
-- "--"
comment_content " For example, if you want to set xterm maximized at startup,"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_maximized_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to set mplayer floating at startup, you can add"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_floating_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to put Firefox on a specific tag at startup. It"...
comment
-- "--"
comment_content " specify the tag with it's object or by name:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_tags_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to put Thunderbird on a specific screen at star"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_screens_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to put Emacs on a specific tag at startup, and "...
comment
-- "--"
comment_content " to that tag you can add:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_sequences_client_rules_switch_to_tags_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If you want to apply a custom callback to execute when a ru"...
comment
-- "--"
comment_content " for example to pause playing music from mpd when you start "...
comment
-- "--"
comment_content " can add:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule = { class = \"dosbox\" },"
comment
-- "--"
comment_content " callback = function(c)"
comment
-- "--"
comment_content " awful.spawn('mpc pause')"
comment
-- "--"
comment_content " end }"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Note that all \"rule\" entries need to match. If any of the e"...
comment
-- "--"
comment_content " match, the rule won't be applied."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If a client matches multiple rules, they are applied in the"...
comment
-- "--"
comment_content " put in this global rules table. If the value of a rule is a"...
comment
-- "--"
comment_content " match function is used to determine if the client matches t"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " If the value of a property is a function, that function get"...
comment
-- "--"
comment_content " function's return value is used for the property."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " To match multiple clients to a rule one need to use slightl"...
comment
-- "--"
comment_content " syntax:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule_any = { class = { \"MPlayer\", \"Nitrogen\" }, insta"...
comment
-- "--"
comment_content " properties = { floating = true } }"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " To match multiple clients with an exception one can couple "...
comment
-- "--"
comment_content " `rules.except_any` with the rules:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule = { class = \"Firefox\" },"
comment
-- "--"
comment_content " except = { instance = \"Navigator\" },"
comment
-- "--"
comment_content " properties = {floating = true},"
comment
-- "--"
comment_content " },"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule_any = { class = { \"Pidgin\", \"Xchat\" } },"
comment
-- "--"
comment_content " except_any = { role = { \"conversation\" } },"
comment
-- "--"
comment_content " properties = { tag = \"1\" }"
comment
-- "--"
comment_content " }"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " { rule = {},"
comment
-- "--"
comment_content " except_any = { class = { \"Firefox\", \"Vim\" } },"
comment
-- "--"
comment_content " properties = { floating = true }"
comment
-- "--"
comment_content " }"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Note that all rules can have an `id` field. This can then b"...
comment
-- "--"
comment_content " the rule. For example, it can be used in `remove_rule` inst"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Flowchart"
comment
-- "--"
comment_content " ========="
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " ![Client rules](../images/client_rules.svg)"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Applicable client properties"
comment
-- "--"
comment_content " ==="
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " The table below holds the list of default client properties"...
comment
-- "--"
comment_content " some extra properties that are specific to the rules. Note "...
comment
-- "--"
comment_content " can be set in the rules and interpreted by user provided co"...
comment
-- "--"
comment_content " only represent those offered by default."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content "@DOC_client_rules_index_COMMON@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @author Julien Danjou <julien@danjou.info>"
comment
-- "--"
comment_content " @copyright 2009 Julien Danjou"
comment
-- "--"
comment_content " @ruleslib ruled.client"
comment
-- "--"
comment_content "------------------------------------------------------------"...
comment
-- "--"
comment_content " Grab environment we need"
variable_declaration (+29 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "table"
= "="
expression_list
identifier "table"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "type"
= "="
expression_list
identifier "type"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "ipairs"
= "="
expression_list
identifier "ipairs"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "pairs"
= "="
expression_list
identifier "pairs"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "atag"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.tag"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gobject"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.object"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gtable"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.table"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "a_place"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.placement"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "protected_call"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.protected_call"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "aspawn"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.spawn"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gdebug"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.debug"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gmatcher"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.matcher"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "amouse"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.mouse"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "akeyboard"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "awful.keyboard"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "unpack"
= "="
expression_list
binary_expression
identifier "unpack"
or "or"
dot_index_expression
identifier "table"
. "."
identifier "unpack"
comment
-- "--"
comment_content " luacheck: globals unpack (compatibility with Lua 5.1)"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "module"
= "="
expression_list
table_constructor
{ "{"
} "}"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "crules"
= "="
expression_list
function_call
identifier "gmatcher"
arguments
( "("
) ")"
comment
-- "--"
comment_content "- Check if a client matches a rule."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table rule The rule to check."
comment
-- "--"
comment_content " @treturn bool True if it matches, false otherwise."
comment
-- "--"
comment_content " @staticfct ruled.client.match"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Check if a client matches any part of a rule."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table rule The rule to check."
comment
-- "--"
comment_content " @treturn bool True if at least one rule is matched, false o"...
comment
-- "--"
comment_content " @staticfct ruled.client.match_any"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Does a given rule entry match a client?"
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table entry Rule entry (with keys `rule`, `rule_any"...
comment
-- "--"
comment_content " `except_any`)."
comment
-- "--"
comment_content " @treturn bool"
comment
-- "--"
comment_content " @staticfct ruled.client.matches"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Get list of matching rules for a client."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table rules The rules to check. List with \"rule\", \""...
comment
-- "--"
comment_content " \"except_any\" keys."
comment
-- "--"
comment_content " @treturn table The list of matched rules."
comment
-- "--"
comment_content " @staticfct ruled.client.matching_rules"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Check if a client matches a given set of rules."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table rules The rules to check. List of tables with"...
comment
-- "--"
comment_content " `except` and `except_any` keys."
comment
-- "--"
comment_content " @treturn bool True if at least one rule is matched, false o"...
comment
-- "--"
comment_content " @staticfct ruled.client.matches_list"
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- Remove a source."
comment
-- "--"
comment_content " @tparam string name The source name."
comment
-- "--"
comment_content " @treturn boolean If the source was removed."
comment
-- "--"
comment_content " @staticfct ruled.client.remove_rule_source"
function_declaration (+24 nodes collapsed)
comment
-- "--"
comment_content "- Apply ruled.client.rules to a client."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @noreturn"
comment
-- "--"
comment_content " @staticfct ruled.client.apply"
function_declaration (+21 nodes collapsed)
comment
-- "--"
comment_content "- Add a new rule to the default set."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tparam table rule A valid rule."
function_declaration (+26 nodes collapsed)
comment
-- "--"
comment_content "- Add a new rules to the default set."
comment
-- "--"
comment_content " @tparam table rules A table with rules."
function_declaration (+26 nodes collapsed)
comment
-- "--"
comment_content "- Remove a new rule to the default set."
comment
-- "--"
comment_content " @tparam table|string rule A valid rule or a name passed in "...
comment
-- "--"
comment_content " when calling `append_rule`."
function_declaration (+26 nodes collapsed)
comment
-- "--"
comment_content "- Add a new rule source."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " A rule source is a provider called when a client is managed"...
comment
-- "--"
comment_content " allows to configure the client by providing properties that"...
comment
-- "--"
comment_content " By default, Awesome provides 2 sources:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `awful.rules`: A declarative matcher"
comment
-- "--"
comment_content " * `awful.spawn`: Launch clients with pre-defined properties"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " It is possible to register new callbacks to modify the prop"...
comment
-- "--"
comment_content " before it is applied. Each provider is executed sequentiall"...
comment
-- "--"
comment_content " same table. If the first provider set a property, then the "...
comment
-- "--"
comment_content " override it, then the third, etc. Once the providers are ex"...
comment
-- "--"
comment_content " properties are applied on the client."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " It is important to note that properties themselves have the"...
comment
-- "--"
comment_content " dependencies. For example, a `tag` property implies a `scre"...
comment
-- "--"
comment_content " a `screen` is already specified, then it will be ignored wh"...
comment
-- "--"
comment_content " executed. Properties also have their own priorities. For ex"...
comment
-- "--"
comment_content " `titlebar` and `border_width` need to be applied before the"...
comment
-- "--"
comment_content " positions are set. Otherwise, it will be off or the client "...
comment
-- "--"
comment_content " upward everytime Awesome is restarted. A rule source *canno"...
comment
-- "--"
comment_content " It is up to the callback to be aware of the dependencies an"...
comment
-- "--"
comment_content " introduce issues. For example, if the source wants to set a"...
comment
-- "--"
comment_content " to check if the `tag`, `tags` or `new_tag` are on that `scr"...
comment
-- "--"
comment_content " those properties. Otherwise, they will be ignored once the "...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tparam string name The provider name. It must be unique."
comment
-- "--"
comment_content " @tparam function callback The callback that is called to pr"...
comment
-- "--"
comment_content " @tparam client callback.c The client"
comment
-- "--"
comment_content " @tparam table callback.properties The current properties. T"...
comment
-- "--"
comment_content " add to and overwrite properties in this table"
comment
-- "--"
comment_content " @tparam table callback.callbacks A table of all callbacks s"...
comment
-- "--"
comment_content " executed after the main properties are applied."
comment
-- "--"
comment_content " @tparam[opt={}] table depends_on A list of names of sources"...
comment
-- "--"
comment_content " (sources that must be executed *before* `name`."
comment
-- "--"
comment_content " @tparam[opt={}] table precede A list of names of sources th"...
comment
-- "--"
comment_content " priority over."
comment
-- "--"
comment_content " @treturn boolean Returns false if a dependency conflict was"...
comment
-- "--"
comment_content " @staticfct ruled.client.add_rule_source"
function_declaration (+50 nodes collapsed)
comment
-- "--"
comment_content "- The default `ruled.client` source."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " It is called `awful.rules` for historical reasons."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " **Has priority over:**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " *nothing*"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @rulesources awful.rules"
function_call (+29 nodes collapsed)
comment
-- "--"
comment_content " Add startup_id overridden properties"
function_declaration (+130 nodes collapsed)
comment
-- "--"
comment_content "- The rule source for clients spawned by `awful.spawn`."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " **Has priority over:**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `awful.rules`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @rulesources awful.spawn"
function_call (+27 nodes collapsed)
function_declaration (+267 nodes collapsed)
comment
-- "--"
comment_content "- The rule source for clients spawned by `awful.spawn.once` "...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " **Has priority over:**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `awful.rules`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " **Depends on:**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `awful.spawn`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @rulesources awful.spawn_once"
function_call (+32 nodes collapsed)
function_declaration (+57 nodes collapsed)
comment
-- "--"
comment_content "- Extra rules properties."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " These properties are used in the rules only and are not sen"...
comment
-- "--"
comment_content " afterward."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " To add a new properties, just do:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " function ruled.client.extra_properties.my_new_property(c"...
comment
-- "--"
comment_content " -- do something"
comment
-- "--"
comment_content " end"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " By default, the table has the following functions:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * geometry"
comment
-- "--"
comment_content " * placement"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tfield table ruled.client.extra_properties"
assignment_statement
variable_list
dot_index_expression
identifier "module"
. "."
identifier "extra_properties"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "- Extra high priority properties."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Some properties, such as anything related to tags, geometry"...
comment
-- "--"
comment_content " cause a race condition if set in the main property section."...
comment
-- "--"
comment_content " they have a section for them."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " To add a new properties, just do:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " function ruled.client.high_priority_properties.my_new_pr"...
comment
-- "--"
comment_content " -- do something"
comment
-- "--"
comment_content " end"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " By default, the table has the following functions:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * tag"
comment
-- "--"
comment_content " * new_tag"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tfield table ruled.client.high_priority_properties"
assignment_statement
variable_list
dot_index_expression
identifier "module"
. "."
identifier "high_priority_properties"
= "="
expression_list
table_constructor
{ "{"
} "}"
comment
-- "--"
comment_content "- Delayed properties."
comment
-- "--"
comment_content " Properties applied after all other categories."
comment
-- "--"
comment_content " @tfield table ruled.client.delayed_properties"
comment
-- "--"
comment_content " By default, the table has the following functions:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * switch_to_tags"
assignment_statement
variable_list
dot_index_expression
identifier "module"
. "."
identifier "delayed_properties"
= "="
expression_list
table_constructor
{ "{"
} "}"
variable_declaration (+69 nodes collapsed)
function_declaration (+194 nodes collapsed)
function_declaration (+48 nodes collapsed)
function_declaration (+51 nodes collapsed)
function_declaration (+193 nodes collapsed)
function_declaration (+280 nodes collapsed)
function_declaration (+182 nodes collapsed)
function_declaration (+259 nodes collapsed)
comment
-- "--"
comment_content "- Apply properties and callbacks to a client."
comment
-- "--"
comment_content " @tparam client c The client."
comment
-- "--"
comment_content " @tparam table props Properties to apply."
comment
-- "--"
comment_content " @tparam[opt={}] table callbacks Callbacks to apply."
comment
-- "--"
comment_content " @noreturn"
comment
-- "--"
comment_content " @staticfct ruled.client.execute"
comment
-- "--"
comment_content " @request client titlebars rules granted The `titlebars_enab"...
comment
-- "--"
comment_content " rules."
assignment_statement (+1029 nodes collapsed)
function_declaration (+21 nodes collapsed)
comment
-- "--"
comment_content " TODO v5 deprecate this"
function_declaration (+29 nodes collapsed)
function_call
dot_index_expression
identifier "gobject"
. "."
identifier "_setup_class_signals"
arguments
( "("
identifier "module"
) ")"
function_call
dot_index_expression
dot_index_expression
identifier "capi"
. "."
identifier "client"
. "."
identifier "connect_signal"
arguments
( "("
string
" "\""
string_content "request::manage"
" "\""
, ","
dot_index_expression
identifier "module"
. "."
identifier "apply"
) ")"
comment
-- "--"
comment_content " Request rules to be added **after** all modules are loaded,"...
comment
-- "--"
comment_content " clients are managed. This allows module to listen to rules "...
comment
-- "--"
comment_content " either modify them or add their own in the right order."
function_declaration (+21 nodes collapsed)
function_call
dot_index_expression
dot_index_expression
identifier "capi"
. "."
identifier "client"
. "."
identifier "connect_signal"
arguments
( "("
string
" "\""
string_content "scanning"
" "\""
, ","
identifier "request_rules"
) ")"
comment
-- "--"
comment_content "@DOC_rule_COMMON@"
return_statement (+269 nodes collapsed)
comment
-- "--"
comment_content " vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabs"...