[lua] Add name_get() method and make mplayer floating by default

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-23 13:49:59 +02:00
parent ed44254aeb
commit 981b26cbc8
2 changed files with 13 additions and 0 deletions

View File

@ -172,6 +172,10 @@ end
-- Hook function to execute when a new client appears.
function hook_newclient(c)
c:focus_set()
local name = c:name_get()
if name:find("mplayer") then
c:floating_set(true)
end
end
-- Set up some hooks

View File

@ -1093,6 +1093,14 @@ luaA_client_icon_set(lua_State *L)
return 0;
}
static int
luaA_client_name_get(lua_State *L)
{
client_t **c = luaL_checkudata(L, 1, "client");
lua_pushstring(L, (*c)->name);
return 1;
}
const struct luaL_reg awesome_client_methods[] =
{
{ "get", luaA_client_get },
@ -1103,6 +1111,7 @@ const struct luaL_reg awesome_client_methods[] =
};
const struct luaL_reg awesome_client_meta[] =
{
{ "name_get", luaA_client_name_get },
{ "titlebar_set", luaA_client_titlebar_set },
{ "screen_set", luaA_client_screen_set },
{ "screen_get", luaA_client_screen_get },