This adds a tparam alias "@screen" for "@tparam screen" (when used to
document e.g. arguments for callbacks), and "@screen_or_idx" when a
function accepts a "screen" or "number".
This commit remove the `awful.tag` "manage" hook. The relevant
code has been moved to ewmh.lua request::tag handler. The handler
is called either by a volontary screen change or by a forced one.
It also require the awful.rules to be executed. This is done by
default and the user would have to explicitly disable that
behavior. From now on, disabling the rules require the user to
handle tag selection.
Fixes#1028#1052
There was still a problem that caused the "old" tags to be
inserted in the wrong position when "saved" from a screen being
removed.
Also, this use a :get_tags(true) to save an uneeded sorting pass.
The index was updated on an unordered table. As the elements
order did not match the relative indices once they have been
changed, further calls to set_index produced garbage.
The default taglist didn't notice because it use screen.tags
table index instead of the tag index. A debug using
echo 'for _,t in ipairs(mouse.screen.tags) do
print("INDEX:", _, t.index, t.name) end' | awesome-client
Would have shown two or more elements with the same index. To
debug issues related to tag indices, this bash script can be
enabled:
while true; do
echo 'for _,t in ipairs(mouse.screen.tags) do
assert( _==t.index) end' | awesome-client
sleep 0.5
done
If:
1) An app is open in a tag
2) A new tag is created
3) The app is closed in the first tag
4) The first tag is deleted
5) The new tag is deleted
Then this history would try to restore an inactive tag without
a screen. Bad things will then happen.
The requirement to call add_signal() was added to catch typos. However, this
requirement became increasingly annoying with property::<name> signals and e.g.
gears.object allowing arbitrary properties to be changed.
All of this ended up in a single commit because tests/examples fails if I first
let add_signal() emit a deprecation warning.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Since the screen removal patchset, the tags properties were
cleaned too early. This caused code connecting to "property::activated"
to be called with the tag already partially deleted. For code depending
on those properties, such as radical.impl.taglist, this caused errors.
Any clients with these tags end up somewhere random (the first tag on the first
remaining screen). This certainly can be improved in the future, but at least
this is a start.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When this force-argument is not given, the code will refuse to delete a tag
which has a non-sticky client. With this force argument, the client will just be
moved to the fallback tag.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When a tag is deleted, this code tries to select some other tag. If the tag
which is to delete is the last tag of a screen, this code failed and indexed a
nil value. Fix this with a simple "if".
Signed-off-by: Uli Schlachter <psychon@znc.in>
There was a regression when refactoring the API. It was no longer
possible to disable the automatic tag selection.
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.
Useful when using dynamic tags. The tags will be closed once
it is empty. This was part of Tyrannical for many years, but is
generally useful for other workflows too.
local t = awful.tag.add("my_tag",{volatile=true, screen=2})
awful.spawn("ayapp", {tag=t})
Signals on instances are also emitted on the class and thus we can just connect
to the signal on the class here.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Because all our Lua code can now work with screen objects, most of the uses of
s.index that the previous patches added for reaching this goal can be removed
again.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This allow the most basic kind of stateful layouts to be created.
It is now possible to have layout instances instead of global
stateless layout arrange functions.
*WARNING* This introduce a minor API break as awful.tag.setscreen
arguments are now swapped for consistency
This allow to introduce logic for each properties and improve
awful.tag.add and execute logic when setting properties.