From fe11c5abbfa631f4003c440d7b9415835a7da9b1 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 9 Apr 2016 15:14:48 +0200 Subject: [PATCH] Add root.size() This function returns the size of the root window. Signed-off-by: Uli Schlachter --- root.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/root.c b/root.c index 6682d910..f1236e86 100644 --- a/root.c +++ b/root.c @@ -428,6 +428,20 @@ luaA_root_wallpaper(lua_State *L) return 1; } +/** Get the size of the root window. + * + * @return Width of the root window. + * @return height of the root window. + * @function size + */ +static int +luaA_root_size(lua_State *L) +{ + lua_pushinteger(L, globalconf.screen->width_in_pixels); + lua_pushinteger(L, globalconf.screen->height_in_pixels); + return 2; +} + /** Get the attached tags. * @return A table with all tags. * @function tags @@ -453,6 +467,7 @@ const struct luaL_Reg awesome_root_lib[] = { "fake_input", luaA_root_fake_input }, { "drawins", luaA_root_drawins }, { "wallpaper", luaA_root_wallpaper }, + { "size", luaA_root_size }, { "tags", luaA_root_tags }, { "__index", luaA_default_index }, { "__newindex", luaA_default_newindex },