2013-09-07 12:06:42 +02:00
|
|
|
|
|
|
|
--[[
|
|
|
|
|
|
|
|
Licensed under GNU General Public License v2
|
|
|
|
* (c) 2013, Luke Bonham
|
|
|
|
* (c) 2010-2012, Peter Hofmann
|
|
|
|
|
|
|
|
--]]
|
|
|
|
|
2016-03-03 12:40:49 +01:00
|
|
|
local wibox = require("awful.wibox")
|
2013-09-07 12:06:42 +02:00
|
|
|
local setmetatable = setmetatable
|
|
|
|
|
|
|
|
-- Creates a thin wibox at a position relative to another wibox
|
|
|
|
-- lain.widgets.borderbox
|
|
|
|
local borderbox = {}
|
|
|
|
|
|
|
|
local function worker(relbox, s, args)
|
2016-05-29 17:13:52 +02:00
|
|
|
local where = args.position or 'top'
|
|
|
|
local color = args.color or '#FFFFFF'
|
|
|
|
local size = args.size or 1
|
|
|
|
local box = nil
|
|
|
|
local wiboxarg = { position = nil, bg = color }
|
2013-09-07 12:06:42 +02:00
|
|
|
|
2013-09-19 20:51:28 +02:00
|
|
|
if where == 'top'
|
2013-09-07 12:06:42 +02:00
|
|
|
then
|
|
|
|
wiboxarg.width = relbox.width
|
|
|
|
wiboxarg.height = size
|
|
|
|
box = wibox(wiboxarg)
|
|
|
|
box.x = relbox.x
|
|
|
|
box.y = relbox.y - size
|
2013-09-19 20:51:28 +02:00
|
|
|
elseif where == 'bottom'
|
2013-09-07 12:06:42 +02:00
|
|
|
then
|
|
|
|
wiboxarg.width = relbox.width
|
|
|
|
wiboxarg.height = size
|
|
|
|
box = wibox(wiboxarg)
|
|
|
|
box.x = relbox.x
|
|
|
|
box.y = relbox.y + relbox.height
|
|
|
|
elseif where == 'left'
|
|
|
|
then
|
|
|
|
wiboxarg.width = size
|
|
|
|
wiboxarg.height = relbox.height
|
|
|
|
box = wibox(wiboxarg)
|
|
|
|
box.x = relbox.x - size
|
|
|
|
box.y = relbox.y
|
|
|
|
elseif where == 'right'
|
|
|
|
then
|
|
|
|
wiboxarg.width = size
|
|
|
|
wiboxarg.height = relbox.height
|
|
|
|
box = wibox(wiboxarg)
|
|
|
|
box.x = relbox.x + relbox.width
|
|
|
|
box.y = relbox.y
|
|
|
|
end
|
|
|
|
|
|
|
|
box.screen = s
|
|
|
|
return box
|
|
|
|
end
|
|
|
|
|
|
|
|
return setmetatable(borderbox, { __call = function(_, ...) return worker(...) end })
|