Commit Graph

150 Commits

Author SHA1 Message Date
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
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
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
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 8072d717cf Fix extra newline with legacy naughty layout
Fixes 9df77e5c76 (commitcomment-32354198).
2019-02-18 08:34:59 +01: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
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
Emmanuel Lepage Vallee 29cef2d615 notification: Add a new destroyed reason for "lack of space".
they were previously silently dismissed.
2019-02-16 15:26:38 -05:00
Emmanuel Lepage Vallee c691a0842b notification: Prevent Lua errors from causing unlimited timer events.
It now runs user defined code, so it can happen. Extra safety is
required.
2019-02-16 15:26:38 -05:00
Emmanuel Lepage Vallee 9df77e5c76 naughty: Move the notification object into its own file.
Mostly for the documentation, but also as the new base upon which
to build the modular notification GUI.
2019-02-16 15:25:10 -05:00
Emmanuel Lepage Vallee 14eab7890f naughty: Add signal support 2019-02-16 14:08:45 -05:00
Emmanuel Lepage Vallee 3e70e87796 Revert "dbus: fix nil notifications (#2180)"
This reverts commit 7519c6966a.
2019-02-16 14:08:45 -05:00
Emmanuel Lepage Vallee 74ef4dd8b7 Revert "naughty: Fix replaces_id + changing colors (#2041)"
This reverts commit 4e42996d9a.
2019-02-16 14:08:45 -05:00
Emmanuel Lepage Vallee a2f314c349 Revert "Add support for resizing notification icon with respect to aspect (#2176)"
This reverts commit 584c5cedb1.
2019-02-16 14:08:45 -05:00
Emmanuel Lepage Vallee 0703156155 Revert "naughty: add notification max width and height (#2232)"
This reverts commit 5e6f534365.
2019-02-16 14:08:45 -05:00
Emmanuel Lepage Vallee 898db88443 Revert "fix(naughty: core): don't attempt to upscale small icons (#2283)"
This reverts commit b77ffa86e0.
2019-02-16 14:08:45 -05:00
gabriel klawitter 7519c6966a dbus: fix nil notifications (#2180)
When mangling notifications via naughty.config.notify_callback it is
advised (1) to return nil to reject a notification. The underlaying dbus
library tries to access a field of that notification table and fails.

(1) https://awesomewm.org/doc/api/libraries/naughty.html
2018-10-07 16:09:12 +02:00
Uli Schlachter 3301e9b0ff naughty.dbus: Duplicate surface data
When an icon is sent over dbus, we turn this into a cairo ImageSurface.
This is done by turning the actual icon data into a string and using
cairo.ImageSurface.create_for_data() to create a surface for this data.
However, this function only creates an ImageSurface that refers to this
data. It does not copy the data. Thus, when the Lua GC later frees the
string, we have a cairo surface that refers to already-freed data.

Fix this by duplicating the cairo surface, which makes cairo create a
copy of the data. Then, we finish the original surface. While doing
this, the string is kept alive in a local variable.

(Possibly) Fixes: https://github.com/awesomeWM/awesome/issues/2361
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-19 20:49:03 +02:00
Yauhen Kirylau b77ffa86e0 fix(naughty: core): don't attempt to upscale small icons (#2283) 2018-06-12 21:57:14 -04:00
Alphonse Mariya 5e6f534365 naughty: add notification max width and height (#2232) 2018-04-02 22:12:15 +02:00
Alexander Melnyk 584c5cedb1 Add support for resizing notification icon with respect to aspect (#2176)
* Add support for resizing notification icon with respect to aspect

Previously, if an icon was not exactly square, an icon size set in configuration
would cause the notification to pad the icon with empty space so dimensions are
equal.

Now behaviour is different: the bigger dimension of the icon is scaled to fit
the icon_size value, while smaller is scaled same amount to preserve aspect.

Also, ImageSurface is now not created as fixed size square, but it's dimensions
are computed in similar way.

* Round the computed dimensions of ImageSurface

Even one pixel off is still off.
2018-02-06 11:01:40 -05:00
Uli Schlachter 4e42996d9a naughty: Fix replaces_id + changing colors (#2041)
This fixes a regression introduced in be29ee6768. This commit changed
naughty to reuse an already-existing wibox when replaces_id is used,
instead of creating a new wibox. However, some of the properties that
are set only when creating a wibox were ignored due to this.

Fixes: https://github.com/awesomeWM/awesome/issues/2040
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-09-30 21:37:33 +02:00
Tomoya Tabuchi 0836cf90c5 Add notification_icon_size as a beautiful variable (#1951) 2017-07-29 15:58:52 +02:00
morethanoneanimal cbb8fd7ac4 Add naughty.destroy_all_notifications (#1871)
Also updates connect_signal in naughty lib to use destroy_all_notifications().
2017-06-29 00:11:07 +02:00
Tim Roes 3d1b2c2a5e Pass freedesktop hints to naughty.notify (#1875) 2017-06-26 21:21:09 +02:00
Emmanuel Lepage Vallee 0829cc2d76 notification: Fix `font` and use `beautiful` directly
Using `beautiful.get()` has the drawback of not supporting theme
variables set from `rc.lua`. It is also used less often than
direct theme access, making it a bit inconsistent with how other
modules behave.
2017-06-19 19:52:00 -04:00
Benoit de Chezelles be29ee6768 naughty: avoid notification flickering on replace (#1785)
Fixes https://github.com/awesomeWM/awesome/issues/1737.
2017-05-23 15:37:46 +02:00
Thomas G 5e431d2fb1 Update notification size in `naughty.replace_text` (#1756)
Fixes #1707
2017-05-07 18:01:35 +02:00
Tim Roes 993ffef666 Add the ignore_suspend flag to naughty (#1729)
Possible use-case could be a do-not-disturb mode where notifications
should be suspended, but some notifications triggered directly by
a user interaction (e.g. change of keyboard layout, etc.) should
still be shown.

Fixes: https://github.com/awesomeWM/awesome/issues/1728
2017-04-20 22:31:17 +02:00
paul-axe d3e113f997 naughty: fix offset calculation for *_middle position (#1727) 2017-04-15 22:08:35 +02:00
Kevin Zander 45dadde0dd Move filesystem functions out of awful.util into new gears.filesystem
Update awful.util filesystem function calls to gears.filesystem function calls
Rename getdir to get_dir for consistency
2017-03-15 13:46:33 -05:00
Kevin Zander c3461b535c gears: Move awful.util.table to gears.table (#1641)
* Move table functions out of awful.util into new gears.table

* travis: Use v9999 prefix for full requests

Make sure no newly deprecated functions are used

* Move all `awful.util.table.*` calls to `gears.table.*` calls
Move table test functions from awful/util_spec to new gears/table_spec
Change awful.util.subsets call to gears.math.subsets in awful/key.lua
2017-03-08 15:18:33 -05:00
Emmanuel Lepage Vallée 2b88c92d52 Merge pull request #1604 from Lawful-Lazy/master
Add naughty presets `ok`, `warn` and `info`.
2017-03-04 22:14:35 -05:00
Kevin Zander 3f6df8ddee Fix Luacheck 0.19.0 release Travis breaks 2017-03-03 16:41:12 -06:00
Samuel Hunter 97287596e2 Add naughty presets `ok`, `warn` and `info`. 2017-02-25 13:20:53 -08:00
Emmanuel Lepage Vallée 77c92d0d63 Merge pull request #1536 from jmccrohan/naughty_icon_urldecode
naughty: urldecode icon URI file
2017-02-12 20:25:09 -05:00
actionless 09a678345c feat(naughty: core): add shape configuration; expose options to beautiful 2017-02-12 22:37:31 +01:00
Jonathan McCrohan 12e5998698 naughty: urldecode icon URI file
file:// URIs should be urlencoded; decode URIs where required.

Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
2017-02-08 01:15:36 +00:00
Daniel Hahler dd339fd62a naughty: mouse: only react on release events
Fixes https://github.com/awesomeWM/awesome/issues/1445.
2017-01-27 17:35:50 +01:00
Uli Schlachter 259c4f716f Remove @release @AWESOME_VERSION@ everywhere (#1157)
It does not provide much value. The version number is already known to
ldoc globally in the "description" variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-09 22:36:20 +02:00
Emmanuel Lepage Vallee d85588babe wibox: Create a container module
Previously, the "containers" were placed in layout or widget.

They all have similar APIs and usage, so lets bring them together.
2016-05-30 17:51:19 -04:00
Jajauma 4d7e8c804e naughty: change action markup to emphasize clickability
This commit changes the markup applied to the action description text to
emphasize the fact that the action zone is actually clickable. Bold is
replaced with underline, the Unicode 261B symbol (right pointer) is
added as well.
2016-05-15 18:46:09 +03:00
Jajauma b1dbbb0041 naughty: display the client-supplied localized action description in UI
According to the Desktop Notification specification document [1] the
clients supply actions available along with a notification in a form of
a list of pairs where first element is an identifier of an action and
the second is a localized message that will be displayed to the user.

Up to now the naughty code directly used the action identifier text as a
part of the notification layout exposed to the user. This commit makes
use of a localized action description for that purpose.

1) https://developer.gnome.org/notification-spec/
2016-05-15 18:43:25 +03:00
Uli Schlachter 5b9509d612 naughty: Delete a screen's notification on removal
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 15:01:06 +02:00
Uli Schlachter 76266abcfa naughty: Print notification content in "no screen" warning
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-17 15:21:02 +02:00
Emmanuel Lepage Vallee 8a0738a4bc gears.screen: Merge into awful.screen
gears modules usually don't depend on Awesome C-API. This code has
been placed there for unclear reasons.

Also, there is ongoing work to unify each "concepts" API into one
single page. Having `gears.screen` go against this effort.
2016-04-06 23:32:44 -04:00
Daniel Hahler c85bbeafdb naughty.notify: handle non-existing screen, print a warning
Ref: https://github.com/awesomeWM/awesome/issues/796
2016-04-05 00:31:45 +02:00
Uli Schlachter 3f40183177 naughty: Use connect_for_each_screen()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-27 10:51:28 +02:00
Uli Schlachter 95e5bdf5d2 Use the new way to iterate over screens in Lua
This gets us one step closer to removing screen indices.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-06 14:05:28 +01:00
Uli Schlachter d56b5c031b Remove some now unnecessary uses of s.index
Because all our Lua code can now work with screen objects, most of the uses of
s.index that the previous patches added for reaching this goal can be removed
again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 09:24:19 +01:00
Uli Schlachter 8de29856b8 naughty: Support screen objects
This commit makes naughty accept a screen object everywhere where a screen index
is accepted.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-26 18:30:42 +01:00
Uli Schlachter a4e598d444 Fix naughty.reset_timeout
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:40 +01:00
Uli Schlachter 2c77f9dcf8 Fix luacheck warnings in lib/naughty
A warning pointing out an actual problem is left.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:16:42 +01:00
Uli Schlachter e7a8df2920 naughty: Follow textbox API change
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 16:51:07 +01:00
Uli Schlachter 62495daa66 Merge branch 'naughty-version' of https://github.com/psychon/awesome 2016-01-17 16:01:18 +01:00
Uli Schlachter 1367968824 naughty: Don't try to parse our version number
The code here doesn't always work, so it's best to just don't mess with
awesome.version, but return it directly.

Fixes: https://github.com/awesomeWM/awesome/issues/569
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 20:12:19 +01:00
Uli Schlachter 9d97a98b4d naughty: Remove dead code
Since some commits, surface.load_uncached() handles errors itself and thus we
don't have to print an error message here any more.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:53:09 +01:00
Uli Schlachter 4577e32a38 naughty: Use :get_height_for_width()
This changes the code in naughty so that it first decides on a width for the
notification and then uses the new function :get_height_for_width() to find a
suitable height.

This makes a difference in the following example where before this change the
text is cut off and afterwards it is shown completely:

  naughty.notify({
      text = string.rep("abcdefghijklmnopqrstuvwxyz\n", 4),
      width = 75
  })

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-17 19:13:26 +02:00
Uli Schlachter fcfed22d8a Remove hacks for querying a textbox' size
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-17 19:13:26 +02:00
Daniel Hahler 4bffa7e47e doc: fix unintentional rendering as code due to indent 2015-10-14 00:22:26 +02:00
Daniel Hahler f7f8420d24 naughty.notify: improve doc for args.run
Closes https://github.com/awesomeWM/awesome/pull/469.
2015-09-23 20:56:17 +02:00
actionless f2e554de91 fix(lib: naughty: core): make it work with textbox per-screen dpi
Closes https://github.com/awesomeWM/awesome/pull/464.
2015-09-22 08:56:25 +02:00
Uli Schlachter 1ebc34b5e9 Widgets: Also add a context argument to :fit()
Together with the context argument to :draw(), this even allows widgets to have
DPI-dependant size.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 11:19:48 +02:00
Daniel Hahler 5c78cf07fc naughty: use beautiful.xresources.apply_dpi for margin and border 2015-08-01 17:47:43 +02:00
Daniel Hahler 904b7a88ee doc: overhaul naughty documentation 2015-07-27 15:54:47 +02:00
Daniel Hahler f7e7d05047 doc: naughty: config.mapping moved to dbus.config.mapping 2015-07-27 15:32:11 +02:00
Daniel Hahler efe5358a0b naughty.notify: default to screen.focused() 2015-07-27 14:35:46 +02:00
Daniel Hahler 62f5e59497 naughty: skip permanent notifications when there is no more room
This skips permanent notifications (with timeout=0) in `get_offset` when
there is not enough room for a new notification.  It will still fallback
to removing the first/oldest one.

Closes https://github.com/awesomeWM/awesome/pull/306.
2015-07-22 14:02:25 +02:00
Julian Wollrath 6cc7be512c Remove the *.in from all files.
Signed-off-b: Julian Wollrath <jwollrath@web.de>
2015-06-19 22:33:32 +02:00
jaysonwillson 3fe663fc60 Fix interactive notifications: use uint32 instead of int32
Fixes https://github.com/awesomeWM/awesome/issues/259.
Closes https://github.com/awesomeWM/awesome/pull/261.
2015-06-15 02:23:57 +02:00
Alex Kir 82e62a0fad Added function to check state of notifications
Sometimes is a good idea to check if notifications are suspended,
for example, for changing the icon. This function just returns the value
of suspended.

Closes https://github.com/awesomeWM/awesome/pull/222.
2015-05-21 20:19:41 +02:00
Anatol Pomozov 3b146b834c Use table.unpack() with Lua5.2 instead of deprecated unpack() 2015-05-12 10:23:27 -07:00
taptap 5b81a0db60 Add reset_timer and replace_text functions
Enables users to replace text and reset expiration timeouts of existing
notifications, which is necessary for OSD creation by means of naughty.

Signed-off-by: taptap <alexey.e.egorov@gmail.com>
2015-02-28 23:54:02 +01:00
Julian Wollrath ca89f0f311 Use LDoc commands to mark parameters as optional in the docs.
Signed-off-by: Julian Wollrath <jwollrath@web.de>
2015-02-28 23:14:15 +01:00
Julian Wollrath b16944a654 Fix generation of the docs.
Signed-off-by: Julian Wollrath <jwollrath@web.de>
2015-02-28 23:14:13 +01:00
Julian Wollrath 939dab8ba9 Some more doc fixes all over the place.
Signed-off-by: Julian Wollrath <jwollrath@web.de>
2015-02-28 23:14:13 +01:00
Ignas Anikevicius (gns_ank) b96b3ef31c Docs: Move all docs to a `docs` folder.
This moves all of the documentation into a separate folder, which keeps
everything in one place and avoids unnecessary clutter.

This will pay off when proper guides are written for various aspects of
using awesome or contributing to it.

This also updates the building system, so that the docs are properly
generated with new directories.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
2015-02-28 23:14:12 +01:00
Ignas Anikevicius (gns_ank) 6ab86b5d03 Docs: Add local functions to beautiful and naughty
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
2015-02-28 23:14:12 +01:00
Ignas Anikevicius (gns_ank) 4b94f05799 Docs: Naughty - mostly done
Reorganise the config table, so that we have a single table and the
fields are nested.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
2015-02-28 23:14:12 +01:00
Ignas Anikevicius (gns_ank) ed0bf91122 Docs: Work on naughty
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
2015-02-28 23:14:12 +01:00
Ignas Anikevicius (gns_ank) f726dcee61 Fix LDoc errors on generating the documentation.
This also at the same time ports the documentation to the new `Markdown`
format.
2015-02-28 23:14:11 +01:00
Kenton 517d6049c8 added middle anchors for naughty notifications
top_middle and bottom_middle can be used as position arguments for new naughty.notifications
2015-02-21 17:37:30 -05:00
Daniel Hahler 516dd91027 Re-apply naughty: Fix builds without dbus (d5088c5)
This got lost in 355f106 (naughty: Split up into core and dbus).
2015-02-06 23:08:07 +01:00
Uli Schlachter 26ffd2c6f2 naughty.dbus: Fix the CloseNotification method
It was broken when naughty was split up.

Thanks to trollixx for reporting this on IRC.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-10 21:06:30 +01:00
Uli Schlachter 6afb5f28a2 naughty.dbus: Make this actually work
Apparently I still had an old naughty.lua laying around in build/lib and thus
this new code wasn't actually tested. It's a miracle that it works so well
besides this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-10 20:27:26 +01:00
Uli Schlachter 223a8c8742 naughty.dbus: Factor out a helper function
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-10 18:57:38 +01:00
Uli Schlachter 355f10609c naughty: Split up into core and dbus
No changes in functionality intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-10 18:44:30 +01:00