Commit Graph

3660 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 4492a37885 naughty: Use a request handler to clear the notification icon. 2020-03-16 04:45:52 -04:00
Emmanuel Lepage Vallee c75203ac03 naughty: Handle icon paths with file:// in them. 2020-03-16 04:44:11 -04:00
Emmanuel Lepage Vallee 32fd11a220 naughty: Move the get_icon implementation to 2 request handlers.
They can now be disconnected or extended.
2020-03-16 04:44:10 -04:00
Emmanuel Lepage Vallee c3cdac368d naughty: Stop request::icon as soon as there is an icon. 2020-03-16 04:43:53 -04:00
Emmanuel Lepage Vallee 625b9c8901 object: Add a private API to optimize chain of responsibilities.
Currently, emit_signal always call all connected function. However,
it is very wasteful for some I/O intensive operations like icon
lookup. This commit adds a trick (private API) to stop once
a condition is met.

It will also in the future be used for the permission system, but
this is not yet implementd.
2020-03-15 04:08:06 -04:00
Emmanuel Lepage Vallee a3c37382be naughty: Add a new request::icon for the main icon.
My initial implementation was overly optimistic. It turns out there
is no end in sight to "correctly" support icons. Apps randomly use
XDG name, paths and URLs. Rather than baloon the size of the
implementation, this commit moves toward to request:: pattern
found in other APIs. This will allow people who wish to "fix"
specific icons to do so in a way that scales.

The next 2 commits will move the current implementation to request
handlers.
2020-03-15 03:35:40 -04:00
Emmanuel Lepage Vallee 9cf717b994 naughty: Replace request::icon by request::action_icon.
It wasn't a good idea to use ::icon because sometime the notification
themselves needs to request assistance for their icons.
2020-03-14 20:21:35 -04:00
ArenaL5 e7436f132f Expose get_key_name under awful.keyboard as suggested by @Elv13
and change comments and declaration style to match the rest of the codebase

Signed-off-by: ArenaL5 <arenal5@gmx.com>
2020-03-14 19:33:04 -04:00
ArenaL5 131b25473f Integration of `get_key_name()` in `hotkeys_popup`
Signed-off-by: ArenaL5 <arenal5@gmx.com>
2020-03-14 19:04:08 -04:00
Rob Hoelz 1637e03dad Fix broken link to Pango markup documentation 2020-03-12 21:19:22 -05:00
Emmanuel Lepage Vallée 1e1f5380a6
Merge pull request #3029 from Elv13/notification_markup
Fix most reported notification issues.
2020-03-09 14:16:35 -04:00
Emmanuel Lepage Vallee 21cb4037bc naughty: Fix updating the icon of DBus notification when passed by path. 2020-03-08 19:44:16 -04:00
handsome0hell e5b12877b9 use user specified permission.
User settings should override default behavior.
2020-03-08 05:04:40 -04:00
Emmanuel Lepage Vallee 97e403b4e9 naughty: Correctly scale large square icons.
Fix #3005
2020-03-07 21:34:02 -05:00
Emmanuel Lepage Vallee a69b6123b8 naughty: Fix updating `naughty.widget.icon`.
It was never call, untested and obviously broken...
2020-03-07 21:34:02 -05:00
Emmanuel Lepage Vallee d5b652973f naughty: Emit `property::icon` when the `image` or `images` change.
This way updating the icon at least *can* work.
2020-03-07 21:34:02 -05:00
Emmanuel Lepage Vallee 92d6fcda92 client: Check if `border_widht` is `nil` before setting it.
Fix #3026
2020-03-07 21:34:02 -05:00
Emmanuel Lepage Vallee b6ce95cd15 naughty: Improve the rendering of notifications with invalid markup.
Some case like `foo<b>bar` still fail, but at least `foo<<<>>>bar`
works.

Fix #3022
2020-03-07 21:34:02 -05:00
Seth Barberee cbb03d1a0d add example for hotkeys_popup.widget 2020-03-06 07:09:29 -06:00
Emmanuel Lepage Vallée 3bd777f61a
Revert "naughty.widget: xml_escape message and title text" 2020-03-05 01:38:27 -05:00
Unai Fernández 6934efdd32 naughty.widget: xml_escape message and title text
fixes empty notifications when special characters like '&' are used
2020-03-04 19:32:13 +01:00
Emmanuel Lepage Vallee 75f51d2fee keyboardlayout: Document `next_layout`. 2020-02-29 19:47:36 -05:00
Emmanuel Lepage Vallee c220bcce87 widget: Enable properties by default for API level 5. 2020-02-29 19:47:36 -05:00
Emmanuel Lepage Vallee 870cf261fb keyboardlayout: Enable properties. 2020-02-29 19:47:36 -05:00
Emmanuel Lepage Vallee 4c5fd3f222 widget: Fix set_buttons on widgets where properties are disabled.
Fix #3008
2020-02-29 19:47:36 -05:00
Unai Fernández 2c51493a69 client: Fix property.persist 2020-02-28 13:25:02 +01:00
Xaver Hellauer df5d092304
Fix documentation of beautiful.menubar* options 2020-02-27 11:19:09 +01:00
Emmanuel Lepage Vallée f88efc8854
Fix the layoutbox screen
Fix #3004
2020-02-23 16:14:06 -05:00
Emmanuel Lepage Vallée dd289e5ab2
Merge pull request #2853 from Elv13/notif_rules
Add the notification rules.
2020-02-22 18:48:27 -05:00
Emmanuel Lepage Vallée 6bd1c1031a
Update lib/ruled/notification.lua
Co-Authored-By: Seth Barberee <seth.barberee@gmail.com>
2020-02-22 18:48:06 -05:00
mergify[bot] 923c3e21f0
Merge pull request #3001 from ArenaL5/abbreviate
Abbreviate cheatsheet
2020-02-22 23:47:12 +00:00
ArenaL5 2d3f7e1e94 Clarify documentation of `widget.merge_duplicates`
Signed-off-by: ArenaL5 <arenal5@gmx.com>
2020-02-21 00:07:52 +01:00
Seth Barberee b3766c0544 add two examples for awful.wibar 2020-02-20 04:51:44 -06:00
ArenaL5 74f3e40c93 Document the newly exposed `awful.key.keygroups`
Also, more detail in the descriptions of properties `description` and `keygroup`

Signed-off-by: ArenaL5 <arenal5@gmx.com>
2020-02-20 03:56:46 +01:00
ArenaL5 7517bf6fae Add ability to abbreviate merged entries in awful.hotkeys_popup
Signed-off-by: ArenaL5 <arenal5@gmx.com>
2020-02-20 02:51:51 +01:00
ArenaL5 0eaaa5e425 Fix the definition of keygroup arrows
Also add a short comment about the format of keygroups.

Signed-off-by: ArenaL5 <arenal5@gmx.com>
2020-02-19 01:57:44 +01:00
Emmanuel Lepage Vallee f50a84b70b tests: Disable the default `rc.lua` rules for the sake of testing. 2020-02-17 04:41:28 -05:00
Emmanuel Lepage Vallee e12b5fb097 naughty: Break the API (sorry) to make the signals more standard.
Most of the notification code is from 2017. Soon after being written,
the permission system started to take shape. This required to
standardize the `request::` signals into the "object, context, args"
style. The notification code wasn't merged during that refactoring
and was accidently merged without the fixes.

Since this is still unreleased, I break the API now before it is too
late. Sorry about this.
2020-02-16 02:28:03 -05:00
Emmanuel Lepage Vallee 05ba03538f ruled.notification: Add a `never_timeout` property.
It was possible to set `timeout = 0`, but this is weird to document.
Better just add a variable.
2020-02-16 02:28:03 -05:00
Emmanuel Lepage Vallee 30df6055b7 ruled.notification: Do not require `naughty`.
Since it is used only one, use require() directly. This allows
to require it from `beautiful` without a circular dependency.

In turn, this allows to set colors using the rules rather than
adding an endless amount of theme variables.
2020-02-16 01:25:47 -05:00
Emmanuel Lepage Vallee cab352781d ruled.notifications: Add an implicit timeout to the rules.
This replaces the old preset one.
2020-02-15 21:45:35 -05:00
Emmanuel Lepage Vallee afe58d6cd2 notification: Add rules for notifications.
This commit introduce the new "ruled" module. This new top level
module will eventually host all "rules" related modules.

As for the content of the commit, it adds rules for notification. They
are mostly identical to the client rules and can be used to customize
or filter the notifications. It replaces the old "preset" API. The
preset API inner working was mostly a duplication of the early
`awful.rules` API, but was never as flexible. Thus the idea behind this
work is to converge all "core" classes to use a similar declarative API.
2020-02-15 20:33:21 -05:00
Mahe 6779a61b40
mouse: respect border width in get_current_widgets (#2990) 2020-02-15 19:27:33 -05:00
Emmanuel Lepage Vallée 59b31e74b3
Merge pull request #2988 from Elv13/notif_rules_groundwork
Fix multiple notifications issue
2020-02-15 17:59:28 -05:00
Emmanuel Lepage Vallée 10e32198e7
Merge pull request #2982 from Elv13/modeline
Support shebangs (#!), modelines, API levels and add more doc.
2020-02-15 17:53:41 -05:00
Uli Schlachter 225bb8a8c6 Consider icon spacing in systray:draw()
When less space is available than was asked, systray:draw() has to
compute the right base size so that all the icons fit into the available
space. This computation so far ignored the icon spacing, resulting in a
too large base size.

Fixes: https://github.com/awesomeWM/awesome/issues/2981
Signed-off-by: Uli Schlachter <psychon@znc.in>
2020-02-13 12:11:41 -05:00
mergify[bot] fd237b9cd8
Merge pull request #2991 from psychon/cleanup_tag_history
Cleanup tag history on screen removal
2020-02-13 00:31:04 +00:00
Uli Schlachter 38a2a524a7 Cleanup tag history on screen removal
The tag history kept a strong reference to a screen even after that
screen was removed. This prevented the garbage collector from cleaning
up.

Fix this by getting rid of the tag history on screen removal.

Related-to: https://github.com/awesomeWM/awesome/issues/2983#issuecomment-584249568
Signed-off-by: Uli Schlachter <psychon@znc.in>
2020-02-12 20:33:21 +01:00
Emmanuel Lepage Vallee 720bef0b02 naughty.notification: Do not hold a strong reference to the screen.
The screen will leak if there is active notifications when the screen
is removed. Note that as of this commit, it still does, but "less".
2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee d60c9ed0dd gears.geometry: Add a `rectangle.is_inside` function. 2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 9d6ce1d298 doc: Fix gears.geometry doc. 2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee edbf254c51 naughty.box: Have a better error message when an invalid position is set 2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 816188163a naughty: Fix an internal index corruption issue.
Due to some signal callbacks, some notifications could be added twice
to the by-position index.
2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 8190ece3b2 placement: Fix a parent geometry bug in `next_to`.
The function returns the geometry of the parent object. As it was used,
it was passed the parent object directly. The means the parent geometry
of the parent object was used instead of the geometry of the parent
object. This worked "fine" as long as the mouse was in the same screen,
but it was just hiding the bug.
2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 0703fa2197 naughty.box: Move the notification when a screen is resized. 2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 207efe318a doc: Upgrade the notification documentation to the latest standards. 2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee ef7e4ce967 naughty.box: Allow constructor arguments to be passed to `wibox()`.
Because it was using a metatable proxy instead of a full copy,
`pairs()` wasn't working and thus any code based on it was
blind to the `args`.

Fixes #2956
2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 21caa19a21 naughty: Add a way to revert to the legacy mode.
When `rc.lua` will use the new notification API by default, we need
a way to revert back to the lagacy mode to be able to test it.
2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 9ec11bf1b3 naughty: Fix the screen property for the `box` layout.
The original idea was to decouple the notification and the screens, but
this causes the default `rc.lua` to behave in very unexpected ways.

This commit re-implement the `legacy` logic for the `box` layout.
2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee f5b5e6d90d naughty: Add a `request::screen` handler. 2020-02-10 04:13:17 -05:00
Emmanuel Lepage Vallee 636cc2bf9c naughty.background: Do not use the deprecated `shape_border_width`.
The notification code predates the deprecation, but was merged after
it.
2020-02-10 03:30:21 -05:00
Emmanuel Lepage Vallee e0dac2e901 awful.popup: Replace the deprecated awful.util.table with gears.table.
The popup code is older than the deprecation, but was merged after it.
2020-02-10 03:30:21 -05:00
Emmanuel Lepage Vallee 9cbc8a18c0 rc.lua: Revert moving the sloppy focus to awful.permissions.
This caused a behavior change it wasn't clear how to use the
permission API to change the focus mode.

The change will only take effect if the user override the API
level.
2020-02-08 17:59:16 -05:00
Emmanuel Lepage Vallee e0b982fa1a gears.debug: Use the API level as the source of truth.
Rather than the version.
2020-02-08 17:18:01 -05:00
Emmanuel Lepage Vallee 68a6c978f5 doc: Document that wibox have class-level signals. 2020-02-02 21:07:07 -05:00
Emmanuel Lepage Vallee 973671b081 doc: Document that awful.mouse.resize/move use the permission framework. 2020-02-02 21:07:06 -05:00
Emmanuel Lepage Vallee 44301589c4 wibox: Connect the existing request::geometry signal to an handler.
The signal has been implemented for years, but nothing was connected
to it.
2020-02-02 21:07:04 -05:00
Emmanuel Lepage Vallee 0c08bb4304 widget: Add class-level signal forwarding.
Just like clients and other CAPI classes, it is now possible to
connect to all instance signals. There was already a couple of
`request::geometry`, but no way to forward them, so it was
de-facto broken.
2020-02-02 21:06:19 -05:00
Emmanuel Lepage Vallee 5891783ba9 wibox: Do not overwrite `gears.object` methods.
The next commit will all class level signals. The current design
is used in widgets, but is a bad fit for wiboxes. They should
behave more like client. In v5, setting methods on `wibox` directly
will be deprecated. `wibox.object` is already supported. I don't
think anyone really do that anyway and isn't documented.
2020-02-02 21:06:16 -05:00
Aire-One 02b1a6b633 Fix missing `self` parameter in documentation usage examples. 2020-01-28 10:57:43 +01:00
Emmanuel Lepage Vallée 2f905f2522
Merge pull request #2895 from Elv13/ruled_client
Move `awful.rules` to `ruled.client`.
2020-01-19 20:15:52 -05:00
Uli Schlachter 8df463f971 doc: Improve the client documentation. 2020-01-19 20:30:06 -05:00
Emmanuel Lepage-Vallee cb9c33cda8 "Really" deprecate the client marked and unmarked signals.
The doc said they were deprecated in 4.0, but back then there was
no API to deprecate signals.
2020-01-19 20:30:06 -05:00
Emmanuel Lepage-Vallee 74ba84b299 doc: Make use of the @classsignal tag.
It wasn't doing anything until now.
2020-01-19 20:30:06 -05:00
Emmanuel Lepage-Vallee 575b0f12dc doc: Remove all type aliases.
They render poorly and serve no purpose.

    #!/bin/bash
    for FILE in $(git ls-files | grep -E "\.(h|c|lua)" | grep -v tests | grep -v spec); do
        sed -i 's/^[ ]*--*[ ]*@client /-- @tparam client /g' $FILE
    done
2020-01-19 20:30:06 -05:00
Emmanuel Lepage-Vallee 5e720c9744 doc: Major client documentation backfill.
This commit mostly rewrite the client documentation and pay the
technical debt accumulated over the years. Most of the client
documentation was still one-liners from the luadoc era. It now
has all the new tags, type. It also has actual description of
what the properties do beyond the name.
2020-01-19 20:11:19 -05:00
Yauhen Kirylau 37aa23be86 fix(gears: string: split): support more delimiters (#2962) 2020-01-19 19:04:28 -05:00
laith-m0 65512b5ea9 Fix prompt navigation (#2970)
1. Open any awful.prompt(mod+r or mod+x)
2. Type ()->
3. Press alt+b two times
2020-01-19 19:00:56 -05:00
Emmanuel Lepage Vallee 20743a9a16 Remove all usage of the now deprecated `awful.rules`. 2020-01-19 02:59:10 -05:00
Emmanuel Lepage Vallee e309059f4c doc: Add more example to awful.client. 2020-01-19 02:58:49 -05:00
Emmanuel Lepage Vallee b1a4b1dd9a doc: Add a flowchart for ruled.client. 2020-01-19 02:58:46 -05:00
Emmanuel Lepage Vallee 71c230035c rules: Move `awful.rules` to `ruled.client`.
From now on, all core object will have their own rules. `awful.rules`
hardcodes some client specific code. All `rules` module have some form
of class specific code. This code will now be part of a new module
called `ruled`. Since a year or so, a lot of work has been done to
refactor the rules on top of the shared `gears.matcher` class. This way
there wont be as much duplication.
2020-01-19 02:58:37 -05:00
Emmanuel Lepage Vallee 39c90b8303 hotkeys: Port away from awful.rules 2020-01-19 02:39:30 -05:00
Emmanuel Lepage Vallee 6ee294fd5a doc: Make sure the ruled module init.lua is ignored.
This has to be in its own commit otherwise Travis will fail. This
is because it will keep the file in the build directory when
iterating all commits. Then `ldoc` will fail because the file doesn't
have documentation. If `config.ld` is updated first, then it will
fail because `ruled/init.lua` doesn't exist yet. When it is done
in a separate commit, then `config.ld` is already updated and comes
with `init.lua`.
2020-01-19 01:55:54 -05:00
Emmanuel Lepage Vallee da8daa8dfc debug: Allow "deprecated_in" for class deprecation. 2020-01-19 01:55:51 -05:00
Emmanuel Lepage Vallée 5ad02d0b8b
Merge pull request #2948 from actionless/vim-keys-add-folds
Vim hotkeys: add folds
2020-01-18 16:56:33 -05:00
Seth Barberee ab6381686e add calendar_popup pic to doc 2020-01-17 16:02:18 -06:00
Emmanuel Lepage Vallee 6ecab5f2f1 doc: Add documentation in each objects which emit request:: signals. 2020-01-11 15:43:31 -08:00
Emmanuel Lepage Vallee e77dd01e5a Add more TOVOv5 for unfixable APIs.
Another pull request at some point will add proper API levels,
it will then become possible to fix these without breaking
the API for everybody. However right now there is no way around
the problems.
2020-01-11 15:43:31 -08:00
Emmanuel Lepage Vallee 6b427e73a8 tag: Add a request::layouts signal and append/remove layout. 2020-01-11 15:43:31 -08:00
Emmanuel Lepage Vallee 668ed6135c client: Add a `:grant()` and `:deny()` method for permissions.
This is a lower level API than what most people will end up using
(the rules), but it is useful enough to expose to the public API.
2020-01-11 15:43:31 -08:00
Emmanuel Lepage Vallee 5818de41ce awful: Rename awful.ewmh to awful.permissions.
It has nothing to do with EWMH since a long time. It was already used
for the requests, so lets formalize this.
2020-01-11 15:43:30 -08:00
Emmanuel Lepage Vallee efc42b1be1 autofocus: Modify `awful.autofocus` to be a request::.
This also pulls in part of the permission framework to ensure
backward compatibility is kept.

`awful.autofocus` was always weird. It is a module part of `awful`,
but it was never part of `awful` `init.lua`. Rather, `rc.lua` was
the sole place it was used. It behave exactly like a request, but
predate them by years. As I cleanup the request:: API before the
permissions API gets formalized, this has to be fixed now.

It isn't deprecated in this commit because it makes too many tests
fail. Another pull request will solve that by adding the "API level"
concept to AwesomeWM so I can change the behavior without breaking
existing configs. With that, the behavior of `autofocus` will be
enabled by default with the permissions to disable it.
2020-01-11 15:43:15 -08:00
Emmanuel Lepage Vallee 5ad0856fee layout: Add a `request::default_layouts` to fill the list of layouts.
This will allow the default client layout list to be manipulated by
modules without the risk of overwriting each other.

The commit also add a new `--{{{ Tag --}}}` section to `rc.lua`. It will
be expanded once the tag rules get merged.
2020-01-11 15:43:15 -08:00
Emmanuel Lepage Vallee 55a097efc7 client: Update existing code to use `property::active`. 2020-01-11 15:43:15 -08:00
Emmanuel Lepage Vallee 04c757322c client: Turn `rc.lua` logic into a new `request::border` signal.
The default `rc.lua` was using the focus/unfocus signals to set
the border color along with `awful.rules`. This logic block was
no longer aligned with the rest of `rc.lua` since it was
the only place where `beautiful` variables where only used by
`rc.lua`.

On top of this, the new request handler also has extra contexts
for the urgent and floating/maximixed use cases. So it can be used
by themes to implement much smarter borders than just focus based
ones. They were previously limited by the fact most of the
(un-monkey-patchable) logic was in `rc.lua`.

Note that this commit also shuffle the awful.rules order between
the titlebar and the border and changes the tests accordignly.
After some consideration, I came to the conclusion the previous
behavior was bogus and the fact that the placement tests required
to know about the titlebar height is simply a proof of that. The
change was required in this commit because since the border is no
longer in the default rules, a new buggy edge case surfaced.
2020-01-11 15:43:11 -08:00
Emmanuel Lepage Vallee c10bdc3cfe client: Add a property::active signal. 2020-01-11 14:43:56 -08:00
Emmanuel Lepage Vallee ba5385dd40 client: Update existing code to use `c.active`. 2020-01-11 14:43:56 -08:00
Emmanuel Lepage Vallee 58f3ea740f client: Add an `active` property to check if a client has focus.
This follows in the footsteps of:

 * request::activate
 * awful.ewmh.add_activate_filter
 * c:activate{}
2020-01-11 14:43:56 -08:00
Emmanuel Lepage Vallee 067bcaca60 client: Rename the `manage` and `unmanage` signals.
They currently fit the general concept of a `request::` in the sense
that they are not property related and have "request handlers".

The commit also add deprecation for signals.

The reason for this fits within the larger standardization project.
Non-namespaced signals will eventually be renamed. This has started
a long time ago.

What is old is new again. Once upon a time, there was a `startup`
parameter to the `manage` signal. It is now back in the form of
a context.

Finally, this commit removes the `manage` section of `rc.lua`. It no
longer did anything worthy of being in the config. Each of its
important parts have been moved out over the years and the last
remaining bit is always required anyway. The code has been moved
to `client.lua`.
2020-01-11 14:43:56 -08:00
Emmanuel Lepage Vallee cd253ed815 client: Add an `activate` method.
This method aims to provide a centralized, declarative API to focus
clients. Currently, there is tons of code using "request::activate",
including `rc.lua` and have extra boilerplate code around it to
handle some corner case (such as minimization and clients already
having the focus).

This code takes room, is repetitive and force some imperative logic
to be in `rc.lua`.
2020-01-11 14:43:56 -08:00
Seth Barberee b9bb9cbe69 add docs for gears.cache 2020-01-05 20:58:36 -06:00
Emmanuel Lepage Vallée b8c83fdf9c
Merge pull request #2949 from Elv13/more_trivial_doc
More trivial doc fixes
2019-12-28 12:29:19 -08:00
erik-f 56f2fcfccc
wibox.container.margin: Allow nonnegative dimensions
Commit f025409 avoided negative dimensions but 
also stopped allowing width and height to be zero.

For widgets like awful.widget.watch it is reasonable 
to allow dimensions to be zero because in many cases when 
the margin container is being calculated the watch widget is 
still computing and therefore has width and height zero.
2019-12-27 12:36:54 +01:00
Emmanuel Lepage-Vallee 833948ea67 doc: Polish the awful.widget doc.
A lot of them were missing the inheritance includes.
2019-12-21 21:53:57 -08:00
Emmanuel Lepage-Vallee 9f42f57a76 doc: Upgrade the gears.timer documentation to the new standards. 2019-12-21 21:35:12 -08:00
Emmanuel Lepage-Vallee c32c2bf43d doc: Upgrade the keygrabber to the newest standards. 2019-12-21 21:27:21 -08:00
Emmanuel Lepage-Vallee 3af095e4b0 doc: Upgrade the tooltip documentation to the new standards. 2019-12-21 21:20:11 -08:00
Emmanuel Lepage-Vallee 0393c93f42 doc: Upgrade the wibar documentation to the new standards. 2019-12-21 20:58:53 -08:00
Emmanuel Lepage-Vallee 6e4eb134b0 doc: Upgrade the `awful.popup` documentation to the new standards. 2019-12-21 13:39:46 -08:00
Emmanuel Lepage-Vallee 3c26ccc424 doc: Port the `wibox` module to the new doc format. 2019-12-21 13:25:25 -08:00
Seth Barberee d05b7d80f1 gears.string doc revamp 2019-12-19 09:52:03 -06:00
actionless 75e5b8b39b refactor(hotkeys: vim): don't add each group rule manually 2019-12-19 11:42:27 +01:00
actionless db9334605a fix(hotkeys: vim): don't use hardcoded colors 2019-12-19 11:38:46 +01:00
actionless a3b4e07415 chore(hotkeys: vim): add fold-related 2019-12-19 11:37:24 +01:00
Seth Barberee 9e3c418a03 add gears.table.cycle_value (#2942) 2019-12-12 22:10:10 -08:00
Emmanuel Lepage Vallée a6e52a8c42
doc: Fix an incorrect signal name. (#2943)
Reported by @unai-ndz

See #1373
2019-12-11 10:01:54 -08:00
Emmanuel Lepage Vallee a4e463fd55 awful.mouse: Move more code into submodules.
Just like 5 years ago, the dependency mess caused by the giant
`awful.client`, `awful.tag` and `awful.placement` requires to
split the code into small files with less dependencies and include
those.

In this case, the goal is to use the `awful.mouse.client` functions
from `awful.client`.
2019-12-06 01:25:08 -05:00
Emmanuel Lepage Vallee 1fe90513be placement: Do not depend on `awful.layout`. 2019-12-06 00:51:54 -05:00
Emmanuel Lepage Vallee 44cdde57a9 awful.mouse: Do not depend on awful.layout.
It was only used to check if its the floating layout, there is a
less intrusive dependency to check that.
2019-12-06 00:51:54 -05:00
Emmanuel Lepage Vallee 0d1b34e54a placement: Remove a nearly unused dependency.
`awful.client` was only used once and the function exists as a
screen method. This will help untangle the dependencies a bit...
To tangle them even more after that...
2019-12-06 00:51:54 -05:00
Emmanuel Lepage Vallee 36999de123 placement: Stop detecting screen objects using `type(o.geometry)`.
All object type will now use tables instead of function, so this
check will break.
2019-12-06 00:51:54 -05:00
Emmanuel Lepage Vallée d2b7d292b0
Merge pull request #2939 from SethBarberee/layoutbox-doc
Add layoutbox example
2019-12-06 00:18:24 -05:00
Seth Barberee 431791accc add layoutbox example 2019-12-05 23:48:55 -05:00
Emmanuel Lepage Vallee 44a665d381 awful.rules: Use the `awful.client/mouse` default buttons and keys. 2019-12-05 22:49:59 -05:00
Emmanuel Lepage Vallee 1f604a73c9 awful.key: Support multiple keys per `awful.key` objects.
This allows to support the arrows, numpad or numrow using a single
object. This will simplify some code, including `rc.lua`.
2019-12-05 22:48:56 -05:00
Emmanuel Lepage Vallee d6568993e2 awful.mouse: Add a "request::default_mousebindings" signal.
`rc.lua` and the module must attach to this signal to add buttons
to the default set.
2019-12-05 22:48:52 -05:00
Emmanuel Lepage Vallee 8b6ea8243a awful.mouse: Add a function to remove a default client button. 2019-12-05 22:45:05 -05:00
Emmanuel Lepage Vallee 7dfd32e4ba awful.keyboard: Add a function to remove a key from the default set. 2019-12-05 22:45:05 -05:00
Emmanuel Lepage Vallee 80c65c5175 awful.mouse: Add a `append_mousebindings` function.
To preserve the symetry between the `button` and `key` API.
2019-12-05 22:44:13 -05:00
Emmanuel Lepage Vallee 370e754006 awful.mouse: Add a function to add a new `awful.button`s to clients. 2019-12-05 22:38:14 -05:00
Emmanuel Lepage Vallee a8e8c46b56 awful.keyboard: Add a method to add a default client key.
This is the first commit of a new API to add and remove buttons
and keys from clients. The goal is to get rid of the default `rc.lua`
"hardcoded" list of client buttons and keys to allow modules to modify
the defaults. This is part of the larger effort to make `rc.lua`
modular.
2019-12-05 22:32:00 -05:00
Emmanuel Lepage Vallee c96487515f object: Make the legacy accessor code more robust.
* Using `= one and two or three` is a bad idea on boolean.
* Using # to check if a table has content doesn't work on named keys
2019-12-04 02:05:09 -05:00
Emmanuel Lepage Vallee a065e2e1a9 client: Add append/remove methods for buttons and keys.
Another step toward ensuring all components can be manipulated
non-destructively by modules.
2019-12-04 02:05:05 -05:00
Emmanuel Lepage Vallee 42dceb1db8 object: Add a standard implementation for append and remove.
This is for legacy accessors only, but it will be expanded later.
2019-12-04 01:40:32 -05:00
Emmanuel Lepage Vallee fbe2b34af4 properties: Allow to delay some operations.
This will be useful for the append/remove support.
2019-12-04 01:40:32 -05:00
Seth Barberee 7440cf66f0 more docs for launcher (#2935)
Co-Authored-By: Aire-One <Aire-One@users.noreply.github.com>
2019-12-04 00:08:40 -05:00
Emmanuel Lepage Vallée 1b24acf2ea
progressbar: Fix a major regression. (#2933)
The typo was introduced when the signal and accessors were standardized
for to make the documentation less wrong.

Fix #2932
2019-12-01 03:35:26 -05:00
Emmanuel Lepage Vallée 4cac2463ad
Merge pull request #2929 from Elv13/doc_fix_modules_summaries
Doc fix modules summaries
2019-11-30 03:32:40 -05:00
Emmanuel Lepage Vallee f21e0ba9dd doc: Upgrade the widget layout documentation. 2019-11-30 01:26:06 -05:00
Emmanuel Lepage Vallee be14666b4a doc: Modernize the widget doc.
This hass the following tags:

 * @interface
 * @tparam
 * @propbeautiful
 * @propemits
 * @renamedin

Beside tags, it adds some comments, fix formatting and add
new lines and dots where they belong.

Also add some signals to standardize everything.
2019-11-30 01:26:06 -05:00
Emmanuel Lepage Vallee 095e50b687 doc: Modernize the container documentation.
This hass the following tags:

 * @interface
 * @tparam
 * @propbeautiful
 * @propemits
 * @renamedin

Beside tags, it adds some comments, fix formatting and add
new lines and dots where they belong.

Also add some signals to standardize everything.
2019-11-30 01:26:06 -05:00
Emmanuel Lepage Vallee d2e5694f9c background: Add some property signals and update the doc.
It had no signals for the properties. That's non standard and has
been fixed.

The documentation tags were also upgraded to the latest standards.
2019-11-30 01:26:03 -05:00
Alex Belykh 09ad7d83c5 Fix missing naughty.dbus.config.mapping defaults 2019-11-29 22:37:20 +07:00
mergify[bot] a0386dad91
Merge pull request #2921 from Aire-One/doc_fix_modules_summaries
[Draft/Proposal] DOC - Fix modules summaries.
2019-11-29 06:22:34 +00:00
mergify[bot] d52e332b96
Merge pull request #2928 from Aire-One/doc_screen_images
[Documentation] `screen` module - Improvement on generated image: client part.
2019-11-28 22:18:31 +00:00
Aire-One 3e6c33af64 Add imagebox doc example for `resize` property. 2019-11-28 13:53:59 +01:00
Aire-One 15209b305c Fix imagebox constructor missing argument. 2019-11-28 13:53:59 +01:00
Aire-One 90f89432d2 Improvement following the @psychon review. 2019-11-28 13:53:59 +01:00
Aire-One 5bf703416c Improve `wibox.widget.imagebox` documentation.
* Add the ldoc stop marker `.` to each functions, properties and methods definition ;
* Improve a little summaries ;
* Improve properties vs access methods documentation ;
* Change all documented parameters and return values to typed values.
2019-11-28 13:53:59 +01:00
Aire-One 86a9bbfd71 Improve the `wibox.widget.imagebox` descrition.
* Add a better descrition for the `imagebox` role in the wiboxes system ;
* Improve image + code render and integration into the descrition ;
* Add a second code exemple to show both coding style (imperative and declarative).

I think the user can now have a better overview of what's a `wibox.widget.imagebox` and how to use it.
2019-11-28 13:53:59 +01:00
Aire-One 82a2769e04 Fix ldoc modules summaries missing the final `.`. 2019-11-28 13:53:59 +01:00
Aire-One fcc3d0b590 Add an option to draw clients.
Change how wibox are drawn to build a more flexible function reusable in the context of clients.
Add `clients` option to the template. This new option needs an associative table `{ ['label'] = client }` to work. Where label will be a text rendered on the middle of the client area.
Add a new example: `texts/examples/screen/tiled_clients.lua`.
2019-11-28 13:31:21 +01:00
Uli Schlachter 8d2c986936 Emit property::screen in tag:delete()
Before this commit, the code directly modified the table where the tag's
properties were saved. This commit changes the code to call
awful.tag.setproperty() instead. This function ensures that
property::screen is now also emitted.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-11-27 01:39:11 -05:00
Jordan Christiansen c09e5b16b7 Correct the name of get_children's return value (#2927)
get_children's return value should not be called "The". That was a
mistake because ldoc requires a name for return values and parameters.
If a name isn't provided, it thinks the first word of the description
is the name.
2019-11-25 17:04:01 -05:00
Jordan Christiansen f8a9c59d50 Improve textclock property docs (#2926)
* Add format docs to the constructor.
* Add timezone docs to the property.
* Give the argument to set_refresh a name other than "How".
* Fix bug in constructor argument "format" rendering.
2019-11-25 16:35:41 -05:00
James Reed 1e71d9afbd
Update taglist more aggressively 2019-11-20 10:52:55 -07:00
Emmanuel Lepage Vallee ee331a4eff keygrabber: Remove the hardcoded way to add keybindings.
There is now a real API for this.
2019-11-09 16:43:53 -05:00
Emmanuel Lepage Vallee 10fd4e8883 object: Try harder to auto-undeprecate the keys and buttons.
Having the new object layout will be important soon when the
append/remove methods start to get added to the client and the
reborn `awful.keyboard` module.
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee e3959b45d5 awful.button: Keep track of the `awful.button` in the `capi.button`. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 42a906f300 capi.button: Enable the miss handlers. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee fe603f7dc5 capi.key: Enable the miss handlers. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 35a4b4edbf object: Allow old `gears.table.join` accessors to be set to `false`.
This worked before, so it has to work again.

Fixes #2915
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 45823f230a capi: Move from `.data` to `._private` for the property data.
This will bring the CAPI classes closer to the gears.object ones.

Fixes #2897
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 50eb7d5599 Revert "legacy: Temporary workaround for #2897. (#2898)"
This reverts commit e888d983ef.
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 025262fd95 doc: Use the new doc convention.
The previous few commits are very old, bring them to the new
standards without all the merging conflicts (which are error prone).
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 02486b3479 awful.key: Add a has_root_binding property and :trigger() method 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 4f7388dd17 awful.button: Add a has_root_binding property and :trigger() method 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 93b90026e9 root: Add a `has_key` and `has_button` functions. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 86d8ef3142 awful.button: Turn into an object. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 21ae9c1edb awful.key: Turn into an object. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 4501f0e768 Allow to add and remove keys and buttons.
Another step in moving these APIs toward the common object oriented and
declarative paradigms used by other APIs.

This commit introduces the `awful.keyboard` module. It currenly only
exists as a placeholder for the first few append/remove function, but
will grow in scope in another pull request to expose the currently
private modifier APIs and to provide keybindings collision detection
and replace some of `awful.hotkey_popup` business logic.

The `keygrabber` tests which uses root keybindings are disabled for
now to keep the commit size small. This is necessary since the shims
will need many iterations of changes before this work again with the
new syntax.
2019-11-09 16:42:06 -05:00
Emmanuel Lepage Vallee 4dbc83fa7d doc: Modify the template to allow merging sections.
It might not be the most pretty of change, but it works. With this
change, it is possible to have multiple "things" in the "same"
section having the "same" name.

This allows for C/C++ style functions with the same name but different
signatures. Lua doesn't handle this well, so it should usually be
avoided. However, constructors might be a valid exception. Most older
widget (and object) constructors have multiple random argument while
newer one use `args`. Deprecating the old ones for the sake of
standardization might be a bit too much for users upgrading from v3.5.

Given the only reason all of those deprecation would happen is because
"its pretty that way", then lets allow 2 constructors and avoid outrage.
2019-11-03 01:28:29 -05:00
Xinhao Yuan 8beb0286ea Fix: toggling the `maximized` state properly when a client requests to unmaximize.
The fix focuses on ewmh.merge_maximization function, which handles client intentions to change maximization states.
The fix includes:

  1. Fixing the `get_value` helper function to return the proper resulting state that client wanted to change.
     For example, when `c.maximized and not c.maximized_horizontal and not c.maximized_vertical` holds,
     the client would observe the `MAXIMIZED_VERT` and `MAXIMIZED_HORZ` atoms in X11, but get_value would compute
     the result values based on `c.maximized_{horizontal,vertical}`, which are all false. The fix makes the computation
     consistent to clients' view.

  2. Interpret a client's maximization intentions based on the client's view of how the X11 atoms changes.
2019-10-16 18:23:18 -04:00
mergify[bot] 344964a44a
Merge pull request #2529 from actionless/hotkeys-popup-dont-show-empty-groups
fix(awful: hotkeys_popup): don't show group label if group itself is empty
2019-10-12 22:14:48 +00:00
mergify[bot] bafe028a05
Merge pull request #2905 from psychon/imagebox_raw_pointers
imagebox:set_widget(): Handle userdata again
2019-10-11 16:50:57 +00:00
Uli Schlachter 08e230b1b3 imagebox:set_widget(): Handle userdata again
This function is not documented to handle userdata, but historically it
would just pass all arguments to gears.surface.load(), which interpreted
userdata as cairo surfaces. After 3295e9f33d, userdata
objects are restricted.

Accept userdata objects again by explicitly passing them to
gears.surface.load().

Fixes: https://github.com/awesomeWM/awesome/issues/2903
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-10-11 16:14:57 +02:00
actionless beb54c7d5f fix(awful: hotkeys_popup): don't show group label if group itself is empty
1) factor out grouplabel-related logic into _create_group_columns() method
2) check the number of keys in group before calling that method
2019-10-11 15:31:57 +02:00
Jordan Christiansen 580883add3 Add documentation about textclock format 2019-10-10 22:33:53 -05:00
Emmanuel Lepage Vallée e888d983ef
legacy: Temporary workaround for #2897. (#2898)
The `:keys()` and `:buttons()` APIs moved from get/set single methods
to properties. It works fine if you use the new or old API, but has
limitations when mixing them. `awful.rules` calls properties in a loop
after checking if it is a function. Thus it triggers the secondary
codepath to try to handle this case.

This codepath was tested with gears.objects based components
(ie. widgets). It was not tested with clients and tags, and it
didn't work because they use `awful.tag.getproperty` and
`awful.client.property.get` instead of `._private` like all
newer components. Those old functions are officially deprecated,
but used by tons of configs and modules ported from v3.5 and thus
still the default way to access Lua properties in our implementation.

This commit adds a `_private` to anything that doesn't have one to
at least make the error stop. It will "mostly" work until a more
complete solution is added. Reverting the 2 PRs that changed this
would delay getting more feedbacks.
2019-10-09 13:35:05 -04:00
streetturtle 1b79dec685
Fix typo and wrong property name in popup docs
Fix typo: maxmimum -> maximum and fix wrong name of the property.
2019-10-07 21:45:41 -04:00
Emmanuel Lepage Vallee 2c08c2fa39 quality: Port all legacy `:buttons()` to `.buttons`. 2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee ab1e62a332 Remove the instances of :buttons(awful.button()).
Having buttons without an awful.util.table.join/gears.table.join
has never been officially documented to be supported. I hope there
isn't too many of those and they wont try to mix the new and old
API syntax, because that will totally break.
2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee cf0385af80 widget: Add an `:add_button()` method.
This is done now because a lot of code in `lib/` add buttons by manually
extracting buttons from awful.button. Instead of adding ugly code to
prevent using the legacy API, do this.
2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 57f38f4824 layoutbox: Deprecate the old constructor 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 82db9180b1 widget: Mutualize all set_widget implementation to behave the same
Now always call both check_widget and make_widget_from_value. This
should make it a lot less confusing when randomly trying to create
a widget as all ways to do it slowly converge toward an unified
one.
2019-10-05 22:57:04 -04:00
Emmanuel Lepage Vallee 349b75994f titlebar/wibox: Support widget definition in set_widget.
So now it is mostly identical to `:setup()` beside some legacy
difference in how the get_children_by_id is implemented.
2019-10-05 22:57:04 -04:00
Emmanuel Lepage Vallee 249f11ec82 drawable: Add property getter/setter support.
Just like the wibox and the other APIs
2019-10-05 22:57:04 -04:00
Emmanuel Lepage Vallee cbb90d8bd1 root: Turn `root.keys()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 296ad18922 client: Move the `c:keys()` method to a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee f747438879 layoutbox: Modernize the constructor.
Another step in the long running project to unify all constructors
design.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 29e804a4f8 drawin: Turn `:buttons()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 3d918258e2 widget: Turn `:buttons()` into a normal property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 3230a41450 root: Turn root.button() into a property.
This is the first commit of a series to turn all function based
accessors into object properties. This will bring consistency
across the codebase.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 78c3496770 object: Add support for the legacy accessors as r/w methods.
Many legacy Awesome APIs such as `client:tags()`, `root.buttons()`,
`client:keys()`, `drawin:geometry()`, etc used functions for both the getter
and setter. This contrast with just about everything else that came after
it and is an artifact of an earlier time before we had "good" Lua object
support.

Because both consistency and backward compatibility are important, this
table wrapper allows to support both the legacy method based accessors
and key/value based accessors.

It isn't part of the public API, has a sledgehammer function prototype
and is intended for internal use only.

It's ugly, but backward compatibility is more important than anything
else.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 141aca2432 root.buttons: Move to Lua.
This is the groundwork commit to support using `awful.button` objects in
`root.buttons`.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee b1c81c4258 awful: Set a miss handler for capi.root
There is no better place to put it and need to always be required
for backward compatibility. Given Awesome no longer works properly
without `awful`, I put the code there.
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallee 0cb22fd203 awful: Move the backward compatibility code into its own file.
The reason for this is that as more of CAPI is brought in line with the
current API guidelines, it is more and more likely the tests will hit
APIs shims (either to test them or because the prototype remains the
same and only the implementation moved to Lua).
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallee 4cab9f8c38 widget: Return `nil` in case of failure.
Instead of an assert. If there is a "real" error, then a warning is
still printed, but otherwise this relax the requirements.
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallee 96c4d001f1 doc: Remove capi.button/capi.key from the official doc.
`awful.button` is always the one used and it's confusing.
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallée ffe7c4d1cc Apply suggestions from code review
Thanks to @Aire-one for those fixes!

Co-Authored-By: Aire-One <Aire-One@users.noreply.github.com>
2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee c2a2c789e6 doc: Add example sequences for the tags. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee bcceab439a doc: Add a missing `args.` in naughty notifications constructor.
It was rendering `widget_template` as a second parameter while it is
in fact an argument.
2019-10-01 02:03:12 -04:00
Emmanuel Lepage Vallee cb88776980 screen: Add diagonal size (in inches and millimeters).
The use case for this will be to detech which screen is connected to
an output from the screen rules.

It is in millimeters because this is what the output provides and in
inches because the DPI is based on that unit and screens are sold with
the size in inches on the box.
2019-09-30 00:49:40 -04:00
Emmanuel Lepage Vallee 93799e8be3 dpi: Better filter the viewports.
Identical viewports are already handled before getting into Lua,
but sometime xrandr gives another viewport that encompass all
others. It has to be removed.
2019-09-30 00:49:40 -04:00
Emmanuel Lepage Vallee aa76b11b81 screen: Move the "added" signal from CAPI to Lua.
When the screens are created from the viewport in Lua, the signal is
sent too early and the DPI and outputs have not yet been added. This
cause the `connect_for_each_screen` callbacks to be called with a
partially initialized screen object. It also causes the drawables to be
repainted too early.

CAPI now emits "_added" and "awful.screen" takes care of emitting
"added".
2019-09-30 00:49:39 -04:00
Emmanuel Lepage Vallee 3e19251d14 screen: Set the managed flag when creating screens in awful.screen. 2019-09-30 00:49:17 -04:00
Emmanuel Lepage Vallee cd6998b18d screen: Delay the request::wallpaper and desktop_decoration for the DPI.
With this, there is plenty of palces where the DPI can be set before
those signals are sent. This allows wallpaper with the proper DPI to
work with screens created using `fake_add`. In turn, this will allow
screen rules to control the DPI. In "the past", the DPI used for those
handler was the native DPI of the screen with no opportunity to change
it before hand.
2019-09-30 00:48:09 -04:00
Emmanuel Lepage Vallee 1e1cd549c6 screen: Add a `:split()` method.
This is easier than messing with the `fake_resize()` method. This will
eventually have an awful.screen.rules equivalent to auto-split the
screen from the rules.
2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee b0f18bce52 screen: Allow `outputs` to be changed.
This moves the handling of the `outputs` property away from C and into
Lua. It will allow the use of `screen.fake_add` to have outputs.
2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee 51e3d66110 screen: Fix enough issue when all screens are removed to pass a test.
This doesn't mean removing all screens is supported. It isn't and never
will be. The only reason this commit exist is to allow some
initialization and error handling code to be tested.
2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee 852ff9c340 screen: Add a fallback code path when --screen manual is used.
If there is no handler, then the fallback will create the screens.
2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee 433898599d init: Add a command line option to start AwesomeWM without screens.
This commit add an optional `--screen off` command to initialize Lua
without first adding the screens. This is inconvinient for most users
since it restrict the APIs that are usable out of the box.

However, this allows AwesomeWM to work independently from the hardware.
This means that when a screen is unplugged, it is the Lua code that will
remove the screen instead of CAPI pulling the carpet from under. It also
allows to ignore some screen areas before the screen is ever created.
Combined, it makes it possible to work with screens even when they are
physically disconnected. Finally, it will allow for an awful.rules like
API to control how screens are created.

All in all, some people need this for their setup and some people might
want to do it anyway for fine grained and/or dynamaic multi-screen
setups.

This commit also adds 4 new signals to `capi` to be able to
execute code at specific points during the initialization. The commit
improves naughty error notifications to work even if problems occurs
before the screens are added.

Note that AwesomeWM will exit if no screens are created. While it would
be easy to just call `refresh_screen();` after unsetting the magic
variable, doing so would have corner cases. Better be harsher and
prevent the user from shooting themselves in the foot from not reading
the f****** manual. Code introduced in future commits will take care
of automatically calling fake_screen in the event nothing is created.

Fixes #1382
2019-09-29 18:52:00 -04:00
Emmanuel Lepage Vallee 9920fdd3f1 gears.table: Add a new way to merge 2 tables.
This function allows to update the content of a table using the
content of a second table. It helps to keep the original reference
and to know what has been added and removed.
2019-09-29 18:20:15 -04:00
Emmanuel Lepage Vallee dcdbc679f7 doc: Add a file to ldoc blacklist before addint it.
Add `dpi.lua` to config.ld even if it isn't added yet. This is
because the way the test run has it cached in the build dir. A full
rebuild would take too long and timeout on travis for semi-large PRs.
2019-09-29 18:19:45 -04:00
laith-m0 e1169e864d propmpt: Rename `args.hook` to `args.hook` for consistency. 2019-09-29 17:09:01 -04:00
mergify[bot] aa7c7c80ee
Merge pull request #2881 from psychon/dead_code
Remove some dead code
2019-09-23 16:40:19 +00:00
Uli Schlachter 1adeef18a2 Fix some typos (#2880)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-09-23 18:39:12 +02:00
Uli Schlachter fb151c3340 Remove some dead code in notification:reset_timeout()
This code is inside an "if new_timeout and [something else]". Thus, it
only executes when new_timeout is "truthy". Thus, "new_timeout or
[whatever]" will always evaluate to "new_timeout".

This commit removes that tiny bit of dead code.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-09-21 13:43:35 +02:00
Daniel Hahler dc98eade3b
naughty: fix extra newline with only title/message (#2870)
* tests/test-naughty-legacy.lua: s/counter/added_counter

* naughty: fix extra newline with only title/message

With only title or message it should not have an extra newline.

Fixes: https://github.com/awesomeWM/awesome/commit/423aeebe8#commitcomment-35062951
2019-09-19 02:11:18 +02:00
Emmanuel Lepage Vallee f60abed1d0 gears.geometry: Add a function to compare 2 rectangles.
The next step will be to find all the places where this is duplicated.
2019-09-04 13:11:47 -04:00
Emmanuel Lepage Vallee 602d6ded07 doc: Add some images to represent the various area of a screen. 2019-08-19 01:48:00 -04:00
Emmanuel Lepage Vallée b2ebf899d7
doc: Fix a broken reference. (#2850) 2019-08-12 00:31:41 -07:00
Emmanuel Lepage Vallée 1e59fc7fd2
Merge pull request #2828 from Elv13/matcher_v2
Improve `gears.matcher` to be more flexible.
2019-08-11 22:29:35 -07:00
Emmanuel Lepage Vallée ed0918385c
Merge pull request #2825 from Elv13/yet_more_notif_fixes
Support the notification spec v1.2
2019-08-10 12:47:09 -07:00
Emmanuel Lepage Vallee f3dc57f3f4 layoutlist: Add more caching.
Technically this doesn't solve any memory leak, but AwesomeWM uses in
average less memory when changing the selected tab in quick succession.

This is because it has less "temporary" tables to track.
2019-08-07 04:27:56 -04:00
Emmanuel Lepage Vallee d832b8c9b8 layoutlist: Use weak tables to store the cache. 2019-08-07 03:21:17 -04:00
Emmanuel Lepage Vallée c4c97174e6
doc: Fix a rendering regression regarding backgrounds. (#2820)
The way background are rendered changed to accomodate issues regarding
cliping and border. However this broke the documentation examples.

This commit fixes this in the least hacky way I found.

Fixes #2727
2019-08-06 22:48:06 -07:00
Emmanuel Lepage Vallee 67e5dd3091 matcher: Match all sources when none is provided.
Nobody wants to set this parameter. It is necessary because the old
API allowed `awful.rules` to be used with random for random matching.

This stopped "really" working between the 3.4 and 3.5 release because
the code started to accumulate "corner case" fixes aligned with the
client properties. v4.0 added more ordering and v4.3 added external
sources. After this, it is unusable with external objects, but
`gears.matcher` handle this use case very well.
2019-08-06 02:20:01 -04:00
Emmanuel Lepage Vallee 91ca922671 tests: Test the gears.matcher greater and lesser sections. 2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee 64bef57013 matcher: Add a `greater` and `lesser` matching sections.
In a perfect world we would have pure expression matching, but
that's problematic with all the "metaness" of the code. For now,
this adds an imperfect way to match the minimum and maximum of
number properties.

It will be used by the screen rules for the DPI and size properties.
2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee b40083780e matcher: Add a "every" and "every_any" sections to the rules.
So far the "any" rules had a "OR" and "NOT" logic "gates", but not
an "AND".
2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee 3e4f292906 matcher: Fix the doc.
It was developed in parallel to the new doc format and wasn't updated.
2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee 801ae69f23 matcher: Add a custom setter for "fake" object properties.
This is hardcoded in `awful.rules`, but cannot be shared due to the
priority corner cases. Given in the long run any "standard" priority
should use the topological sort API, better not try to share *that*
code.
2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee 9a16ee62e6 matcher: Add a way to match properties beside == and patterns.
It is useful for objects and avoid the mess that it Lua == overload.

The primary use case will be to match tags by name or object.
2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee f3f9e4a4b5 matcher: Allow rules to be addressed using an identifier. 2019-08-03 18:26:06 -04:00
Emmanuel Lepage Vallee 886f8ea4e3 matcher: Use gears.object.
This way there's some signals. It can be useful if the module using the
matcher needs to act when something happens.
2019-08-03 18:26:05 -04:00
Emmanuel Lepage Vallee d8b53dac5d matcher: Add methods to add new rules.
It is now possible to add and remove rules. This is superior to how
`awful.rules` originally handled rules because modules can now
assume adding and removing rules works.

The reason for the methods rather than `table.insert` is partially
because future commits will add signals. In turn, this will allow
`gears.matcher` to be extended by module using it using the extra
"introspection" made possible by the signals.
2019-08-03 18:26:01 -04:00
Emmanuel Lepage Vallee dcd034dcac naughty: Add 2 levels of fallback when the `widget_template` fails.
* First, it will try the default widget template
 * If that fails, the `request::fallback` handler will use the legacy
   popup.

Ref #2829
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee c0ef0c8802 tests: Expose the previously private gears.protect_call error handlers.
This will allow the test suits to intercept them instead of adding more
and more exceptions to `run.sh`.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 423aeebe8a naughty: Add more default values.
Without this, some variables could accidently be set to `nil` by the
dbus code. Ignore now also has a default.

Ref #2829
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 30b42905da notification: Fix a typo in the closed_reason API name.
It wasn't part of a release and nobody uses that anyway.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 1bd2c1977e notification: Add an `append_actions` method.
The name is self explanatory, it adds more actions to a notification.

One of the use case is adding a snooze/reming_me action. Another one
is "mute similar notifications".
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee e524f93baa notification.action: Allow actions to be shared by multiple notification
The reason is that if actions are provided by rules, only one instance
exist. It was a mistake to couple actions with their notifications. It
could not work reliably and has to be removed.

The commit also change the notification action storage to be a copy
instead of the original table. This allows to append actions (not part
of this commit) without risking adding them to the wrong notification.

**WARNING** This break an unreleased API by removing the `notification`
property of an action.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee f8cbb54913 naughty: Expose 3 previously internal properties.
* app_name: To be used in filters when no clients are found.
 * max_width: Allow to set it from the rules, it might be different
    when a `widget_template` is used.
 * widget_template: Now it can be set from the rules without further
    boilerplate code.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee e77ca1f4d8 naughty.widget.legacy: Use values from the notification objects.
Previously it used the `args` table passed to the constructor.
This will not work with rules since they modify the object, not the
args.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 78c616c358 notification: Allow nil to be set to the timeout to rmeove it 2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 84ae41422f notification: Prevent the timer to be started early in the constructor.
Otherwise the timer will be started before the preset is applied.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee c36d35756f naughty: Begin to deprecate the presets.
The old preset code had a primitive implementation of the rule API
used in `naughty.dbus`. Now that `gears.matcher` is extracted from
`awful.rules`, it is possible to share the code.

The first step is to only enable the old API when the new
`request::preset` isn't connected. This is the same way the legacy
popup is only enabled when nothing is connected to `request::display`.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 41149ed335 class: Share the module level signal system implementation.
Avoid adding another copy.
2019-08-03 01:45:22 -04:00