lua.widget.prompt: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
bf23ebdf46
commit
1b134b2361
|
@ -6,11 +6,12 @@
|
||||||
|
|
||||||
local setmetatable = setmetatable
|
local setmetatable = setmetatable
|
||||||
|
|
||||||
local capi = { widget = widget }
|
|
||||||
local completion = require("awful.completion")
|
local completion = require("awful.completion")
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
local prompt = require("awful.prompt")
|
local prompt = require("awful.prompt")
|
||||||
local layout = require("awful.widget.layout")
|
local layout = require("awful.widget.layout")
|
||||||
|
local widget_base = require("wibox.widget.base")
|
||||||
|
local textbox = require("wibox.widget.textbox")
|
||||||
local type = type
|
local type = type
|
||||||
|
|
||||||
module("awful.widget.prompt")
|
module("awful.widget.prompt")
|
||||||
|
@ -31,19 +32,17 @@ local function run(promptbox)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create a prompt widget which will launch a command.
|
--- Create a prompt widget which will launch a command.
|
||||||
-- @param args Standard widget table arguments, with prompt to change the
|
-- @param args Arguments table. "prompt" is the prompt to use.
|
||||||
-- default prompt.
|
|
||||||
-- @return A launcher widget.
|
-- @return A launcher widget.
|
||||||
function new(args)
|
function new(args)
|
||||||
local args = args or {}
|
local args = args or {}
|
||||||
local promptbox = {}
|
local widget = textbox()
|
||||||
args.type = "textbox"
|
local promptbox = widget_base.make_widget(widget)
|
||||||
promptbox.widget = capi.widget(args)
|
|
||||||
promptbox.widget.ellipsize = "start"
|
promptbox.widget = widget
|
||||||
promptbox[1] = promptbox.widget
|
promptbox.widget:set_ellipsize("start")
|
||||||
promptbox.run = run
|
promptbox.run = run
|
||||||
promptbox.prompt = args.prompt or "Run: "
|
promptbox.prompt = args.prompt or "Run: "
|
||||||
promptbox.layout = args.layout or layout.horizontal.leftright
|
|
||||||
return promptbox
|
return promptbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue