commit
b470f8dfcf
|
@ -230,7 +230,11 @@ end
|
||||||
-- present currently.
|
-- present currently.
|
||||||
function screen.focused(args)
|
function screen.focused(args)
|
||||||
args = args or screen.default_focused_args or {}
|
args = args or screen.default_focused_args or {}
|
||||||
return get_screen(args.client and capi.client.screen or capi.mouse.screen)
|
return get_screen(
|
||||||
|
(args.client and args.client.screen) or
|
||||||
|
(capi.client.focus and capi.client.focus.screen) or
|
||||||
|
capi.mouse.screen
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get a placement bounding geometry.
|
--- Get a placement bounding geometry.
|
||||||
|
|
|
@ -64,11 +64,18 @@ end
|
||||||
|
|
||||||
--- Get a client's titlebar
|
--- Get a client's titlebar
|
||||||
-- @class function
|
-- @class function
|
||||||
-- @param c The client for which a titlebar is wanted.
|
-- @tparam client c The client for which a titlebar is wanted.
|
||||||
-- @param[opt] args A table with extra arguments for the titlebar. The
|
-- @tparam[opt={}] table args A table with extra arguments for the titlebar.
|
||||||
-- "size" is the height of the titlebar. Available "position" values are top,
|
-- @tparam[opt=font.height*1.5] number args.size The height of the titlebar.
|
||||||
-- left, right and bottom. Additionally, the foreground and background colors
|
-- @tparam[opt=top] string args.position" values are `top`,
|
||||||
-- can be configured via e.g. "bg_normal" and "bg_focus".
|
-- `left`, `right` and `bottom`.
|
||||||
|
-- @tparam[opt=top] string args.bg_normal
|
||||||
|
-- @tparam[opt=top] string args.bg_focus
|
||||||
|
-- @tparam[opt=top] string args.bgimage_normal
|
||||||
|
-- @tparam[opt=top] string args.bgimage_focus
|
||||||
|
-- @tparam[opt=top] string args.fg_normal
|
||||||
|
-- @tparam[opt=top] string args.fg_focus
|
||||||
|
-- @tparam[opt=top] string args.font
|
||||||
-- @name titlebar
|
-- @name titlebar
|
||||||
local function new(c, args)
|
local function new(c, args)
|
||||||
args = args or {}
|
args = args or {}
|
||||||
|
|
|
@ -495,6 +495,8 @@ function base.widget:setup(args)
|
||||||
if id then
|
if id then
|
||||||
-- Avoid being dropped by wibox metatable -> drawin
|
-- Avoid being dropped by wibox metatable -> drawin
|
||||||
rawset(self, id, w)
|
rawset(self, id, w)
|
||||||
|
ids[id] = ids[id] or {}
|
||||||
|
table.insert(ids[id], 1, w)
|
||||||
end
|
end
|
||||||
|
|
||||||
if rawget(self, "_private") then
|
if rawget(self, "_private") then
|
||||||
|
@ -522,6 +524,11 @@ function base.make_widget_declarative(args)
|
||||||
local mt = getmetatable(w) or {}
|
local mt = getmetatable(w) or {}
|
||||||
local orig_string = tostring(w)
|
local orig_string = tostring(w)
|
||||||
|
|
||||||
|
-- Add the main id (if any)
|
||||||
|
if id then
|
||||||
|
ids[id] = ids[id] or {}
|
||||||
|
table.insert(ids[id], 1, w)
|
||||||
|
end
|
||||||
|
|
||||||
if rawget(w, "_private") then
|
if rawget(w, "_private") then
|
||||||
w._private.by_id = ids
|
w._private.by_id = ids
|
||||||
|
|
|
@ -44,4 +44,28 @@ assert(w.foo == "bar")
|
||||||
screen[1].clients = 42
|
screen[1].clients = 42
|
||||||
assert(screen[1].clients ~= 42)
|
assert(screen[1].clients ~= 42)
|
||||||
|
|
||||||
|
-- Test the wibox declarative widget system (drawin proxy)
|
||||||
|
|
||||||
|
local w2 = wibox {
|
||||||
|
visible = true,
|
||||||
|
wisth = 100,
|
||||||
|
height = 100
|
||||||
|
}
|
||||||
|
|
||||||
|
w2:setup{
|
||||||
|
{
|
||||||
|
text = "Awesomeness!",
|
||||||
|
id = "main_textbox",
|
||||||
|
widget = wibox.widget.textbox,
|
||||||
|
},
|
||||||
|
id = "main_background",
|
||||||
|
widget = wibox.container.background
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(w2.main_background)
|
||||||
|
assert(w2:get_children_by_id("main_background")[1])
|
||||||
|
assert(w2:get_children_by_id("main_textbox")[1])
|
||||||
|
assert(w2.main_background.main_textbox)
|
||||||
|
assert(w2.main_background == w2:get_children_by_id("main_background")[1])
|
||||||
|
|
||||||
require("_runner").run_steps({ function() return true end })
|
require("_runner").run_steps({ function() return true end })
|
||||||
|
|
Loading…
Reference in New Issue