Reload awesome on SIGHUP

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Kristof Provost 2008-07-22 10:23:07 +02:00 committed by Julien Danjou
parent 9a60abce52
commit 30aeb3f311
4 changed files with 30 additions and 11 deletions

View File

@ -207,6 +207,15 @@ exit_on_signal(EV_P_ ev_signal *w, int revents)
ev_unloop(EV_A_ 1); ev_unloop(EV_A_ 1);
} }
/** Function to restart aweome on some signals.
* \param sig the signam received, unused
*/
static void
restart_on_signal(EV_P_ ev_signal *w, int revents)
{
ewmh_restart();
}
/** \brief awesome xerror function. /** \brief awesome xerror function.
* There's no way to check accesses to destroyed windows, thus those cases are * There's no way to check accesses to destroyed windows, thus those cases are
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs * ignored (especially on UnmapNotify's). Other types of errors call Xlibs
@ -336,8 +345,8 @@ main(int argc, char **argv)
/* register function for signals */ /* register function for signals */
ev_signal_init(&sigint, exit_on_signal, SIGINT); ev_signal_init(&sigint, exit_on_signal, SIGINT);
ev_signal_init(&sigterm, &exit_on_signal, SIGTERM); ev_signal_init(&sigterm, exit_on_signal, SIGTERM);
ev_signal_init(&sighup, &exit_on_signal, SIGHUP); ev_signal_init(&sighup, restart_on_signal, SIGHUP);
ev_signal_start(globalconf.loop, &sigint); ev_signal_start(globalconf.loop, &sigint);
ev_signal_start(globalconf.loop, &sigterm); ev_signal_start(globalconf.loop, &sigterm);
ev_signal_start(globalconf.loop, &sighup); ev_signal_start(globalconf.loop, &sighup);

17
ewmh.c
View File

@ -555,4 +555,21 @@ ewmh_get_window_icon(xcb_window_t w)
return icon; return icon;
} }
/**
* Restart awesome.
*/
void
ewmh_restart(void)
{
client_t *c;
for(c = globalconf.clients; c; c = c->next)
client_unban(c);
xcb_aux_sync(globalconf.connection);
xcb_disconnect(globalconf.connection);
a_exec(globalconf.argv);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

1
ewmh.h
View File

@ -42,6 +42,7 @@ void ewmh_update_net_client_list_stacking(int);
void ewmh_check_client_hints(client_t *); void ewmh_check_client_hints(client_t *);
void ewmh_update_workarea(int); void ewmh_update_workarea(int);
netwm_icon_t * ewmh_get_window_icon(xcb_window_t); netwm_icon_t * ewmh_get_window_icon(xcb_window_t);
void ewmh_restart(void);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

10
lua.c
View File

@ -122,15 +122,7 @@ luaA_exec(lua_State *L)
static int static int
luaA_restart(lua_State *L __attribute__ ((unused))) luaA_restart(lua_State *L __attribute__ ((unused)))
{ {
client_t *c; ewmh_restart();
for(c = globalconf.clients; c; c = c->next)
client_unban(c);
xcb_aux_sync(globalconf.connection);
xcb_disconnect(globalconf.connection);
a_exec(globalconf.argv);
return 0; return 0;
} }