Commit Graph

3316 Commits

Author SHA1 Message Date
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
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
Sorky 4831a46590 Add get_random_file_from_dir to gears.filesystem
Ref #2596
2019-02-16 13:58:24 -05:00
Uli Schlachter 8fdc89ff09 Add and use gears.timer.run_delayed_calls_now()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-15 17:04:19 +01:00