Commit Graph

221 Commits

Author SHA1 Message Date
HumblePresent 030073fee7 Apply presets before registering notification 2021-11-26 13:22:58 -06:00
Emmanuel Lepage Vallee 9dcfde32e0 naughty: Never hold a strong reference to the notification in the box.
luajit was failing to GC the notification about 5% of the time. This
commit stores all widget notifications in a weak table and don't let
any lambda access the parent object notification object.

Each of those changes reduces the failure rate. There might still be
a couple in there, but the test passed 200x on my laptop with 100%
success rate.
2021-10-31 19:30:17 -07:00
Emmanuel Lepage Vallée 5f29d6d056
Update lib/naughty/notification.lua
Co-authored-by: Aire-One <aireone@aireone.xyz>
2021-10-14 20:51:31 -07:00
Emmanuel Lepage Vallee 0b075761e3 naughty: Fix the `ignore_suspend` property.
By fixing some suspend bugs a few weeks ago, I "regressed" this
a little. By that, I mean there were bugs in the suspend code
which caused `ignore_suspend` to work simply because suspend
globally failed rather than `ignore_suspend` being implemented
correctly.

Fix #3465
2021-10-14 14:03:39 -07:00
Emmanuel Lepage Vallee 9c22b029eb naughty.layout.box: Make sure discarded boxes don't come back to life.
Previously, when resuming a notification for which the popup was closed,
it would re-appear.
2021-10-05 13:00:14 -07:00
Emmanuel Lepage Vallee 3458c89040 naughty: Suspend existing notifications.
Previously, it would just suspend new notification, but do nothing
about the existing ones.
2021-10-05 13:00:14 -07:00
Emmanuel Lepage Vallee 075935fd37 naughty: Do not call `request::display` when suspended.
Fix #3396
2021-10-05 12:59:39 -07:00
Emmanuel Lepage Vallee 0d1e977917 naughty: Fix getting a notification by id.
There is more into that table than just screens. If `get_by_id` was
called with an invalid notification (or a "future" one in case of
suspended / do_not_disturb), it would explode.
2021-10-05 12:59:39 -07:00
Elyes HAOUAS f81723733c
lib/naughty/init.lua: Fix typo on "screen" (#3456)
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-05 12:13:33 -07:00
Emmanuel Lepage Vallee b038463e22 naughty.legacy: Handle broken configs betters.
If a config with naughty.layouts.box crashes at startup and the
fallback config uses naughty.layouts.legaxy, it is possible their
will be some lookup for an object which isn't tracked by the legacy
module.
2021-09-22 19:17:02 -07:00
Emmanuel Lepage Vallee bd8f2f936b naughty: Fix a memory leak related to suspended notifications. 2021-09-22 19:17:02 -07:00
Emmanuel Lepage Vallee e752943b98 notification: Correctly handle `screen` set in the presets.
It was setting directly to `_private`, which both didn't work
and caused a memory leak.

Fix #3428
2021-09-22 19:17:02 -07:00
Emmanuel Lepage Vallee 21a111d154 naughty: Allow to set the message from the presets again.
This was never really supported and is really not what the presets
were event meant to be used for. But it worked and `lain` used it.
2021-09-22 19:17:02 -07:00
Emmanuel Lepage Vallee 89c84caee4 naughty.legacy: Explicitly remove the screen.
Do not rely on the GC. It isn't reliable with Luajit.
2021-09-22 13:39:58 -07:00
Emmanuel Lepage Vallée c3a508a886
Merge pull request #3386 from Elv13/awful_wibar
Fix some wibar bugs, polish the API a bit and add some doc.
2021-09-19 13:05:11 -07:00
Emmanuel Lepage Vallee e27b908ca0 doc: Document the naughty.action "invoked" signal. 2021-09-16 17:25:46 -07:00
Emmanuel Lepage Vallee 17bd5fb036 naughty: Pass the notification object to the action "invoked" signal.
Fix #3384
2021-09-16 17:22:33 -07:00
Emmanuel Lepage Vallee 4b606fb3d7 notification: Fix rendering during early screen creation.
If the problem happens early enough, it was possible that the
screen arrway wasn't initialized yet. In that case, the notification
would fail to render.
2021-09-12 01:59:48 -07:00
Emmanuel Lepage Vallee 90c4c60d2a Add more @supermodule and @hidden 2021-04-02 19:24:07 +02:00
Emmanuel Lepage Vallée 50fa1b8679
naughty: Correctly notify the client when a notification is dismissed. (#3184)
Fix #3182

Co-authored-by: Uli Schlachter <psychon@znc.in>
2021-03-22 00:03:37 -07:00
Emmanuel Lepage Vallée 5cbc423938
notifications: Make `:reset_timer()` more intuitive. (#3175)
Previously it would only work if there already was a timeout to
avoid some infinite loops. Now it just delay the new timer to the
next loop.

Fix #3147
2020-09-27 23:34:14 -07:00
Emmanuel Lepage Vallee 0cbb7f59b0 naughty: Improve backward compatibility to protecting the constants.
If the user copy/pasted `naughty.config.*` into their config rather
than set values 1 by 1, we could no longer add new values since they
would get removed. To prevent more users being affected by this, we
now silently ignore the new table while still setting all the values.

Fix #3145
2020-09-14 02:11:32 -07:00
Yauhen Kirylau e7113d7191
fix(naughty: layout: box): take preset.padding and beautiful.notification_spacing into account (#3103) 2020-05-22 21:55:47 -07:00
actionless 124c6f9b23 fix(naughty: widget: _markup): correctly un-escape "&lt;span property=value&gt;" 2020-04-23 13:44:34 +02: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 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
Emmanuel Lepage Vallee 21cb4037bc naughty: Fix updating the icon of DBus notification when passed by path. 2020-03-08 19:44:16 -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 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
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 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 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
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 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 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