hooks: rename mouseover to mouse_over and simplify config

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-08-25 15:35:17 +02:00
parent 0a74d9e127
commit 0dde158b5f
4 changed files with 22 additions and 32 deletions

View File

@ -333,39 +333,39 @@ end
-- {{{ Hooks
-- Hook function to execute when focusing a client.
function hook_focus(c)
awful.hooks.focus.register(function (c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_focus
end
end
end)
-- Hook function to execute when unfocusing a client.
function hook_unfocus(c)
awful.hooks.unfocus.register(function (c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_normal
end
end
end)
-- Hook function to execute when marking a client
function hook_marked(c)
awful.hooks.marked.register(function (c)
c.border_color = beautiful.border_marked
end
end)
-- Hook function to execute when unmarking a client
function hook_unmarked(c)
awful.hooks.unmarked.register(function (c)
c.border_color = beautiful.border_focus
end
end)
-- Hook function to execute when the mouse is over a client.
function hook_mouseover(c)
awful.hooks.mouse_over.register(function (c)
-- Sloppy focus, but disabled for magnifier layout
if awful.layout.get(c.screen) ~= "magnifier" then
client.focus = c
end
end
end)
-- Hook function to execute when a new client appears.
function hook_manage(c)
awful.hooks.manage.register(function (c)
-- Set floating placement to be smart!
c.floating_placement = "smart"
if use_titlebar then
@ -411,11 +411,11 @@ function hook_manage(c)
-- Honor size hints
c.honorsizehints = true
end
end)
-- Hook function to execute when arranging the screen
-- (tag switch, new client, etc)
function hook_arrange(screen)
awful.hooks.arrange.register(function (screen)
local layout = awful.layout.get(screen)
if layout then
mylayoutbox[screen].text =
@ -445,23 +445,13 @@ function hook_arrange(screen)
end
end
]]
end
end)
-- Hook called every second
function hook_timer ()
awful.hooks.timer.register(1, function ()
-- For unix time_t lovers
mytextbox.text = " " .. os.time() .. " time_t "
-- Otherwise use:
-- mytextbox.text = " " .. os.date() .. " "
end
-- Set up some hooks
awful.hooks.focus.register(hook_focus)
awful.hooks.unfocus.register(hook_unfocus)
awful.hooks.marked.register(hook_marked)
awful.hooks.unmarked.register(hook_unmarked)
awful.hooks.manage.register(hook_manage)
awful.hooks.mouseover.register(hook_mouseover)
awful.hooks.arrange.register(hook_arrange)
awful.hooks.timer.register(1, hook_timer)
end)
-- }}}

View File

@ -460,7 +460,7 @@ event_handle_enternotify(void *data __attribute__ ((unused)),
globalconf.pointer_y = ev->root_y;
luaA_client_userdata_new(globalconf.L, c);
luaA_dofunction(globalconf.L, globalconf.hooks.mouseover, 1, 0);
luaA_dofunction(globalconf.L, globalconf.hooks.mouse_over, 1, 0);
}
else if((emwin = xembed_getbywin(globalconf.embedded, ev->event)))
xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY,

8
lua.c
View File

@ -194,9 +194,9 @@ luaA_hooks_unmanage(lua_State *L)
* \lparam A function to call each time a client gets mouse over it.
*/
static int
luaA_hooks_mouseover(lua_State *L)
luaA_hooks_mouse_over(lua_State *L)
{
return luaA_registerfct(L, 1, &globalconf.hooks.mouseover);
return luaA_registerfct(L, 1, &globalconf.hooks.mouse_over);
}
/** Set the function called on each screen arrange. This function is called
@ -559,7 +559,7 @@ luaA_init(void)
{ "unfocus", luaA_hooks_unfocus },
{ "manage", luaA_hooks_manage },
{ "unmanage", luaA_hooks_unmanage },
{ "mouseover", luaA_hooks_mouseover },
{ "mouse_over", luaA_hooks_mouse_over },
{ "arrange", luaA_hooks_arrange },
{ "titleupdate", luaA_hooks_titleupdate },
{ "urgent", luaA_hooks_urgent },
@ -624,7 +624,7 @@ luaA_init(void)
globalconf.hooks.unmanage = LUA_REFNIL;
globalconf.hooks.focus = LUA_REFNIL;
globalconf.hooks.unfocus = LUA_REFNIL;
globalconf.hooks.mouseover = LUA_REFNIL;
globalconf.hooks.mouse_over = LUA_REFNIL;
globalconf.hooks.arrange = LUA_REFNIL;
globalconf.hooks.titleupdate = LUA_REFNIL;
globalconf.hooks.urgent = LUA_REFNIL;

View File

@ -463,7 +463,7 @@ struct awesome_t
/** Command to execute when removing focus to a client */
luaA_ref unfocus;
/** Command to run when mouse is over */
luaA_ref mouseover;
luaA_ref mouse_over;
/** Command to run on arrange */
luaA_ref arrange;
/** Command to run on title change */