Commit Graph

3827 Commits

Author SHA1 Message Date
Ari Breitkreuz 138e37576d Add note that prompt_args will override defaults 2020-04-22 13:05:19 +02:00
Ari Breitkreuz 30911a3959 Rename v to entry in add_entry loop 2020-04-22 13:02:46 +02:00
Ari Breitkreuz ec5ec642c3 Add match_empty option to menubar 2020-04-22 13:02:41 +02:00
actionless f803347fc8 fixup! fix(gears: matcher: default_matcher): handle sidecase of string.match-ing the empty string ('')
style: return true/false instead of assigning nil to result
2020-04-22 01:52:41 +02:00
actionless 90aacbc5b5 fix(gears: matcher: default_matcher): handle sidecase of string.match-ing the empty string ('') 2020-04-21 19:51:11 +02:00
Ari Breitkreuz 788d8fec33 Don't force defaults in menubar 2020-04-21 16:45:40 +02:00
Hugo Trassoudaine feb699aa3c
Add doc fields for extra tasklist client property notification icon theming in lib/awful/widget/tasklist.lua
Signed-off-by: Hugo Trassoudaine <hugo.trsd@gmail.com>
2020-04-06 14:20:35 +02:00
Gerome Matilla 158cc37a0d
Apply placement margins on awful.tooltip (#3053)
Co-authored-by: Gerome Matilla <gerome.matilla@gmail.com>
2020-04-01 02:13:58 -07:00
hung 33f99fea1c Remove double blank line 2020-03-28 21:13:53 +07:00
hung 7f7793378e Use cr:save and cr:restore instead 2020-03-28 20:43:07 +07:00
hung 4eff88679c new shape: star 2020-03-28 20:21:39 +07:00
Seth Barberee 6e7d235c5a add additional match for firefox 2020-03-21 09:27:07 -05:00
mergify[bot] 5d1394b91d
Merge pull request #3041 from SethBarberee/tag_gap_doc
[Doc] add example for master_count in awful.tag
2020-03-20 12:46:16 +00:00
Seth Barberee 6d24dc2ab7 add example for master_count 2020-03-20 01:00:53 -05:00
Seth Barberee 5c7574bce8 convert hotkeys_popup to awful.popup instead of wibox 2020-03-19 10:51:51 -05:00
Emmanuel Lepage Vallée 2da1cb9ba0
Merge pull request #3040 from Elv13/notif_icons_v3
[RFC] Redesign how notification icons are handled.
2020-03-18 21:35:29 -07:00
Emmanuel Lepage Vallee 9601cf4a89 naughty: Plug to the permission system.
This allows to control which kind of icon actions can be done
on individual notifications. Once the second part of the permission
system will be merged, this will mostly be used in `ruled.notification`.
2020-03-16 04:46:51 -04:00
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
Emmanuel Lepage Vallee c10312b511 naughty: Fix a race condition which cause startup errors to be missed.
This commit will be "reverted" when the screen refactoring is merged
since it has a better fix.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee efbc707279 naughty: Move the boilerplate rc.lua error handling to naughty.
This removes the imperative "mutex" logic from rc.lua, where it doesn't
belong. It also makes it closer to the "vision" of making `rc.lua` fully
modular.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 047245fd03 notification: Add a default urgency value. 2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 2ff4a5294c naughty.widget.icon: Use `surface.load_silently`.
Icons can be names from the icon theme. This wont load until a better
icon theme API is added (since this module doesn't depend on menubar).
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee e076bc664e naughty: Bump the SPEC version compliance to v1.2.
* action icons
 * persistence
 * residence
 * categories
 * animated icons
 * more ways to get icons

In addition, the commit also tries its best to attach notifications to
objects using various dubious semi compliant hints or the DBus PID. It
works often enough to be useful.
2019-08-03 01:45:22 -04:00
Emmanuel Lepage Vallee 620241e056 doc: Fix the type of naughty.notification.id.
Copy/paste error.
2019-08-03 01:45:22 -04:00
mergify[bot] 88e51faa87
Merge pull request #2833 from DorianGray/patch-1
awful.tooltip:show() - swap timer.started and timer_function call
2019-08-02 15:01:02 +00:00
Sergey Vlasov 29f1719026 awful.titlebar: Fix GC for titlebar widgets (#2830)
Some titlebar widgets (`awful.titlebar.widget.titlewidget`,
`awful.titlebar.widget.button` and other specific button widgets) could
not be garbage collected until the associated client was unmanaged,
because the signal connection used to update the widget was never
destroyed, and the signal handling function was keeping a reference to
the widget in its environment.  This resulted in high memory usage when
the titlebar widgets were recreated multiple times for the same client
(this does not happen with the default Awesome configuration, but may be
needed for dynamic titlebar reconfiguration in a custom config).

Modify the code to use weak tables instead of direct signal connections
to avoid keeping strong references to widgets.  The widget update
functions still keep strong references to the widget itself (creating a
reference loop, but the Lua GC should handle it correctly) and the
client object, but this should not be a problem.

One publicly visible change is that `awful.titlebar.widget.titlewidget`
now has an `update` function, like the button widgets.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-22 11:12:16 +03:00
Robert Andrew Ditthardt 0b58cf9941
awful.tooltip:show() - swap timer.started and timer_function call
This is needed because if async code is run inside of a tooltip timer func the started property may not still be false.
The current version causes random spurious timer already started errors.
2019-07-21 19:07:33 -04:00
Emmanuel Lepage Vallee bec4de5fab naughty: Auto-reset the timeout when notifications are modified.
This is configurable globally or per-notification. When it is
replaced over dbus, it has a new timeout and *that* should be the
new timeout (starting when the notification is replaced).

Closes #2821
2019-07-11 01:01:38 -04:00
Emmanuel Lepage Vallee 11ef560c5c naughty: Un-document naughty.notification.replaces_id.
It doesn't and cannot exists within `naughty.notification()` since it is
a constructor and that's way too late.

Ref #2816
2019-07-11 00:06:24 -04:00
Emmanuel Lepage Vallée f3ee880bd8
Merge pull request #2816 from Elv13/more_notif_fix
Fix 4 "new API" notification bugs
2019-07-10 17:27:27 -04:00
Emmanuel Lepage Vallée 0ac0a77aab
Merge pull request #2811 from sigprof/no_overlap-unselected-tags-v2
awful.placement: Fix no_overlap with unselected tags
2019-07-10 17:20:27 -04:00
Emmanuel Lepage Vallée c89c18c989
mouse: Do not display the snap helpers when a client isn;t floating. (#2818)
It is still enabled for floating clients or when the floating layout is
used.

Fixes #2813
2019-07-10 17:16:41 -04:00
Emmanuel Lepage Vallée b795671817
doc: Fix invalid HTML (#2817)
Fix #2812
2019-07-09 17:42:01 -04:00
Emmanuel Lepage Vallee 7fb6883cac notifications: Send more signals when changing an action.
If the action own `notification` object changes, also emit the signal
on the old one.
2019-07-09 02:31:18 -04:00
Emmanuel Lepage Vallee 12f1908ef8 notification: Make the position index more robust.
If the notification screen or position changed, it would end up in the
wrong index and removing it would fail. This cannot happen anymore.
2019-07-09 02:31:18 -04:00
Emmanuel Lepage Vallee 4df8120acb notification: Set the ID earlier.
Otherwise the signals were sent and the widgets created before the ID
was set. This makes some attempt at detecting updated notifications
error prone.
2019-07-09 01:25:00 -04:00
Emmanuel Lepage Vallee a91e2e7378 notification: Fix typos in signal names.
Updating notifications would not work because, among other things,
the signals names had a typo (all of them...).
2019-07-09 01:23:11 -04:00
Emmanuel Lepage Vallee aabbb412fe naughty.action: Fix icon_only.
It could not be specified in the contructor.

Fix #2815
2019-07-07 16:07:37 -04:00
Vishnunarayan K I def76356c4 doc updates for naughty 2019-07-07 12:32:03 +05:30
Sergey Vlasov 93c4f369cf awful.placement: Fix no_overlap with unselected tags (#2809)
The awful.placement.no_overlap function always looked at the currently
visible clients when placing a new client.  This produced a confusing
result when using awful.rules or the sn_rules argument of awful.spawn to
place the client on an unselected tag (the client was placed as if it
would be placed on a currently selected tag; if multiple clients were
placed on the same unselected tag, in many cases they were placed at the
same position, overlapping each other).

Make awful.placement.no_overlap check tags of the placed client and
handle the case of placement on an unselected tag in a more useful way:

  - If the client is sticky or at least one of the client tags is
    selected, keep the previous behavior: avoid overlap with all other
    floating clients which are currently visible, and use the currently
    active layout to determine the floating status.

    An explicit check based on `c:tags()` is made instead of using
    `c:isvisible()`, so that the previous behavior is kept even if the
    client is hidden or minimized for some reason.

  - If all client tags are unselected, avoid overlap with all other
    floating clients which either are sticky or share at least one tag
    with the placed client, and use the layout of the first tag of the
    placed client to determine the floating status.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Uli Schlachter ccaa75f4b4 Make shapes more robust w.r.t pre-existing paths (#2806)
A call to cairo_close_path() adds a straight line to the beginning of
the current sub-path. This is used in some of the shapes to, well, close
the shapes.

Sub-paths can be created explicitly via cairo_new_sub_path(), but also
implicitly via cairo_move_to(). When a new sub-path is started, there is
no current point on the path. This means that e.g. cairo_line_to() is in
this start equivalent to cairo_move_to() (= no line is created) and that
cairo_curve_to() first does a cairo_move_to() to the beginning of the
curve. Similarly, cairo_arc() and cairo_arc_negative() first do a
line_to() to the beginning of the arc, and this line_to() can be
implicitly turned into a curve_to().

The problem with the code in gears.shape is that parts of the code
(implicitly) assume that there is not yet any path when the shape
function is called.  If this assumption is broken, the call to
close_path() could go to the wrong point, because the path did not start
at the expected position.

Most of the functions in gears.shape already implicitly start a new
sub-path via a call to cairo_move_to(). Those that do not (necessarily)
begin with a call to cairo_move_to() are handled in this commit: They
get an explicit call to cairo_new_sub_path().

This change fixes the issue reported at
https://github.com/awesomeWM/awesome/pull/2804, because the shapes will
no longer be influenced by the pre-existing path. The move_to() that was
left around and caused that issue turns into a degenerate part (it only
has a move_to(), so nothing can be drawn) and is then discarded by
cairo.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-07-03 16:56:08 -04:00
Uli Schlachter d4cb8dc8b3 wibox.hierarchy:draw: Clear paths after .draw (#2805)
Cairo's save/restore methods handle all properties except for the
current path. The path is just left as-is.

A widget's draw method could create some path without consuming it. This
path would then interfere with random things later which did not expect
a path to already exist.

This commits adds calls to cairo_new_path() in the relevant positions to
clean things up.

This not only applies to a widget's draw method, but also
{before,after}_draw_{child,children}. However, these methods could (for
whatever reason) create paths that are to be consumed in one of the
other methods. To keep this working, the path is only cleared after all
of these methods ran.

I do not expect this commit to break anything, because a widget cannot
really assume much about what widget is drawn after it. Especially so,
because partial redraws could mean that some later widget is skipped and
not redrawn.

This should fix the issue reported at
https://github.com/awesomeWM/awesome/pull/2804.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-07-03 16:55:38 -04:00
Emmanuel Lepage Vallée 0857a8fef8
Merge pull request #2800 from psychon/fix_negative_sizes
Fix negative sizes with the margin container
2019-06-21 17:30:59 -04:00
worron 3295e9f33d imagebox: Better svg support (#2779)
Use rsvg api to render svg image at requested size.
2019-06-21 17:30:10 -04:00
Uli Schlachter a4dadde335 Fix wibox.hierarchy's empty_clip()
This function checks if a given cairo context has an empty clip. It was
written with the assumption that cairo_clip_extents() produces the x, y,
width, height of the clip extents. However, that function actually
produces x1, y1, x2, y2, where (x1, y1) and (x2, y2) are the corners of
the rectangles.

Due to the way the function is written, it will return non-zero numbers
when there is a translation (cr:translate()). Thus, this function worked
basically never.

Fix this by checking if both points have the same X- or Y-coordinate.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-06-19 18:23:08 +02:00
Uli Schlachter 2aa198a57b wibox.widget.base.place_widget_*: Protect against negative sizes
This commits adds assertions to catch negative width or height.

Would-have-helped-with: https://github.com/awesomeWM/awesome/issues/2799
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-06-19 18:20:09 +02:00
Uli Schlachter f025409cd3 wibox.container.margin: Do not produce negative sizes
With draw_empty=false, :fit() can return 0,0. Then, when :layout() is
called, it will compute negative widths and heights. This can then cause
lots of problems later on.

Avoid this by having :layout() return nothing instead of producing
negative sizes.

Fixes: https://github.com/awesomeWM/awesome/issues/2799
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-06-19 18:18:06 +02:00
worron 99e81c097a imagebox: apply shape before scale (#2793) 2019-06-12 19:39:00 -04:00
Emmanuel Lepage Vallee 1b4d667b67 doc: Update to the newer doc conventions. 2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 90396f33e7 doc: Tag the callback properties as deprecated.
They exists to comply with the old `naughty.notify` API. They should not
be used for new code.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 5261165be4 doc: Add many more examples to naughty.notification
Also document the `test` property as deprecated. It exists because the
older API (`naughty.notify`) had it. It exists on purpose in the
rewrite, it cannot just be removed even if it was never in a release.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee c47402d002 doc: Add an image for the position of naughty.layout.legacy 2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 9a7a313719 naughty: Destroy the notification when an action is executed.
Whoops, I changed the name of the method at some point and never
updated this instance. It was also not clausing the notification
like people expect.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 4aaf6ea730 naughty: Only enable the legacy mode when there is no other handlers.
It was called legacy for a reason, it is meant to be used only when the
rc.lua doesn't have the newer notification section.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee d956b5411b naughty: Initialize the action `notification` property 2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 4be58fb298 naughty: Add an `icon_only` property to the action object. 2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee fded165e41 doc: Document how to select different shapes based on the content. 2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 9acc452b1e naughty: Set an action table even if the notification has none.
Less `if` in the code.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 7bf1a276ef naughty: Use cleaner code to update the legacy actions.
The old code surprisingly worked, but reading this again, better
make some changes.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 44e9ecdd30 naughty: Add an awful.widget.common based "notification list"
This layout allows to place a list of notifications in a wibar or popup.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee d8d80ec69a naughty: Add the `awful.popup` based notification `box`
It replaces the legacy box popup.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 6e50ee2a41 naughty: Add a shared default widget_template for the notifications.
This will be shared by the notifications stored in a wibox/wibar and the
ones using a popup. It extends the constraint and margins container
to take care of some boilerplate code. While other widgets have their
own public API, those 2 are private since they are not different enough
to warrent a new public module.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 5b5a25a57c naughty: Add a background widget.
There is some boilerplate code that make using the widget_template
harder when using the raw `wibox.container.background`. This widget
takes care of it.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee cf364a7b35 naughty: Add a `message` widget.
It tracks the notification message.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee f31afd8cb7 naughty: Add an icon widget.
This tracks the notification icon and add some resize strategies.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 3592d33b6c naughty: Add a title widget.
It is a normal textbox with some extra boilerplate code. Having this
in a separate widget allows the notification to be defined from rc.lua
without a ton of beautiful options and connect_signal.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 916b49bde0 naughty: Add an actionlist widget.
This widget allows to use the actions without all the boilerplate
code associated with managing a list.
2019-06-08 18:56:08 -04:00
Emmanuel Lepage Vallee 90a29f92eb doc: Fix all the property, theme and field types. 2019-06-08 18:14:14 -04:00
Emmanuel Lepage Vallee b4ece0f053 doc: Use an explicit tag for all static functions.
This way their name doesn't get mangle by the broken magic. It will also
eventually allow to `error()` in the template when the implicit
`@function` is used.

This commit also fixes a large number of issues found while
proof-reading everything.
2019-06-08 18:14:13 -04:00
Emmanuel Lepage Vallee 11d7a614d9 doc: Add a constructor stereotype for everything.
This forces the constructor functions to be at the top of the API
documentation rather than in a random position.
2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee 63ca0f0d8f doc: Use an explicit @method stereotype for all methods.
ldoc has a magical `@classmod` module type which tries to detect
what is a method and what is a static function. It fails about as
often as it works. This commit makes everything explicit to remove
such issues.

Fixes #2640
Ref #1373
2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee cdeafeff94 doc: Add a section for theme related libraries 2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee ded35502d5 doc: Add a section for utility libraries
Dedicated for the modules extensions developers will need, but that the
general "I only edit rc.lua" user wont.
2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee f1dceb02f6 doc: Move all popups to a section. 2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee 9d0c2200b2 doc: Add a section for the important classes.
The choice is very subjective, but at least they stand out.
2019-06-08 18:13:28 -04:00
Emmanuel Lepage Vallee 7b00d76673 doc: Move all layouts to a new section. 2019-06-08 17:49:14 -04:00
Emmanuel Lepage Vallee bb51add089 doc: Move all widgets to a new section. 2019-06-08 17:49:14 -04:00
Emmanuel Lepage Vallee e9d4164851 doc: Move all containers to a new section. 2019-06-08 17:49:14 -04:00
Michael Beaumont 9e2a544ba3 naughty: Add position "middle" to center notifications in screen (#2775)
Signed-off-by: Michael Beaumont <mjboamail@gmail.com>
2019-06-08 16:10:14 -04:00
worron 5fef354892 Fix instance existing check for application spawn (#2774)
User defined matcher now has higher priority while checking
existing instance for application spawn.
2019-06-08 16:09:37 -04:00
fREW Schmidt 900cca54a4 Correct name of functions in taglist (#2783) 2019-06-08 16:09:02 -04:00
fREW Schmidt 099f17ca8c Fix name of max layout in docs (#2781) 2019-06-08 16:08:30 -04:00
fREW Schmidt 021bf689d7 Replace doubled immobilized with correct properties for each immobilized (#2770) 2019-05-25 06:17:26 -04:00
Emmanuel Lepage Vallée f03d5474cb
keygrabber: Fix the key sequence recording. (#2758)
The origial implementation was broken and nobody noticed until now.

Fix #2757
2019-04-24 20:15:39 -04:00
Hùng 755c44ca52 Slider new feature `bar_active_color` and examples
- Fill slider bar with a linear pattern based on current value (if `bar_active_color` and `bar_color` are correctly provided)
- Add examples for the apidoc
2019-04-23 23:13:32 -04:00
zsugabubus c9a6f6f994 keygrabber: Fix optional "release" handling (#2756)
Even thought `awful.key` handles optional "release" parameter well,
parameters are also get used before passing them. In case (only)
optional "data" is provided, it faulty gets called on a release event.
2019-04-23 23:12:03 -04:00
Emmanuel Lepage Vallee 93c6222da4 screen: Add two new requests.
* Add a request to handle the wallpaper when a screen is added or
   resized.
 * Add a request for screen decorations such as bars or gizmos when
   a screen is added.

Both are also sent when a new handler is connected.
2019-04-15 15:26:50 -04:00
Emmanuel Lepage Vallée df0cdbed61
Merge pull request #2600 from Elv13/extract_rules
Extract the awful.rules logic into a gears module
2019-04-15 13:28:48 -04:00
Emmanuel Lepage Vallée 63e7c68b6c
Fix the broken test due to the "soft" merge conflict of two notification pull requests. (#2751)
* naughty.legacy: Fix a regression caused by a prior fix.

The title was only set "later" because it was called too early.

The intended result was to prevent the code from being executed when
there is no leagcy popup, but it had this side effect.

* naughty.dbus: Expose the new "private" methods so they can be tested.

Because it now uses Gio instead of capi.dbus, it isn't possible to
just shim the backend anymore.

* shims: Upgrade the dbus shims to also emulate some Gio behavior.

As usual, it is the most basic version that produces the correct
result. It doesn't try to comply to the real API.
2019-04-15 13:07:53 -04:00
Uli Schlachter 9085ed6312 awful.remote: Protect against error(nil) (#2748)
Fixes: https://github.com/awesomeWM/awesome/issues/2747
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-04-14 12:34:52 -04:00
Emmanuel Lepage Vallée dc1f87ef84
Merge pull request #2738 from Elv13/doc_tests_and_notif_p5_1
Split the reviewed groundwork commits from the notification widgets pull request
2019-04-13 12:57:58 -04:00
Emmanuel Lepage Vallée 9163eef01c
Merge pull request #2722 from psychon/dbus-gio-naughty
naughty.dbus: Switch to using Gio for DBus bindings
2019-04-13 12:57:14 -04:00
Emmanuel Lepage Vallée 4440c5c1d5
keygrabber: Allow multiple instances to be created during the same loop. (#2741)
Due to a facepalm caliber mistake, the wrong self was being used...

Fixes #2712
2019-04-07 19:09:49 -04:00
Emmanuel Lepage Vallee dce1830b89 naughty: Fix a rebase mistake when using actions.
Some older revisions called it `trigger` instead of `invoke`.
Apparently some rebase conflicts introduced the old name in
merged code.

See #2729
2019-04-05 22:20:16 -04:00
Emmanuel Lepage Vallee 1a5685ee45 naughty: Require `naughty.action` by default.
Fixes #2730
2019-04-05 22:16:44 -04:00
Emmanuel Lepage Vallee 5c57f43643 tasklist: Use awful.widget.clienticon by default.
This allows sharper icons to be used.

Fixes #2143
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee a081413339 tasklist: Auto-call set_client on all template widgets
This commit also update one of the example to remove its now
redundant boilerplate code.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee aa6ab69ffc taglist: Auto-call set_tag on each widgets of the template.
This reduced the boilerplate code.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee e452ec8e27 awful.widget: Use private `args` for the update_function.
Previously, it would use the "real" args passed to the constructor.

It was a bad decision since:

 * It doesn't allow the tag/tasklist to add properties internally
 * It forces the widget to be created with a constructor rather than
   the alternate declarative syntax
 * It doesn't allow a tag/tasklist to be part of a widget_template

Technically this is a behavior change, but I doubt anybody will notice
given it is a dark and little documented corner of the API. Chances are
nobody have been using this API for years.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee d5a2fe0072 awful.widget: Add an helper to set a property on all template widgets
With this helper, it becomes possible to avoid manually setting common
properties such as the client in the tasklist of tag in the taglist when
the children widgets of the template have a set_+property_name.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee e79a5c5988 awful.widget: Add a `create_callback` to the common list.
This is like its template equivalent, but "private" to the list
widget.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee db2d4b92df awful.widget: Add support for icon_size.
This decision was taken out of necessity. While adding more style
elements to `awful.widget.common` isn't something I want, there is
little else to do here. The problem is that popup based lists only
have size constraints in one direction. So without a way to limit
the icon size, it will take 9999 pixels.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 97417121ad naughty: Add a property to get all active notifications. 2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee d99f8461ef naughty.legacy: Do not update the text if the notification has no widget
If the notification has been created without a legacy widget, it would
try to update some widgets that have never been created.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 7adbbd3f7c awful.common: When a border is set, shrink the widget by its size. 2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 8ac1f67237 container.margins: Allow the `margins` property to be a table.
It makes some code easier to write. It is mostly useful when the margins
are exposed through another widget. In that case it avoids having to
proxy 5 different property or re-invent the wheel there.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee c1596f0b4e background: Deprecate `shape_border_(width|color)`.
In favor of `border_width` and `border_color`.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee eb1c45b656 background: Update all users so they don't use the deprecated name.
This is done before deprecating the API so no commit ever use the
deprecated name.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 81ff4d730c background: Always allow a border.
Previously, the border "support" was limited to shapes and would not
move the content by the offset of the border. Borders are now better
supported and thus renamed from `shape_border_width` to `border_width.

In the end, shrinking the widget by the border size is too common to
ignore. It should have been the default all along, just like the clip.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 02ed7ceed5 widget.base: Allow widgets constructor in the declarative template.
This avoids the boilerplate of having to do:

    {
        widget = awful.widget.mywidget
    }

in the templates.
2019-04-05 21:06:11 -04:00
Emmanuel Lepage Vallee 80cb6f299e doc: Fix an awful.autofocus warning 2019-04-05 20:40:53 -04:00
Emmanuel Lepage Vallee 0b4bb05b45 rules: Add a new documentation section for how to write a rule 2019-04-05 20:40:53 -04:00
Emmanuel Lepage Vallee 91bea445d2 awful.rules: Use gears.matcher
Extract the code so it can be reused without pulling too many internal
APIs with it.
2019-04-05 20:40:53 -04:00
Emmanuel Lepage Vallee 74c2e7382e gears: Extract the logic code from awful.rules into gears.matcher.
The use case for this is to reuse the matching logic for other objects
such as tags or notification.
2019-04-05 20:40:53 -04:00
Uli Schlachter f84e72d0d5 awful.widget.common: Use a template for the default template
Instead of having the default template hardcoded as code, this turns the
template into a descriptive version. This makes it easier to come up
with own templates: Just copy the default template and make a slight
change to it.

No functional changes are intended, but I cannot rule out that I did no
mistakes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-03-28 18:51:13 +01:00
Uli Schlachter c2f29b04ee naughty.dbus: Fix inline icon data handling
LGI truncates GVariant bytestring instances at the first embedded \0
byte when using .value for "unwrapping". This commit works around that
problem by avoiding the .value API for accessing the image data [0].

Thanks a lot to Will Dietz for finding this problem and for providing a
preliminary patch fixing the problem. That saved me a lot of time [1].

[0]: https://github.com/pavouk/lgi/pull/223
[1]: eecdeb7d46

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-03-22 18:08:24 +01:00
Will Dietz 9af1ed9a0f dbus.lua: don't include types, it's magical enough to not need them
(and so we were including "s" capabilities)
2019-03-18 21:16:54 +01:00
Uli Schlachter 047ef30d59 naughty.dbus: Switch to using Gio for DBus bindings
This starts the switch from our own, semi-broken DBus bindings to using
the sane bindings that Gio provides.

Part-of: https://github.com/awesomeWM/awesome/issues/1093
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-03-18 21:16:54 +01:00
Will Dietz ed0c3ceb2c don't replace 'destroy' in existing notification, set destroy_cb (#2728)
The value passed as `args.destroy` becomes `destroy_cb`,
so use that name when updating an existing notification.

Fixes #2721.
Might also resolve #2692.
2019-03-18 14:03:14 -04:00
mergify[bot] d8687dc251
Merge pull request #2724 from necauqua/patch-2
Add forgotten nil-check to `notification.reset_timeout`
2019-03-13 22:01:02 +00:00
Adrian Gabriel 0642d92967 Fixed input_passthrough property not being set (#2723)
* Fixed input_passthrough property not being set

In the table of properties supplied to the `wibox` function, you couldn't set the `input_passthrough` property. You could only set it after the wibox was created like this: `my_shlick_wibox.input_passthrough = true`. This commit fixes that and now you can set it in both ways.
2019-03-12 17:23:53 +01:00
Anton Bulakh 8493fd1829
Add forgotten nil-check to `notification.reset_timeout`
When you call `reset_timeout` on a notification with 0 timeout and thus no timer, a nil field error occures.
(can be tested with `awesome-client 'require"naughty".notification{message="TEST",timeout=0}:reset_timeout()'`)
Everywhere else in similar places (even at the beginning of the `reset_timeout`) the `self.timer` field is checked so i guess it was just forgotten there.
2019-03-11 20:45:31 +02:00
mergify[bot] 05b4735911
Merge pull request #2719 from Elv13/make_next_to_pos_optional
placement: Handle when the preferred position choice isn't set.
2019-03-06 18:45:05 +00:00
Emmanuel Lepage Vallee 29d89c5e8a placement: Handle when the preferred position isn't set.
This removes a FIXME from the code.
2019-03-04 15:52:39 -05:00
Emmanuel Lepage Vallée f7c20b38f1
Merge pull request #2715 from Elv13/notif_replace_id2
Fix 4 issues related to the notification refactoring
2019-03-03 16:43:09 -05:00
Emmanuel Lepage Vallee b0cf594de5 naughty: Set a default reason in `:destroy()`.
Fix #2713
2019-03-03 16:24:17 -05:00
Emmanuel Lepage Vallee 4930978424 naighty: Fix to use the same object using `naugthy.notify{replace_id}`
Fix #2678
2019-03-03 16:24:17 -05:00
mergify[bot] 3ff795b4fc
Merge pull request #2716 from psychon/once_optional_rules
awful.spawn: Make rules optional in once / single_instance
2019-03-03 21:20:10 +00:00
Uli Schlachter 244932749b awful.spawn: Make rules optional in once / single_instance
There is not much good reason why this should be required and making it
optional is almost trivial, as this patch shows.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-03-03 08:52:31 +01:00
Uli Schlachter 731e4736e5 Do not recommend io.popen()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-27 10:26:16 +01:00
Emmanuel Lepage Vallée f049046332
Merge pull request #2696 from alfunx/naughty-legacy-resize-on-update
naughty: Resize notification when setting text
2019-02-24 15:12:35 -05:00
Alphonse Mariya 494474ba0a
naughty: Resize notification when setting text 2019-02-23 18:54:39 +01:00
Emmanuel Lepage Vallee 347d87418b naughty: Always have an id.
Fixes #2678
2019-02-22 11:47:46 -05:00
Daniel Hahler 36d7535cd5
Minor: typos, Makefile aesthetics (#2690)
* lib/awful/mouse/resize.lua: s/extendable/extensible

* Fix code comment typo: s/find/found

* Makefile: remove -n with echo

Missed in e9b5e28d1.
2019-02-22 08:42:43 +01:00
mergify[bot] 3cc364cef4
Merge pull request #2673 from alfunx/recolor-toggle_state
beatiful.theme_assets: recolor titlebar icons for `active` and `inactive` states
2019-02-19 23:05:25 +00:00
Alphonse Mariya 00d38b1a2d
beatiful.theme_assets: recolor titlebar icons for `active` and `inactive` states 2019-02-19 23:33:18 +01:00
Daniel Hahler 8072d717cf Fix extra newline with legacy naughty layout
Fixes 9df77e5c76 (commitcomment-32354198).
2019-02-18 08:34:59 +01:00
mergify[bot] 710278c4b9
Merge pull request #2654 from psychon/luajit-xpcall
gears.protected_call: Automatically detect xpcall features
2019-02-18 01:42:40 +00:00
mergify[bot] 8563895284
Merge pull request #2663 from psychon/rng_init
Initialise Lua's pseudo-RNG from C from a good source
2019-02-18 01:34:35 +00:00
mergify[bot] fd38e2fb5c
Merge pull request #2658 from psychon/delayed_call_run_now
Add and use gears.timer.run_delayed_calls_now()
2019-02-17 19:25:04 +00:00
Emmanuel Lepage Vallée dd3c270819
Print a warning when trying to destroy the same notification multiple time. (#2662)
* notification: Print a warning when destroying more than once.

* doc: Fix a copy paste issue.
2019-02-17 12:36:02 -05:00
Uli Schlachter 3a4bf103b3 Initialise Lua's pseudo-RNG from C from a good source
GLib has an internal pseudo-RNG that it initialises from /dev/urandom.
This commit adds code that uses this RNG to initialise various random
number generators that can be used by Lua.

This also removes some Lua code that initialises the random number
generator badly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 10:17:47 +01:00
Emmanuel Lepage Vallee 7c96a98a0d naughty: Correctly update the content of the legacy popup 2019-02-16 15:49:39 -05:00
Emmanuel Lepage Vallee d859f671a1 naughty: Add hicolor to the default icon path.
Ref #2533
2019-02-16 15:49:39 -05:00
Emmanuel Lepage Vallee 66b39aee35 doc: Add a link to the base naughty documentation. 2019-02-16 15:49:39 -05:00
Emmanuel Lepage Vallee e13b9a48ff naughty: Use same object when the remote source request a replacement
Previously, it would create a new object. The leaves the old
`replaces_id` logic mostly intact for now to keep the full backward
compatibility. I don't think anybody would have noticed the changed, by
time and time again we had proof that some silent users have some
amazing and advanced code hidden somewhere. It could be cleaned later
when breaking compatibility isn't an issue.
2019-02-16 15:49:39 -05:00
Emmanuel Lepage Vallee 1b567cc06a notification: Rename text to message
There is many "text" and the default text is the title, not the body.
2019-02-16 15:26:38 -05:00
Emmanuel Lepage Vallee faa553e47c notification: Allow to pause automatic expiration.
When the mouse is over or a keyboard driven menu is open, avoid
unexpected expiration to mess with the current notifications.

This commit also improve the `suspended` behavior to correctly
emit some signals.
2019-02-16 15:26:38 -05:00
Emmanuel Lepage Vallee 6d5d016a2a naughty: Turn actions into object.
The current API is non-compliant with the 1.0 spec and cannot represent
the v1.2 spec at all. The pair of name and callback fails to represent
the explicit ordering and cannot support the icons cleanly.

Plus to support the keyboard navigation use case, the notification
action need to be able to get some sort of focus state. Having an
object makes this easy.
2019-02-16 15:26:38 -05:00
Emmanuel Lepage Vallee e70822a6a4 naughty: Make sure the icon cannot be bigger then the box.
Without this change, parts of the icon were hidden.
2019-02-16 15:26:38 -05:00
Emmanuel Lepage Vallee bfda6f64bb naughty: Display the notification with invalid icons.
They previously caused an error.
2019-02-16 15:26:38 -05:00