wmfs: New feature: Reload configuration function

This commit is contained in:
Martin Duquesnoy 2008-11-23 02:41:48 +01:00
parent d363754ff9
commit ac979c847b
4 changed files with 28 additions and 2 deletions

View File

@ -55,7 +55,8 @@ func_name_list_t func_list[] =
{"mouse_resize", uicb_mouse_resize },
{"client_raise", uicb_client_raise },
{"tile_switch", uicb_tile_switch },
{"toggle_free", uicb_togglefree }
{"toggle_free", uicb_togglefree },
{"reload", uicb_reload }
};
func_name_list_t layout_list[] =
@ -408,6 +409,13 @@ init_conf(void)
mouse_section(conf.titlebar.mouse, cfgtmp, conf.titlebar.nmouse);
/* layout */
/* Set conf.layout NULL for conf reload */
for(i = 0; i < NUM_OF_LAYOUT; ++i)
{
conf.layout[i].symbol = NULL;
conf.layout[i].func = NULL;
}
conf.colors.layout_fg = strdup(var_to_str(cfg_getstr(cfg_layouts, "fg")));
conf.colors.layout_bg = getcolor(var_to_str(cfg_getstr(cfg_layouts, "bg")));

View File

@ -82,7 +82,6 @@ quit(void)
/* Unmanage all clients */
for(c = clients; c; c = c->next)
{
XReparentWindow(dpy, c->win, root, c->frame_geo.x, c->frame_geo.y);
if(c->hide)
client_unhide(c);
if(c->unmapped)
@ -199,6 +198,23 @@ scan(void)
return;
}
void
uicb_reload(uicb_t cmd)
{
/* If there is a bar size changement */
bar_unmap_subwin(infobar->bar);
bar_unmap(infobar->bar);
init_conf();
init();
scan();
mainloop();
raise(SIGTERM);
return;
}
/** Signal handle function
* \param signum Signal number
*/

View File

@ -218,6 +218,7 @@ void mainloop(void);
void scan(void);
void handle_signal(int signum);
void uicb_quit(uicb_t);
void uicb_reload(uicb_t cmd);
/* Variables */

1
wmfsrc
View File

@ -96,6 +96,7 @@ client
keys
{
# general keybind
key { mod = {"Alt"} key = "r" func = "reload" }
key { mod = {"Control"} key = "Return" func = "spawn" cmd = term }
key { mod = {"Alt"} key = "q" func = "client_kill" }
key { mod = {"Control", "Alt", "Shift"} key = "q" func = "quit" }