From f7d82334662f2949aef46d6dec86ed172108b9fb Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 25 Jan 2017 21:33:59 +0100 Subject: [PATCH] Add root.size_mm This function returns the (alleged) physical size of the root window. --- root.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/root.c b/root.c index 968cbba1e..bbd0b9d95 100644 --- a/root.c +++ b/root.c @@ -448,6 +448,20 @@ luaA_root_size(lua_State *L) 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. * @return A table with all tags. * @function tags @@ -474,6 +488,7 @@ const struct luaL_Reg awesome_root_lib[] = { "drawins", luaA_root_drawins }, { "wallpaper", luaA_root_wallpaper }, { "size", luaA_root_size }, + { "size_mm", luaA_root_size_mm }, { "tags", luaA_root_tags }, { "__index", luaA_default_index }, { "__newindex", luaA_default_newindex },