awful.wibox: Error out on invalid positions

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Uli Schlachter 2009-09-09 10:39:08 +02:00 committed by Julien Danjou
parent 444edf1d03
commit 7fc0c24f4f
1 changed files with 7 additions and 0 deletions

View File

@ -17,6 +17,7 @@ local ipairs = ipairs
local table = table local table = table
local type = type local type = type
local image = image local image = image
local error = error
--- Wibox module for awful. --- Wibox module for awful.
-- This module allows you to easily create wibox and attach them to the edge of -- This module allows you to easily create wibox and attach them to the edge of
@ -213,6 +214,12 @@ function new(arg)
-- Empty position and align in arg so we are passing deprecation warning -- Empty position and align in arg so we are passing deprecation warning
arg.position = nil arg.position = nil
if position ~= "top" and position ~="bottom"
and position ~= "left" and position ~= "right" then
error("Invalid position in awful.wibox(), you may only use"
.. " 'top', 'bottom', 'left' and 'right'")
end
-- Set default size -- Set default size
if position == "left" or position == "right" then if position == "left" or position == "right" then
arg.width = arg.width or capi.awesome.font_height * 1.5 arg.width = arg.width or capi.awesome.font_height * 1.5