awful.screen.padding: Support padding number value

This commit is contained in:
Emmanuel Lepage Vallee 2016-03-26 03:05:17 -04:00
parent b2fabfeea1
commit 242652be94
1 changed files with 13 additions and 2 deletions

View File

@ -135,14 +135,25 @@ end
--- Get or set the screen padding. --- Get or set the screen padding.
-- @param _screen The screen object to change the padding on -- @param _screen The screen object to change the padding on
-- @param padding The padding, a table with 'top', 'left', 'right' and/or -- @param[opt=nil] padding The padding, a table with 'top', 'left', 'right' and/or
-- 'bottom'. Can be nil if you only want to retrieve padding -- 'bottom' or a number value to apply set the same padding on all sides. Can be
-- nil if you only want to retrieve padding
function screen.padding(_screen, padding) function screen.padding(_screen, padding)
if type(padding) == "number" then
padding = {
left = padding,
right = padding,
top = padding,
bottom = padding,
}
end
_screen = get_screen(_screen) _screen = get_screen(_screen)
if padding then if padding then
data.padding[_screen] = padding data.padding[_screen] = padding
_screen:emit_signal("padding") _screen:emit_signal("padding")
end end
return data.padding[_screen] return data.padding[_screen]
end end