Applications are a nice way to stuff frequently used programs behind
mnemonic names, so starting them is one keybind and a few characters
away.
Labels are nice for finding windows quickly. All windows start with an
empty label.
Now, switching windows back and forth, I want to reach my application
windows most of the time, but I want to do so as quickly as spawning
them, without manually setting a label for each of them.
Diff below labels application windows with their command name, which
is the application name itself. So with the following configuration
command app "xterm -e sh -c 'something; long_to --type'"
after spawing that, `C-slash app ' navigates to it so one does
not have to search for the the window title or program name.
Does that sound useful to anyone?
Is there a better way to do it? This attempt simply stuffs the label
into screen context so it can be passed along from command to client
context.
Index: client.c
===
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.255
diff -u -p -r1.255 client.c
--- client.c7 Mar 2019 14:28:17 - 1.255
+++ client.c3 Jul 2019 20:15:51 -
@@ -67,7 +67,7 @@ client_init(Window win, struct screen_ct
cc = xmalloc(sizeof(*cc));
cc->sc = sc;
cc->win = win;
- cc->label = NULL;
+ cc->label = sc->label;
cc->gc = NULL;
cc->flags = 0;
cc->stackingorder = 0;
Index: kbfunc.c
===
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.165
diff -u -p -r1.165 kbfunc.c
--- kbfunc.c7 Mar 2019 14:28:17 - 1.165
+++ kbfunc.c3 Jul 2019 20:15:54 -
@@ -517,6 +517,7 @@ kbfunc_menu_cmd(void *ctx, struct cargs
search_match_cmd, search_print_cmd)) != NULL) {
cmd = (struct cmd_ctx *)mi->ctx;
u_spawn(cmd->path);
+ sc->label = xstrdup(cmd->name);
}
menuq_clear();
Index: screen.c
===
RCS file: /cvs/xenocara/app/cwm/screen.c,v
retrieving revision 1.93
diff -u -p -r1.93 screen.c
--- screen.c8 Mar 2019 20:33:30 - 1.93
+++ screen.c3 Jul 2019 20:15:55 -
@@ -54,6 +54,7 @@ screen_init(int which)
sc->visual = DefaultVisual(X_Dpy, sc->which);
sc->cycling = 0;
sc->hideall = 0;
+ sc->label = NULL;
conf_screen(sc);