prompt: Add a `with_shell` property. (#2500)

Fixes #2486
This commit is contained in:
Emmanuel Lepage Vallée 2018-12-31 15:38:14 -05:00 committed by GitHub
parent 61970761fb
commit a559f55c6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -58,12 +58,21 @@ local function run(promptbox)
end
local function spawn_and_handle_error(self, ...)
local result = spawn(...)
local f = self.with_shell and spawn.with_shell or spawn
local result = f(...)
if type(result) == "string" then
self.widget:set_text(result)
end
end
--- Always spawn using a shell.
--
-- When using the default `exe_callback`, use `awful.spawn.with_shell` instead
-- of `awful.spawn`. Depending on the ammount of customization to your shell
-- environment, this can increase startup time.
-- @property with_shell
-- @param[opt=false] boolean
--- Create a prompt widget which will launch a command.
-- For additional documentation about `args` parameter, please refer to
-- @{awful.prompt} and @{awful.prompt.run}.
@ -83,6 +92,7 @@ end
-- to the command.
-- @tparam[opt] function args.exe_callback The callback function to call with
-- command as argument when finished.
-- @tparam[opt=false] boolean args.with_shell Use a (terminal) shell to execute this.
-- @tparam[opt=`awful.completion.shell`] function args.completion_callback
-- The callback function to call to get completion. See @{awful.prompt.run}
-- for details.