On 20 September 2011 08:53, Yue Wu <[email protected]> wrote:
> Hi list,
Hello.
> Sometimes I want to know all windows that I've opened on current tag, to
> know if a window has opened and decide to find and switch to it, so my
> question is how to get a list of opened windows names on current tag? The
> statusbar shows only current focus window name.
Apply the attached patch to config.h, and include the attached C file in
dwm.c somewhere just above the function implementations.
You might have to add the prototype for list_cur_tag somewhere in your
config.h too.
If you want dwm to constantly output the current client list to a file,
you'll have to use alarm(3), threads or something similar.
Rob
void
list_cur_tag(const Arg *arg) {
Client *c;
FILE *f;
if(!arg || !arg->v || !selmon)
return;
f = fopen(arg->v, "w");
if(!f){
fprintf(stderr, "open %s: %s\n", arg->v, strerror(errno));
return;
}
for(c = selmon->clients; c; c = c->next)
if(ISVISIBLE(c))
fprintf(f, "%s\n", c->name);
fclose(f);
}
diff --git a/config.h b/config.h
index afc6bee..daa2e61 100644
--- a/config.h
+++ b/config.h
@@ -227,6 +227,8 @@ static Key keys[] = {
{ MODKEY, XK_y, incnmaster, {.i = +1 } },
{ MODKEY, XK_o, incnmaster, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_g, list_cur_tag, {.v = "/tmp/dwm_cur_tag" } },
+
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)