Commit Graph

29 Commits

Author SHA1 Message Date
Uli Schlachter 13984af8aa awful.spawn.read_lines: Shrink input stream buffer when done (#2289)
I do not know how a GDataInputStream / GBufferedInputStream decides
about the size of its internal buffer when reading input by line, but in
issue #2288, an example where the output of date (about 30 bytes) was
read ten times per second caused ten megabytes of memory usage for this
internal buffer. Try to save some memory by explicitly shrinking the
buffer size when we are done reading from the stream.

Reference: https://github.com/awesomeWM/awesome/issues/2288
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-06-26 09:56:32 -04:00
Emmanuel Lepage Vallee 017077a33a spawn: Add a TODO to remove an useless/broken signal from v5
It has a race condition causing it to be useless.
2018-03-04 01:34:34 -05:00
Emmanuel Lepage Vallee 74508098de rules: Add a rule building chain of responsability
Before this commit, there was a conflict between the spawn and
awful.rules rules.

Also, modules such as Tryannical monkey-patched this function to
add their own rules to the mix. This commit introduce a proper
API to add handlers.

The order is crutial for this to work, so a dependency system is
also added.

Fix #1482
2018-03-04 01:34:33 -05:00
Daniel Hahler a6c36a4a2e awful.spawn: fix doc for spawn.easy_async{,_with_shell} (#1877)
Using `@function` in 547c0e4b was wrong.
2017-06-26 22:44:08 +02:00
Luke Bonham 547c0e4b83 awful.spawn: add easy_async_with_shell and fixed easy_async doc (#1541) 2017-06-26 21:15:58 +02:00
Kevin Zander 3f6df8ddee Fix Luacheck 0.19.0 release Travis breaks 2017-03-03 16:41:12 -06:00
Emmanuel Lepage Vallee 5ff29bb00e doc: Document how to open a document using `awful.spawn` 2016-12-16 12:38:33 -05:00
Emmanuel Lepage Vallee 1efbb57049 doc: Add a little awful.spawn async tutorial 2016-12-16 12:38:33 -05:00
Emmanuel Lepage Vallee 7f1933f99c doc: Document when spawning with a shell is needed 2016-12-16 12:38:33 -05:00
Emmanuel Lepage Vallee b9dbc79308 doc: Add more `awful.spawn` documentation
It was lacking
2016-12-16 12:38:33 -05:00
Uli Schlachter f9cdc98c73 Fix spawn callbacks
Spawn callbacks were never invoked when no startup-notification-rules were
given. This commit fixes the code so that "startup done" callbacks are also
called when no rules were given.

Fixes: https://github.com/awesomeWM/awesome/issues/1218
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-01 15:32:21 +01:00
Uli Schlachter 70d4961a3e awful.spawn: Separate rules from callbacks (#1186)
When adding callbacks as a `callback` entry in a property, the callback
is run by `awful.rules`, because it does `c.callback =
result_of_function`. This is obviously not intended. Also, this causes
the callbacks to run twice, because the code already handled this
`callback` property specially.

Fix this by just not merging callbacks with the normal rules at all.

Fixes: https://github.com/awesomeWM/awesome/issues/1159
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-25 00:22:36 +02: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 2cfa117a14 Remove awful.{spawn.,}pread (#184)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-16 17:59:47 +02:00
Uli Schlachter 0857f6f1b5 Lua: Remove calls to add_signal()
The requirement to call add_signal() was added to catch typos. However, this
requirement became increasingly annoying with property::<name> signals and e.g.
gears.object allowing arbitrary properties to be changed.

All of this ended up in a single commit because tests/examples fails if I first
let add_signal() emit a deprecation warning.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-04 18:23:48 +02:00
Daniel Hahler df21a85a9a doc: fixes for spawn.with_line_callback 2016-04-04 20:30:48 +02:00
Uli Schlachter c04718a150 Fix awful.spawn to work with more LGI versions
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-28 17:53:52 +02:00
Uli Schlachter 8560c6d2af Use gears.protected_call where applicable
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-28 12:28:55 +01:00
Uli Schlachter 065dd0d213 Merge branch 'easy-async-spawn' of https://github.com/actionless/awesome 2016-02-14 14:34:37 +01: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
actionless 801d297648 feat(awful: spawn): add 'easy_async' wrapper 2016-02-07 05:19:13 +01:00
actionless 7546c236db feat(spawn, lib: awful: spawn: with_line_callback): make callbacks optional 2016-01-03 15:38:06 +01:00
Uli Schlachter 469433e10a awful.spawn.with_line_callback: Use an arguments table
Having many arguments can easily get confusing and hard to understand. This
commit uses a table instead so that we have names that identify what each
callback does.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:27:33 +01:00
Uli Schlachter 44a3e27e81 awful.spawn.with_line_callback: Add exit callback
This adds support for the callback that was added in the previous commit to this
function. We can just pass on the function that the caller gives us.

Fixes: https://github.com/awesomeWM/awesome/issues/185
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-29 11:56:05 +01:00
Daniel Hahler a410326ba6 Improve doc for awful.spawn: module/spawn/with_shell 2015-11-05 01:53:57 +01:00
Daniel Hahler 4bffa7e47e doc: fix unintentional rendering as code due to indent 2015-10-14 00:22:26 +02:00
Daniel Hahler 22f90752f7 doc: improve doc for awful.spawn(.spawn) 2015-10-14 00:22:26 +02:00
Uli Schlachter 79e86d409a Fix awful.spawn.spawn
The C code wants a boolean as its argument, so we should give it a boolean.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-11 13:23:57 +02:00
Emmanuel Lepage Vallee 4095eb91a8 Move util.spawn to a new module, add ability to spawn with properties
* This commit add a new module to avoid a (4 level) loop dependency
* It is now possible to call awful.spawn() with a table of properties
* awful.rules is used to execute the rules.

* Everything is public to allow alternative workflow modules such as
    Tyrannical to use their own callback implementation.
2015-09-29 18:05:56 -04:00