Commit Graph

50 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 74508098de rules: Add a rule building chain of responsability
Before this commit, there was a conflict between the spawn and
awful.rules rules.

Also, modules such as Tryannical monkey-patched this function to
add their own rules to the mix. This commit introduce a proper
API to add handlers.

The order is crutial for this to work, so a dependency system is
also added.

Fix #1482
2018-03-04 01:34:33 -05:00
Uli Schlachter 7fda5d3273 awful.rules: Handle non-existing tags
If a tag is specified by name, but no such tags exist, awful.rules would
cause an error (attempt to index a nil value). Fix this and add a test
for this case.

Fixes: https://github.com/awesomeWM/awesome/issues/2087
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-31 13:23:12 +01:00
Daniel Hahler 784472f212 doc: improve/fix doc for awful.rules (#2005) 2017-08-20 13:37:03 -04:00
Nick Diego Yamane bfe58d65f1 docs: fix some typos/leftovers (#1989)
Signed-off-by: Nick Yamane <nick.diego@gmail.com>
2017-08-14 16:06:44 +02:00
Daniel Hahler d4924988df rules: switchtotag: fix usage of awful.tag.viewmore (#1895)
This passes in the client's screen for now.

In the long run this should get fixed via
https://github.com/awesomeWM/awesome/issues/1883, but that is more
involved.

Fixes https://github.com/awesomeWM/awesome/issues/1886.
2017-07-02 11:26:41 +02:00
Emmanuel Lepage Vallee 9c77aa58c5 rules: Replace switchtotag implementation with awful.tag.viewmore.
Fix #1493
2017-06-10 23:50:27 -04:00
Daniel Hahler a87387d9f3 doc fixes for awful.mouse.resize, awful.rules, awful.util (#1717) 2017-04-10 21:57:12 +02:00
Kevin Zander c3461b535c gears: Move awful.util.table to gears.table (#1641)
* Move table functions out of awful.util into new gears.table

* travis: Use v9999 prefix for full requests

Make sure no newly deprecated functions are used

* Move all `awful.util.table.*` calls to `gears.table.*` calls
Move table test functions from awful/util_spec to new gears/table_spec
Change awful.util.subsets call to gears.math.subsets in awful/key.lua
2017-03-08 15:18:33 -05:00
Emmanuel Lepage Vallee 69f292a31f doc: Add basic documentation for the custom rules properties.
In the lack of a better documentation.
2017-02-07 11:13:15 -05:00
Emmanuel Lepage Vallee 6da20bb301 rules.placement: Add properties to honor padding and workarea 2017-02-07 11:13:15 -05:00
Emmanuel Lepage Vallee 5f693ead30 rules: Move tags into the same group as tag
Unrelated to this PR, but found while doing a review.
2017-02-07 11:13:15 -05:00
Daniel Hahler b43918613a rules: remove duplicate handling of placement props
Fixes https://github.com/awesomeWM/awesome/issues/1481.
2017-01-27 18:00:19 +01:00
Emmanuel Lepage Vallee 4b61dbba82 rules.tags: Behave like rules.tag
One did try to match tag by name and the other didn't.

While at it, also ensure that the screen is consistent.
2016-12-12 11:49:11 -05:00
Emmanuel Lepage Vallee c96aa9866e rules.tag: Prevent a screen mismatch
As c:tags() doesn't (cannot) check for screen mismatch, then it
has to be done.

This is a follow up of 6f7019b2d0, see #1236.
2016-12-11 22:50:00 -05:00
Emmanuel Lepage Vallee 1eeaf6b9c9 doc: Add a missing awful.rule field 2016-12-11 00:10:39 -05:00
Emmanuel Lepage Vallee 6f7019b2d0 rules.new_tag: Fix when the tag screen doesn't match the client
Also add the documented `props` argument to the high priority
rules.
2016-11-27 04:57:35 -05:00
Uli Schlachter 70d4961a3e awful.spawn: Separate rules from callbacks (#1186)
When adding callbacks as a `callback` entry in a property, the callback
is run by `awful.rules`, because it does `c.callback =
result_of_function`. This is obviously not intended. Also, this causes
the callbacks to run twice, because the code already handled this
`callback` property specially.

Fix this by just not merging callbacks with the normal rules at all.

Fixes: https://github.com/awesomeWM/awesome/issues/1159
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-25 00:22:36 +02:00
Uli Schlachter 259c4f716f Remove @release @AWESOME_VERSION@ everywhere (#1157)
It does not provide much value. The version number is already known to
ldoc globally in the "description" variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-09 22:36:20 +02:00
Uli Schlachter 2e13c120e8 Make rules with 'tag = "3"' work with multiple screens (#992)
The default config creates the same set of tags for all screens ("1" to "9"). An
awful.rules-rule with e.g. screen = 2, tag = "3" should obviously tag matching
clients with tag "3" of the second screen.

However, the implementation used the first matching tag in the list of all tags
and thus the client ended up tagged with tag "3" from screen 1. Fix this by
calling find_by_name() with the screen that the client is assigned to.

The existing implementation of awful.rules guarantees that any
"screen"-properties are applied before the code touched by this commit is run,
thus this should always work.

This commit does not add a test catching this because we are currently quite bad
at testing multi-screen scenarios and I don't want to invent the necessary
machinery right now.

Fixes: https://github.com/awesomeWM/awesome/issues/988
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-09 19:17:35 +02:00
actionless cdb5a0f046 fix(awful: rules): floating property 2016-04-25 15:43:14 +02:00
Daniel Hahler 135ff4b0c8 Use gears.protected_call with awful.rules callbacks (#843)
Fixes https://github.com/awesomeWM/awesome/issues/840#issuecomment-211823483.
2016-04-20 22:34:16 +02:00
Emmanuel Lepage Vallee a4f1b760bd awful.rules: Apply size_hints_honor early
There is a property race with width, height and geometry
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee c678a0d426 awful.rules: Apply floating early 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 06716df05a awful.rules: Apply border_width early 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 89edc92110 awful.rules: Add the 'tags' property
Due to recent changes, it was no longer possible to disable the
default tag selection handler. This commit extend the already
existing request::tag mechanism to let handlers select the tags.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee f72dcce4bd titlebars: Use the request system rather than 'manage'.
As awesomerc.lua "manage" section is executed after the rules, using
a 'geometry' or 'placement' property in the rules was broken.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 7cd76e0529 awful.rules: Add 'placement' property 2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee b0aedcda67 awful.rules: Add `new_tag` property
Create a new dynamic tag for the client.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 090f2b83ac awful.rules: Avoid trying to set some properties
This avoid unwanted signals or properties being set twice.
2016-04-20 00:10:42 -04:00
Emmanuel Lepage Vallee ddf14a3ffc awful.rules: Refactor the code to avoid many race conditions.
Testing demonstrated that many rule properties were broken when used
together. This commit try to address this by forcing an execution order
that doesn't trigger the problems.

It is still possible to write broken rules, but it should not happen by
accident anymore. Users should not try to assign the client a tag on
screen 2 and also use screen=screen[1].
2016-04-20 00:08:28 -04:00
Emmanuel Lepage Vallee a2a5448442 awful.rules: Remove dead code
Also change the focus callback signature to match the others
2016-04-20 00:02:38 -04:00
Emmanuel Lepage Vallee 2a8cc08ca1 awful.rules: Make adding new properties easier.
This commit also add a 3 step process to apply rules.

Testing showed that many rules are currently broken because
of execution races.

Create a new dynamic tag for the client.
2016-04-20 00:02:01 -04:00
Uli Schlachter 79e16cf950 awful.rules.execute: Make for loop easier to read
Signed-off-by: Uli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>
2016-04-12 09:33:39 +02:00
Uli Schlachter fb8c70b07d awful.rules: Fix switchtotag with tag names
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-12 09:32:32 +02:00
Uli Schlachter 65fa565cef Update awful.rules tag-related examples
Fixes: https://github.com/awesomeWM/awesome/issues/799
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-12 09:31:46 +02:00
Uli Schlachter 9cc28a8da5 awful.rules: Allow specifying tags by name
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-12 09:31:46 +02:00
Uli Schlachter 53bebfde02 awful.rules: Add support for screen names
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-12 09:27:37 +02:00
Uli Schlachter 2fe9a6dfdf awful.rules: Fix a typo in the docs
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-12 09:26:21 +02:00
Emmanuel Lepage Vallee dd52f1ce86 awful.tag: Move functions to awful.client and screen 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 82342f055c awful.client: Deprecate .floating.get/set
Begin to formalize the getter/setter syntax into a coherent one
2016-04-11 23:46:10 -04:00
Uli Schlachter c455e1f90e Fix luacheck warnings in half of awful
Boy, awful is huge... Let's better do it in two parts

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-11 21:55:32 +01:00
Daniel Hahler 4bffa7e47e doc: fix unintentional rendering as code due to indent 2015-10-14 00:22:26 +02:00
Emmanuel Lepage Vallee 4095eb91a8 Move util.spawn to a new module, add ability to spawn with properties
* This commit add a new module to avoid a (4 level) loop dependency
* It is now possible to call awful.spawn() with a table of properties
* awful.rules is used to execute the rules.

* Everything is public to allow alternative workflow modules such as
    Tyrannical to use their own callback implementation.
2015-09-29 18:05:56 -04:00
Daniel Hahler a251331683 awful.rules: factor out `matches`
This factors out `matches` and uses it in `matches_list` (renamed
from `does_match`) to short-circuit the successful case - where not all
rules have to get checked.

Closes https://github.com/awesomeWM/awesome/pull/431.
2015-09-03 22:56:07 +02:00
Daniel Hahler 285f24d234 Fix awful.rules.does_match: use _rules as arg 2015-09-03 22:55:54 +02:00
Daniel Hahler 1050237d04 minor: fix/improve doc comments 2015-07-12 17:42:53 +02:00
Daniel Hahler 9eb4661cde Fix raising clients with focus=true via awful.rules
In ed09d8e this was changed accidentally, while only `request::focus`
should have been changed:

    -        c:emit_signal('request::activate',"rules")
    +        c:emit_signal('request::activate', "rules", false)
2015-07-10 15:13:16 +02:00
Daniel Hahler cb7f4b06eb Use `hints` table argument with `request::activate` signal 2015-06-25 06:47:39 +02:00
Daniel Hahler ed09d8ed4f Use request::activate with raise=false instead
Ref: https://github.com/awesomeWM/awesome/pull/224#issuecomment-101790416
2015-06-25 06:47:39 +02:00
Julian Wollrath 6cc7be512c Remove the *.in from all files.
Signed-off-b: Julian Wollrath <jwollrath@web.de>
2015-06-19 22:33:32 +02:00