diff --git a/client.c b/client.c index b5c52d4b..a31f774f 100644 --- a/client.c +++ b/client.c @@ -176,6 +176,8 @@ client_updatetitle(Client *c) { if(!xgettextprop(c->win, XInternAtom(globalconf.display, "_NET_WM_NAME", False), c->name, sizeof(c->name))) xgettextprop(c->win, XInternAtom(globalconf.display, "WM_NAME", False), c->name, sizeof(c->name)); + + widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS); } /** Ban client and unmap it @@ -419,7 +421,10 @@ client_manage(Window w, XWindowAttributes *wa, int screen) XMoveResizeWindow(globalconf.display, c->win, c->geometry.x, c->geometry.y, c->geometry.width, c->geometry.height); - focus(c, True, screen); + if(globalconf.screens[c->screen].new_get_focus) + focus(c, True, screen); + else + widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS); ewmh_update_net_client_list(phys_screen); diff --git a/config.c b/config.c index 6cc7a00c..011314d0 100644 --- a/config.c +++ b/config.c @@ -347,6 +347,7 @@ config_parse_screen(cfg_t *cfg, int screen) virtscreen->allow_lower_floats = cfg_getbool(cfg_general, "allow_lower_floats"); virtscreen->sloppy_focus = cfg_getbool(cfg_general, "sloppy_focus"); virtscreen->new_become_master = cfg_getbool(cfg_general, "new_become_master"); + virtscreen->new_get_focus = cfg_getbool(cfg_general, "new_get_focus"); virtscreen->font = XftFontOpenName(globalconf.display, phys_screen, cfg_getstr(cfg_general, "font")); @@ -481,6 +482,7 @@ config_parse(const char *confpatharg) CFG_BOOL((char *) "allow_lower_floats", cfg_false, CFGF_NONE), CFG_BOOL((char *) "sloppy_focus", cfg_true, CFGF_NONE), CFG_BOOL((char *) "new_become_master", cfg_true, CFGF_NONE), + CFG_BOOL((char *) "new_get_focus", cfg_true, CFGF_NONE), CFG_STR((char *) "font", (char *) "mono-12", CFGF_NONE), CFG_END() }; diff --git a/config.h b/config.h index c5db1ae9..63b2c85c 100644 --- a/config.h +++ b/config.h @@ -256,6 +256,8 @@ typedef struct Bool resize_hints; /** Sloppy focus: focus follow mouse */ Bool sloppy_focus; + /** Focus new clients */ + Bool new_get_focus; /** True if new clients should become master */ Bool new_become_master; /** Normal colors */ diff --git a/screen.c b/screen.c index 09cd9cff..815d5768 100644 --- a/screen.c +++ b/screen.c @@ -251,8 +251,6 @@ move_client_to_screen(Client *c, int new_screen, Bool doresize) arrange(c->screen); } } - - focus(c, True, c->screen); } /** Move mouse pointer to x_org and y_xorg of specified screen @@ -331,5 +329,6 @@ uicb_client_movetoscreen(int screen __attribute__ ((unused)), char *arg) move_mouse_pointer_to_screen(new_screen); arrange(prev_screen); arrange(new_screen); + focus(sel, True, sel->screen); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80