doc: Add a prompt example.

This commit is contained in:
Emmanuel Lepage Vallee 2016-12-11 14:35:20 -05:00
parent 0e1c193450
commit 73afe0e954
1 changed files with 24 additions and 1 deletions

View File

@ -1,5 +1,28 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
--- Prompt module for awful --- Prompt module for awful.
--
-- By default, `rc.lua` will create one `awful.widget.prompt` per screen called
-- `mypromptbox`. It is used for both the command execution (`mod4+r`) and
-- Lua prompt (`mod4+x`). It can be re-used for random inputs using:
--
-- -- Create a shortcut function
-- local function echo_test()
-- awful.prompt.run {
-- prompt = "Echo: ",
-- textbox = mouse.screen.mypromptbox.widget,
-- exe_callback = function(input)
-- if not input or #input == 0 then return end
-- naughty.notify{ text = "The input was: "..input }
-- end
-- }
-- end
--
-- -- Then **IN THE globalkeys TABLE** add a new shortcut
-- awful.key({ modkey }, "e", echo_test,
-- {description = "Echo a string", group = "custom"}),
--
-- Note that this assumes an `rc.lua` file based on the default one. The way
-- to access the screen prompt may vary.
-- --
-- @author Julien Danjou <julien@danjou.info> -- @author Julien Danjou <julien@danjou.info>
-- @copyright 2008 Julien Danjou -- @copyright 2008 Julien Danjou