Commit Graph

3098 Commits

Author SHA1 Message Date
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
Uli Schlachter e50fa84f61 gears.protected_call: Automatically detect xpcall features
In Lua 5.1, xpcall() has exactly two arguments: The function to call and
the error handler. Everywhere else, xpcall() passes extra arguments on
to the function to call. This includes LuaJIT, however since LuaJIT sets
_VERSION to "Lua 5.1", so far gears.protected_call used the workaround
for Lua 5.1 here.

This commit switches gears.protected_call to actually test for this
feature instead of just guessing based on _VERSION. Thus, this now also
uses the better code with LuaJIT.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-15 09:25:06 +01:00
Uli Schlachter 7cb9ec4798 gears.timer: Use gears.debug.print_error (#2647)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-14 10:21:55 -05:00
Sorky 3f26624160 Aligning 'regex' with other PR / Minor readability improvements
https://github.com/awesomeWM/awesome/issues/2596

Re-matched regex used elsewhere & updated test cases for "." in filename

Allowed for alternative extensions to be found even if specified

Reverted the change of behaviour but adjusted code for readability

Small readability change

Avoided delay searches that would never work

Untabify

Reverted possible [unlikely/undesired] behaviour changes

Untabify
2019-02-09 19:21:46 +11:00
Uli Schlachter 6a463da636 background container: Actually set the foreground color
Commit ba75da7976 worked around a bug in LGI. However, it did so by
just dropping the code that set the foreground color. Instead, it should
have changed the code so that cr:set_source() is only called if the
background container has a foreground color configured instead of "just
always".

Fixes: https://github.com/awesomeWM/awesome/pull/2609#issuecomment-459580395
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-01 15:28:29 +01:00
Uli Schlachter 5f2cdabc01 textclock: Produce reproducible output (#2622)
When $SOURCE_DIRECTORY is set, we are most likely currently running the
examples test, i.e. generating images. These images end up in the
documentation.

To make the images reproducable, i.e. independent from the current time,
this commit makes the textclock honor $SOURCE_DATE_EPOCH if
$SOURCE_DIRECTORY is set.

See commit 9d7eaf02 for some more details.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-31 20:34:41 +01:00
warptozero eca5c869fa
awful.rules: Fix shape function not being set as client property 2019-01-30 07:44:00 +01:00
mergify[bot] cdd6e360f5
Merge pull request #2609 from psychon/shape_outside
Change the way the shape is done in the background container
2019-01-29 18:21:24 +00:00
Uli Schlachter 84eb175ccd background container: Deprecate shape_clip property
The previous commit removed the implementation of this property.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-28 14:55:53 +01:00
Emmanuel Lepage Vallée 8b5d79792b
doc: Fix a copy+paste mistake
The current `awful.widget.layoutlist` is a fork of the so far uncommitted `naughty.widget.actionlist`. It was created because some of the support code for the new `naughty` implementation needed "easier to merge" usage examples. The `layoutlist` was chosen because it was both a low hanging fruit and genuinely useful.
2019-01-27 22:01:10 -05:00
Uli Schlachter ba75da7976 Work around a bug in LGI
cairo_get_source() is not bound correctly, leading to use-after-free
bugs. Cairo catches this and crashes.

Work around this by preserving the current source in a different way.
Instead of using cairo_get_source() and later cairo_set_source(), this
commit wraps everything that changes the current source between
cairo_save() and cairo_restore(). Thus, cairo saves the current source
for us without us having to grab an explicit reference.

Works-around: https://github.com/pavouk/lgi/issues/210
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-27 11:42:51 +01:00
Uli Schlachter 67cf1469f0 Change the way the shape is done in the background container
Previously, the background container "just" used the shape and drew a
line around it. This means that half the line will be inside of the
shape and half of it will be outside. Thus, this hides the actual shape
that is used.

This commit changes that so that the line is added outside of the shape.
It does this via some tricks:

- In :before_draw_children(), :push_group() is used to redirect drawing
  of the child widget to a temporary surface.
- In :after_draw_children(), the border is added to this group.
  + For this, another temporary surface is created. It will be used as a
    mask.
  + The inside of the shape on this mask is cleared, everything else is
    filled. Thus, the mask now contains everything "not content".
  + Everything inside the mask is filled with the background color.
- Also in :after_draw_children(), the group is drawn to the actual
  target surface.
  + Again, this needs a mask.
  + This time, we draw the shape to the mask with twice the border width.
    Thus, half of this line will be outside of the shape.
  + Then, the shape itself is also filled so that the mask contains the
    shape and the border.
  + This mask is then used to copy the right parts of the temporary
    surface were the child widget and border was drawn to the actual
    target surface that will be visible on screen.

This approach has some upsides. Because we no longer have "half the
border" above content, colors with some transparency work fine for the
border. Also, this should avoid issues with anti-aliasing, because e.g.
the border is not just drawn with the border width, but also further out
to everything else so that the background cannot "bleed through".

Fixes: https://github.com/awesomeWM/awesome/issues/2516
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-27 11:42:36 +01:00
Emmanuel Lepage Vallée d25abddeb7
Merge pull request #2610 from Elv13/arcchat_fixes
Fix the arcchart rounded edges
2019-01-26 13:04:54 -05:00
Emmanuel Lepage Vallée f735a60b95
Merge pull request #2511 from Elv13/xmas_2k18_5
Add the layoutlist
2019-01-26 12:22:03 -05:00
Sorky bf62695f76 awful.menu: Move code from rc.lua to awful.menu
Fixes: #2524
2019-01-26 12:19:05 -05:00
Emmanuel Lepage Vallee dbb552097c arcchart: Also compute the sum when the limits are provided.
The result was used even when it wasn't computed.
2019-01-26 12:13:13 -05:00
Emmanuel Lepage Vallee 090f80d173 arcchart: Place the rounded edge in the right side of the arc. 2019-01-26 12:13:13 -05:00
Emmanuel Lepage Vallee 9efcf9df87 shape.arc: Prevent an angle underflow when rounded edges are enabled.
Fixes #2604
2019-01-26 12:13:13 -05:00
Emmanuel Lepage Vallee 8b60c05118 widget: Add a layoutlist widget
Like taglist and tasklist, but for layouts
2019-01-26 01:34:59 -05:00