luaa: move root button bindings to root module
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
8edd049e4d
commit
bf44ae1e03
|
@ -160,7 +160,7 @@ end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Mouse bindings
|
-- {{{ Mouse bindings
|
||||||
awesome.buttons({
|
root.buttons({
|
||||||
button({ }, 3, function () mymainmenu:toggle() end),
|
button({ }, 3, function () mymainmenu:toggle() end),
|
||||||
button({ }, 4, awful.tag.viewnext),
|
button({ }, 4, awful.tag.viewnext),
|
||||||
button({ }, 5, awful.tag.viewprev)
|
button({ }, 5, awful.tag.viewprev)
|
||||||
|
|
38
luaa.c
38
luaa.c
|
@ -84,7 +84,27 @@ static ev_io csio = { .fd = -1 };
|
||||||
|
|
||||||
#define XDG_CONFIG_HOME_DEFAULT "/.config"
|
#define XDG_CONFIG_HOME_DEFAULT "/.config"
|
||||||
|
|
||||||
/** Get or set global mouse bindings.
|
/** Get or
|
||||||
|
* This binding will be available when you'll click on root window.
|
||||||
|
* \param L The Lua VM state.
|
||||||
|
* \return The number of element pushed on stack.
|
||||||
|
* \luastack
|
||||||
|
* \lvalue A client.
|
||||||
|
* \lparam An array of mouse button bindings objects, or nothing.
|
||||||
|
* \return The array of mouse button bindings objects of this client.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
luaA_root_buttons(lua_State *L)
|
||||||
|
{
|
||||||
|
button_array_t *buttons = &globalconf.buttons;
|
||||||
|
|
||||||
|
if(lua_gettop(L) == 1)
|
||||||
|
luaA_button_array_set(L, 1, buttons);
|
||||||
|
|
||||||
|
return luaA_button_array_get(L, buttons);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get or set global mouse bindings (DEPRECATED).
|
||||||
* This binding will be available when you'll click on root window.
|
* This binding will be available when you'll click on root window.
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
* \return The number of element pushed on stack.
|
* \return The number of element pushed on stack.
|
||||||
|
@ -96,12 +116,8 @@ static ev_io csio = { .fd = -1 };
|
||||||
static int
|
static int
|
||||||
luaA_buttons(lua_State *L)
|
luaA_buttons(lua_State *L)
|
||||||
{
|
{
|
||||||
button_array_t *buttons = &globalconf.buttons;
|
luaA_deprecate(L, "root.buttons");
|
||||||
|
return luaA_root_buttons(L);
|
||||||
if(lua_gettop(L) == 1)
|
|
||||||
luaA_button_array_set(L, 1, buttons);
|
|
||||||
|
|
||||||
return luaA_button_array_get(L, buttons);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Quit awesome.
|
/** Quit awesome.
|
||||||
|
@ -789,6 +805,11 @@ luaA_init(void)
|
||||||
{ "__newindex", luaA_awesome_newindex },
|
{ "__newindex", luaA_awesome_newindex },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
static const struct luaL_reg root_lib[] =
|
||||||
|
{
|
||||||
|
{ "buttons", luaA_root_buttons },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
L = globalconf.L = luaL_newstate();
|
L = globalconf.L = luaL_newstate();
|
||||||
|
|
||||||
|
@ -799,6 +820,9 @@ luaA_init(void)
|
||||||
/* Export awesome lib */
|
/* Export awesome lib */
|
||||||
luaA_openlib(L, "awesome", awesome_lib, awesome_lib);
|
luaA_openlib(L, "awesome", awesome_lib, awesome_lib);
|
||||||
|
|
||||||
|
/* Export root lib */
|
||||||
|
luaA_openlib(L, "root", root_lib, root_lib);
|
||||||
|
|
||||||
/* Export hooks lib */
|
/* Export hooks lib */
|
||||||
luaL_register(L, "hooks", awesome_hooks_lib);
|
luaL_register(L, "hooks", awesome_hooks_lib);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue