add new UICB: uicb_focus_client_byname

This commit is contained in:
Julien Danjou 2007-12-23 16:16:02 +01:00
parent d5d9439777
commit 58a3c0c494
5 changed files with 26 additions and 0 deletions

View File

@ -147,6 +147,18 @@ get_client_bywin(Client *list, Window w)
return c;
}
Client *
get_client_byname(Client *list, char *name)
{
Client *c;
for(c = list; c; c = c->next)
if(strstr(c->name, name))
return c;
return NULL;
}
void
client_updatetitle(Client *c)
{

View File

@ -26,6 +26,7 @@
Bool client_isvisible(Client *, int);
Client * get_client_bywin(Client *, Window);
Client * get_client_byname(Client *, char *);
void client_attach(Client *);
void client_detach(Client *);
void client_ban(Client *);

11
focus.c
View File

@ -133,4 +133,15 @@ uicb_focus_history(int screen, char *arg)
}
}
void
uicb_focus_client_byname(int screen, char *arg)
{
Client *c;
Tag *curtag = get_current_tag(screen);
if(arg && (c = get_client_byname(globalconf.clients, arg))
&& is_client_tagged(c, curtag, screen))
focus(c, True, screen);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -29,6 +29,7 @@ void focus_delete_client(Client *);
Client * focus_get_latest_client_for_tag(int, Tag *);
UICB_PROTO(uicb_focus_history);
UICB_PROTO(uicb_focus_client_byname);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

1
uicb.c
View File

@ -80,6 +80,7 @@ const NameFuncLink UicbList[] =
{"client_resizemouse", uicb_client_resizemouse},
/* focus.c */
{"focus_history", uicb_focus_history},
{"focus_client_byname", uicb_focus_client_byname},
/* widgets.c */
{"widget_tell", uicb_widget_tell},
{NULL, NULL}