diff --git a/src/config.c b/src/config.c index 7696088..5c94e8a 100644 --- a/src/config.c +++ b/src/config.c @@ -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"))); diff --git a/src/wmfs.c b/src/wmfs.c index ec2d245..d7993a2 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -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 */ diff --git a/src/wmfs.h b/src/wmfs.h index ddf2e57..4494434 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -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 */ diff --git a/wmfsrc b/wmfsrc index ee6ad27..04be330 100644 --- a/wmfsrc +++ b/wmfsrc @@ -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" }