Add root.size_mm

This function returns the (alleged) physical size of the root window.
This commit is contained in:
Giuseppe Bilotta 2017-01-25 21:33:59 +01:00
parent c8bfbf5a3b
commit f7d8233466
1 changed files with 15 additions and 0 deletions

15
root.c
View File

@ -448,6 +448,20 @@ luaA_root_size(lua_State *L)
return 2; return 2;
} }
/** Get the physical size of the root window, in millimeter.
*
* @return Width of the root window, in millimeters.
* @return height of the root window, in millimeters.
* @function size_mm
*/
static int
luaA_root_size_mm(lua_State *L)
{
lua_pushinteger(L, globalconf.screen->width_in_millimeters);
lua_pushinteger(L, globalconf.screen->height_in_millimeters);
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
@ -474,6 +488,7 @@ const struct luaL_Reg awesome_root_lib[] =
{ "drawins", luaA_root_drawins }, { "drawins", luaA_root_drawins },
{ "wallpaper", luaA_root_wallpaper }, { "wallpaper", luaA_root_wallpaper },
{ "size", luaA_root_size }, { "size", luaA_root_size },
{ "size_mm", luaA_root_size_mm },
{ "tags", luaA_root_tags }, { "tags", luaA_root_tags },
{ "__index", luaA_default_index }, { "__index", luaA_default_index },
{ "__newindex", luaA_default_newindex }, { "__newindex", luaA_default_newindex },