Add root.size()

This function returns the size of the root window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-09 15:14:48 +02:00
parent 6e8337e26a
commit fe11c5abbf
1 changed files with 15 additions and 0 deletions

15
root.c
View File

@ -428,6 +428,20 @@ luaA_root_wallpaper(lua_State *L)
return 1; 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. /** Get the attached tags.
* @return A table with all tags. * @return A table with all tags.
* @function tags * @function tags
@ -453,6 +467,7 @@ const struct luaL_Reg awesome_root_lib[] =
{ "fake_input", luaA_root_fake_input }, { "fake_input", luaA_root_fake_input },
{ "drawins", luaA_root_drawins }, { "drawins", luaA_root_drawins },
{ "wallpaper", luaA_root_wallpaper }, { "wallpaper", luaA_root_wallpaper },
{ "size", luaA_root_size },
{ "tags", luaA_root_tags }, { "tags", luaA_root_tags },
{ "__index", luaA_default_index }, { "__index", luaA_default_index },
{ "__newindex", luaA_default_newindex }, { "__newindex", luaA_default_newindex },