Commit Graph

9820 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 b9d19988b9 rc.lua: Replace the error handling code with request::display_error.
It is easier to understand, shorter and more modular.
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
Uli Schlachter 6101ef5186 Add libRSVG to the list of optional dependencies (#2837)
Since commit 3295e9f33d, the imagebox tries to use libRSVG via
lgi.Rsvg to load SVG files without rasterising them immediately.
Instead, they are directly drawn at the expected size.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-07-28 17:23:44 -04:00
mergify[bot] b475c23fd3
Merge pull request #2834 from sigprof/titlebar-widget-gc
Fix GC for titlebar widgets
2019-07-24 14:45:30 +00:00
Sergey Vlasov f08599a6d6 test-leak-client.lua: Test GC for titlebar widgets (#2830)
Add a test which recreates the titlebar for an existing client and
checks that widgets from the old titlebar instance can be GC'd.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-22 17:35:18 +03: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 Vallée 1116bc47d0
Merge pull request #2823 from Elv13/another_row_of_notification_fixes
naughty: Undocument naughty.notification.replaces_id.
2019-07-12 16:00:20 -04:00
Emmanuel Lepage Vallée 07f2c3270f
Merge pull request #2819 from Elv13/no_space_in_doc
Change the URL in the doc again to avoid spaces
2019-07-11 19:45:18 -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 b34cc6b896 doc: Fix autogenerated table links.
Update for the new URL scheme.
2019-07-09 17:17:58 -04:00
Emmanuel Lepage Vallee bd5e557a60 doc: Fix links in the "AwesomeWM widget system" page.
The URLs just changed again.
2019-07-09 17:00:48 -04:00
Emmanuel Lepage Vallee 8038f8124e doc: Do not mix spaces and tabs for indentation in the generated HTML. 2019-07-09 17:00:20 -04:00
Emmanuel Lepage Vallee 7cba838067 doc: Prevent ldoc from generating URLs with spaces.
For dubious reasons, ldoc uses the human readable name for the URLs
instead of the machine readable one. If the name has multiple words,
this causes the URLs to have spaces or %20 in them.

This commits remove all spaces from the "kinds" and then use `:gsub()`
in the template to convert underscores to spaces.

**WARNING** This breaks all URLs again. But this is necessary to prevent
broken links when the user paste them with spaces instead of %20.
2019-07-09 16:28:42 -04:00
mergify[bot] 0e07a34ad6
Merge pull request #2814 from vn-ki/doc-updates
doc updates for naughty
2019-07-09 16:09:37 +00: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 51e823832c test-awful-placement: Test no_overlap with unselected tags (#2809)
Test the behavior of awful.placement.no_overlap when placing clients on
unselected tags.  Currently this tests only the most common case with
only a single selected tag and a single tag set for each client.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:43:30 +03:00
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
Sergey Vlasov c48d2e5a70 test-awful-placement: s/window/client/g
Use the "client" term consistently instead of using "client" in code and
"window" in comments.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Sergey Vlasov ec8edaf9d5 test-awful-placement: Test no_overlap with sticky clients
Clients which are sticky should be taken into account by
awful.placement.no_overlap even if they seem to be on a different tag;
add a test to verify this behavior.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Sergey Vlasov b6c7e6751a test-awful-placement: Test no_overlap with hidden and minimized clients
Clients which are hidden or minimized should be ignored by
awful.placement.no_overlap; add a test to verify this behavior.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Sergey Vlasov 1c27f9d227 test-awful-placement: Reindent after the previous change
Only whitespace changes and reformatting of comments.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:15 +03:00
Sergey Vlasov 9e894d8fdd test-awful-placement: Make the test repeatable
In order to test the behavior of awful.placement.no_overlap with
unselected tags, the test sequence must be able to run multiple times.
Fix the test code to make this possible (currently it just performs the
same sequence 3 times, the code to actually test the behavior with
different tags will be added later).

Indentation is unchanged to make the changes obvious in diff; the next
commit will contain formatting changes without anything else.

Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2019-07-04 16:42:05 +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
Uli Schlachter fe37eeb913 Fix index handling in a taglist example (#2810) 2019-07-03 16:54:42 -04:00
Emmanuel Lepage Vallée f459296747
doc: Fix index links. (#2803)
Fixes #2797
2019-06-28 09:34:32 -04:00
Emmanuel Lepage Vallée d699968475
doc: Fix the "Returns" section for @staticfct. (#2801)
It wasn't displayed. Another hack based on undocumented APIs, but
whatever, ldoc is dead.
2019-06-22 18:00:40 -04:00