Commit Graph

32 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee f0a7f904f9 keygrabber: Add a new signal to catch awful.keys activations.
Some downstream modules with keys don't control the callbacks. Using
signals on multiple keys is more cumbersome than simply exposing
this at the keygrabber level.
2022-11-13 16:53:32 -08:00
Aire-One 941bb72fa2 doc(awful.keygrabber): fix ldoc WARN 2022-09-18 18:22:02 +02:00
Emmanuel Lepage Vallee deaeb4dab8 awful.keygrabber: Update the property documentation. 2022-08-29 22:49:46 -07:00
Emmanuel Lepage Vallee 86d1b1c22c doc: Add a mandatory `@noreturn` for functions and methods.
The goal is to catch cases where the return value exists, but is
forgotten. There was a large enough number of them to turn this
into a real check. Initially, I just wanted to implement it to fix
the problems, then delete the code. But since this is so common, I
think it is worth the annoyance.
2022-08-29 22:49:45 -07:00
Emmanuel Lepage Vallee 4bd90f0f35 doc: Add documentation linting and fix all issues it found. 2022-08-29 22:48:54 -07:00
Emmanuel Lepage Vallee 1601c6890b keygrabber: Document 5 deprecated, but still honored, method arguments.
As pointed out by @sclu1034, some users might actually pass the return
values of a function with multiple returns. This would cause some
confusing behavior. Documenting previous mistakes is in this case better
than hiding them.
2022-08-28 17:13:52 -07:00
Emmanuel Lepage Vallee 75019c3f6f Implement fixes for Luacheck 0.26.1
* Rename or mute parameters starting with _
 * Replace `not (>=)` with `<`
2022-08-28 16:59:14 -07:00
Grumph 3a542219f3
Fix awful.keygrabber:add_keybinding function (#3568)
* Check the correct variable

* Fix table access

In every other use of _private.keybindings in this file, the key is a
string, not an awful.key

* Simplify code

key.key is always defined

* Add tests

* add(spec) add_keybinding unit test

* Revert "Add tests"

This reverts commit 808b17cd5c.

Co-authored-by: Aire-One <aireone@aireone.xyz>
2022-05-29 13:10:29 -07:00
Elyes HAOUAS 54a5a7dce5
Fix some spelling errors (#3450)
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-04 19:20:03 -07:00
poisson-aerohead 87e09f81ab
Correction of error message in awful.keygrabber.run_with_keybindings (#3445)
Two calls to gdebug.print_warning() in run_with_keybindings use an
argument that concatenates a fixed string with the result returned by a
call to gdebug.dump(). gdebug.dump() is the debug library function for
immediate printing. It has no return value. This causes the correct
message in print_warning to not be printed, and also causes a
naughty.notify box to appear warning of an attempt to concatenate to an
empty variable.

The call to gdebug.print_warning should have an argument made by
concatenating to gdebug.dump_return(). Incidentally, this is in fact the
function used internally by gdebug.print().

Signed off by: Brian Sobulefsky <brian.sobulefsky@protonmail.com>
2021-09-21 08:34:46 -07:00
Lucas Schwiderski 1182552783
bug(a.keygrabber): Stop timer when stopping keygrabber
When stopping a keygrabber with a timeout manually or through the stop
key, the timer would continue and call the stop callback again some time
later.

The error message in `gears.timer:stop` is removed, since there actually
is no harm in just returning immediately. And the timer implementation
itself calls `:stop` in certain places without checking for `.started`,
which lead to a situation where the internal call to `stop` triggered
the error message.

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-06-11 08:59:58 +02:00
Aire-One 02b1a6b633 Fix missing `self` parameter in documentation usage examples. 2020-01-28 10:57:43 +01:00
Emmanuel Lepage-Vallee c32c2bf43d doc: Upgrade the keygrabber to the newest standards. 2019-12-21 21:27:21 -08:00
Emmanuel Lepage Vallee ee331a4eff keygrabber: Remove the hardcoded way to add keybindings.
There is now a real API for this.
2019-11-09 16:43:53 -05: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 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 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
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 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 0d80b3f0e9 keygrabber: Do not try to guess the modifiers name
There is no an API to query the correct value

Fixes #2515
2019-01-21 03:14:26 -05:00
Emmanuel Lepage Vallée 35130169c9
keygrabber: Rename release_event to stop_event (#2422)
In the earlier revision of the keygrabber PR, there was a `release_key`
and it was suggested to rename it `stop_key`. However its sibling
`release_event` wasn't, so it is now confusing.

The commit adds a mild deprecation codepath to avoid breaking configs
based on git-master. However it isn't a "long term" deprecation notice
and the code can probably be removed in 5.0 without further delay.
2018-10-16 08:42:56 -04:00
Emmanuel Lepage Vallee 2bf930b044 keygrabber: Refactor to be an object instead of a function.
The old keygrabber API wasn't doing what the users want from a
keygrabber module. With tons of boilerplate code, everything could
be done, but it wasn't trivial.

This commit add a default grabber function that implements the
keybinding API already used by `awful.key` and `awful.prompt`.

It also add syntax candy left and right to make the module "feel"
like a native CAPI object.

Nothing is perfect and some parts, like adding root keybindings, are not
vevy pleasing. However it fulfill its goal when it comes to make
previously non-trivial use case very easy to implement and deploy.
2018-08-06 19:03:25 -04:00
Uli Schlachter cfe9231e59 awful.keygrabber.run: Fix example (#2169)
Fixes: https://github.com/awesomeWM/awesome/issues/2167
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-24 13:13:08 -05:00
Kevin Zander 6cb2e0fa82 Fix some deprecated calls in code and docs
Add missing newline in test runner
2017-03-30 21:26:50 -05: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
Uli Schlachter c455e1f90e Fix luacheck warnings in half of awful
Boy, awful is huge... Let's better do it in two parts

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-11 21:55:32 +01:00
Daniel Hahler aca856b5d2 keygrabber.grabber: rename function name
This makes it clearer / more explicit in the traceback in case of
errors.
2015-07-22 13:52:47 +02:00
Daniel Hahler 1050237d04 minor: fix/improve doc comments 2015-07-12 17:42:53 +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