Commit Graph

47 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 21787444e4 client: Simplify screen selection decision tree.
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
2016-09-04 02:52:16 -04:00
Emmanuel Lepage Vallee abb36c3697 tag: Restore the history on the right screen when deleting. 2016-09-04 02:52:16 -04:00
Emmanuel Lepage Vallee 180e70f6d6 tag: Fix off by one when deleting.
If a tag has been deleted, then the number of tags is decremented,
the code still used the old count.
2016-09-04 02:52:16 -04:00
Emmanuel Lepage Vallee 2af0553b67 tag: Fix :delete() when there is no clients
The logic was broken. It prevented tags from being deleted.

This also make sure the boolean return value is always set.
2016-09-04 02:52:16 -04:00
Emmanuel Lepage Vallee d2988d1aab tag: Fix index when screen count change.
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.
2016-09-04 02:52:15 -04:00
Emmanuel Lepage Vallee bbfa6006f3 tag: Fix index calculation.
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
2016-08-22 17:27:48 -04:00
Emmanuel Lepage Vallée f5cfc03e49 tag: Fix restoring invalid tags from history (#963)
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.
2016-06-12 13:09:09 +02:00
Uli Schlachter 0857f6f1b5 Lua: Remove calls to add_signal()
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>
2016-06-04 18:23:48 +02:00
Emmanuel Lepage Vallee 6e6c4c3a5d tag: Avoid a race condition when deleting tags.
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.
2016-05-18 15:46:09 -04:00
Uli Schlachter 5b1f8cd35c Emit more signals when removing a screen's tags
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 15:01:05 +02:00
Uli Schlachter 975aac5c0c awful.tag: Delete a screen's tag on removal
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>
2016-05-08 14:52:31 +02:00
Uli Schlachter 851e0065fe awful.tag.object.delete: Delete a tag's data
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 14:52:31 +02:00
Uli Schlachter a641d88d4e awful.tag.object.delete: Add option to force deletion
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>
2016-05-08 14:52:31 +02:00
Uli Schlachter 962a73c18c awful.tag.object.delete: Remove dead code
The case fallback_tag == nil was already checked some lines above.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 14:52:31 +02:00
Uli Schlachter 9b44e9a011 tag:delete(): Allow deletion of the last tag
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>
2016-04-26 09:34:54 +02:00
Emmanuel Lepage Vallee 299e155acc client: Extend request::tag instead of awful.tag.withcurrent
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.
2016-04-20 00:11:04 -04:00
Uli Schlachter 7d5e80a8ee Add awful.tag.find_by_name
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-12 09:30:52 +02:00
Emmanuel Lepage Vallee f9add1c49a awful.tag: Rename nmaster to master_count 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee e8908e2c62 awful.tag: Rename mwfact to master_width_factor 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee ff9e74ac0b awful.tag: Remove the old dynamic property system
It is no longer relevant.
2016-04-11 23:54:28 -04: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 493684a5c0 awful.tag: Merge API documentation with tag 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee e0897cf170 tag: Support property fallback 2016-03-30 23:25:44 -04:00
Emmanuel Lepage Vallee 3d660ba37e awful.tag: Add "volatile" property
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})
2016-03-11 01:10:13 -05:00
Uli Schlachter 8b65bad3fc Remove useless iteration over screens
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>
2016-03-06 11:37:38 +01:00
Uli Schlachter d56b5c031b Remove some now unnecessary uses of s.index
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>
2016-02-27 09:24:19 +01:00
Uli Schlachter fb5a98c765 Support screen objects in awful.tag
This commit makes the code in awful.tag work with screen objects.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-26 20:08:45 +01:00
Uli Schlachter ee530a65d6 Fix typo in awful.tag.swap
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:48 +01: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
Emmanuel Lepage Vallee 1f5dae8c18 awful.tag: Fix mistakes from cd0503f55 2016-02-04 00:14:51 -05:00
Emmanuel Lepage Vallée 7ffb238ae8 Merge pull request #633 from Elv13/upstream_dynamic_p4
layout: Support layout with a constructor
2016-01-18 22:47:56 -05:00
Emmanuel Lepage Vallee cd0503f552 layout: Support layout with a constructor
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.
2016-01-18 02:12:19 -05:00
Emmanuel Lepage Vallee ab0e3b6112 tag: Refactor awful.tag.setproperty to call setters
*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.
2016-01-16 03:46:38 -05:00
Daniel Hahler 269bb90e18 Only use useless_gap with multiple tiled clients
Fixes https://github.com/awesomeWM/awesome/issues/564.
Closes https://github.com/awesomeWM/awesome/pull/568.
2015-11-20 17:17:21 +01:00
Daniel Hahler 555ccc15a8 doc: typos/grammar 2015-10-14 16:24:52 +02:00
Alastair Robertson b7669161a0 Add optional limit for nmaster/ncol based on number of tiled windows
Closes https://github.com/awesomeWM/awesome/pull/430.
2015-09-19 12:05:28 +02:00
Daniel Hahler 2b2c230f43 Merge pull request #323 from actionless/grow-master
Add "master_fill_policy" tag property and its support in "tile" and "corner" layouts

Closes https://github.com/awesomeWM/awesome/pull/323/files.
2015-09-03 08:53:19 +02:00
actionless 95743683fe style(lib: awful: tag): fix docs 2015-07-30 09:22:26 +02:00
Daniel Hahler cbe684efd1 Add awful.screen.focused [FS#1029]
This allows to configure / override what gets considered to be the
"focused screen".

Ref: https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1029

Closes https://github.com/awesomeWM/awesome/pull/94.
2015-07-21 12:51:45 +02:00
actionless fb4a331014 feat(lib: awful: layout: suit: tile): add support for 'master_fill_policy' 2015-07-20 18:32:19 +02:00
actionless 0028349226 feat(lib: awful: tag, layout): add 'master_fill_policy' property to tag 2015-07-20 18:32:19 +02:00
Daniel Hahler ae7c7ff382 awful.tag: emit property:: signals only on change
This can have a significant performance impact in case you listen to the
property::hide signal to auto-hide tags for example.
2015-07-09 13:04:29 +02:00
Daniel Hahler 367ad2d9a6 awful.tag.delete: single call to #c:tags()
This is a minor performance optimisation I came across.
2015-07-07 18:42:24 +02:00
actionless 82549c04cd feat(lib: awful: tag): get useless_gap from beautiful if no any 2015-07-02 23:24:04 +02:00
Emmanuel Lepage Vallee 1aacf1efc4 Add useless gap utility functions 2015-07-02 22:11:01 +02:00
Julian Wollrath ba62665fd6 Remove some trailing whitespaces. 2015-06-19 23:13:31 +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