Commit Graph

9629 Commits

Author SHA1 Message Date
mergify[bot] 052f6fb89d
Merge pull request #2659 from psychon/luaA_setfuncs
Migrate a bit away from luaL_register().
2019-02-18 01:43:31 +00: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] c3a8ba7065
Merge pull request #2660 from psychon/selection_setup
Move setup of selection() to selection.c
2019-02-18 01:35:32 +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] e7a67d300e
Merge pull request #2664 from psychon/naughty_test_print_warning
Some changes to the new naughty test
2019-02-18 01:33:14 +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
Uli Schlachter b73fa1cc28 Reduce scope of data variable
This fixes a warning from Codacy.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 18:43:02 +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
Uli Schlachter a54eb67de0 naughty test: Use array-style spawn() calls
When a string is spawned, the C code has to split this into an array for
the execve() syscall. When an array is given directly, this array does
not need to be transformed in any way. This makes it much more clear
what is actually started.

This commit removes some quotation marks that were previously removed by
the C code. For example,

    array:string:1,"four",2,"five",3,"six"

became

    array:string:1,four,2,five,3,six

because otherwise the action was called "four" instead of four and the
test failed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 10:30:31 +01:00
Uli Schlachter 083462e0c1 naughty test: Warn about missing dependencies
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 10:21:18 +01: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
Uli Schlachter 01bd2d1896 selection_acquire: Change the API to a table
As requested in the review, instead of just having a single string
argument, selection_acquire() now has a table as its argument. It
searches the string under the "selection" key here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 08:00:57 +01:00
Emmanuel Lepage Vallée 698fce9b4e
Merge pull request #2541 from Elv13/xmas_2k18_9
Split naughty along model/view lines and add an extensive test suite
2019-02-16 16:12:39 -05:00
Emmanuel Lepage Vallee 1b4c1e9f1c tests: Test the naughty deprecated APIs 2019-02-16 15:49:39 -05:00
Emmanuel Lepage Vallee db591b50a4 tests: Add extensive tests for the existing notification features.
This new test suit add a rather extensive coverage to the "legacy"
notification popups. A few minor bugs have been found and fixed
and we can rest assured that the new spec 1.2 support and extended
manipulation API wont regress existing configs.
2019-02-16 15:49:39 -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 b11582ad15 build: Install `notify-send`
We could use a `dbus-send` too, but this would be a little more error
prone given the dbus notification call is quite large.
2019-02-16 15:26:38 -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 b909068430 Set _NET_WM_DESKTOP for sticky windows specially (#2653)
Today I learnt that _NET_WM_STATE_STICKY means something else than I
previously thought.

ICCCM and EWMH support virtual desktops that are larger than the actual
screen. The idea is that one can scroll through this virtual desktop,
which means that e.g. all windows move to the left, so one can see the
windows that are further to the right.

_NET_WM_STATE_STICKY indicates that a window is sticky. This means that
it does not scroll with the virtual desktop, but instead sticks to its
current position.

In AwesomeWM, we use a different definition. A sticky window is always
visible, even when it is not tagged with any of the currently selected
tags. This behaviour is indicated in EWMH with a special value of
_NET_WM_DESKTOP. This commit updates the code to actually set this
special value.

This fixes attaching tabs in Google Chrome when the "target window" is
sticky (in the AwesomeWM sense).

Fixes: https://github.com/awesomeWM/awesome/issues/2652
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-16 13:51:29 -05:00
Uli Schlachter 2afa5b5fae Move setup of selection() to selection.c
The function selection() is now registered in the Lua global table from
selection.c instead of in luaa.c. This "feels cleaner" to me and is
preparatory for later changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-16 15:44:42 +01:00
Uli Schlachter 4cd05133f7 Migrate a bit away from luaL_register().
luaL_register() only exists in Lua 5.1 and was removed in never
versions. It has two completely different behaviours depending on
whether its second argument is NULL or not.

This commit splits that up by adding a wrapper for luaL_setfuncs()
(which does not exist in Lua 5.1) and using that everywhere instead of
our wrapper for luaL_register().

No behavioural changes are intended. This is simply meant as a cleanup.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-16 14:25:20 +01: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
Daniel Hahler 991d525f7d
ci: codecov: improve flags/env (#2651) 2019-02-14 18:46:01 +01:00
Daniel Hahler df9ed76418
ci: codecov: use env vars instead of flags (#2648)
Using flags appears to trigger timeouts with codecov's backend.
This uses env variables instead.
2019-02-14 17:18:54 +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
mergify[bot] 5a7594a8cb
Merge pull request #2644 from psychon/useless_int_return
property: Remove unused int return
2019-02-12 15:57:31 +00:00
Uli Schlachter d29cf0c926 property: Remove unused int return
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 10:13:13 +01:00
Uli Schlachter c3338c5a74 Luacheck: Allow selection_acquire global
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter fa39de17b3 Add a test for selection ownership and transfer
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter 6d7014ca68 Selection transfer: Change event mask after append
When a selection transfer is done, we are no longer interested in events
from the selection window. However, this happens after we set the
property to indicate end of transfer, not before.

The (untested) theory here is that this should make selection transfers
from AwesomeWM to AwesomeWM, i.e. internal transfers, work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter 18dd22811e Transfer objects: Accept data in chunks
This commit adds a "continue" signal on transfer objects. This signal is
used to request the next chunk of data from Lua after the last one was
sent.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter 434f97e4b1 Selection transfer: Support INCR transfers
Large amounts of data have to be send in chunks via the INCR protocol.
This commit adds support for that protocol to selection transfers.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00