awesome/core/widgets/prompt.lua

26 lines
1.0 KiB
Lua

--This widget is now entirely portable. Bindings are loaded and always reference the new object, not an object named "mypromptbox" attached to the screen.
local gears = require("gears")
local awful = require("awful")
return function()
local new_prompt = awful.widget.prompt()
root.keys(gears.table.join(
root.keys(),
-- Prompt
awful.key({ global.modkey }, "r", function () new_prompt:run() end,
{description = "run prompt", group = "launcher"}),
awful.key({ global.modkey }, "x",
function ()
awful.prompt.run {
prompt = "Run Lua code: ",
textbox = new_prompt.widget,
exe_callback = awful.util.eval,
history_path = awful.util.get_cache_dir() .. "/history_eval"
}
end,
{description = "lua execute prompt", group = "awesome"})))
return new_prompt
end