Hi, I like to enumerate my windows so that I can quickly jump to any one of them using hotkeys. I also like to keep every window's enumerated id in the title bar for easy visual access. To this end, I'd like to submit the follwing patch. It adds a command "WindowNameSuffix", which given a window id and text string will set up this text string as a fixed suffix that will always appear in the titlebar of the given window.
I'm not sure if this ought to be generalized more; i.e let the given string be a sprintf pattern where %s is expanded to the application- set window title or something. I'll be happy to make alterations that make the patch more acceptable. Arne. (The patch is against 2.5.8, but applies to 2.5.9 as well with only a minimum of fuzz.)
diff -ru fvwm-2.5.8/fvwm/add_window.c fvwm-2.5.8-new/fvwm/add_window.c --- fvwm-2.5.8/fvwm/add_window.c Fri Oct 24 18:37:08 2003 +++ fvwm-2.5.8-new/fvwm/add_window.c Wed Nov 12 10:33:35 2003 @@ -1521,6 +1521,17 @@ ext_name = name; } + if (fw->name_suffix) { + char *suf_name; + len = strlen(ext_name) + strlen(fw->name_suffix) + 1; + suf_name = (char *)safemalloc(len); + strcpy(suf_name, ext_name); + strcat(suf_name, fw->name_suffix); + if (ext_name != name) + free(ext_name); + ext_name = suf_name; + } + if (is_icon) { fw->visible_icon_name = ext_name; diff -ru fvwm-2.5.8/fvwm/commands.h fvwm-2.5.8-new/fvwm/commands.h --- fvwm-2.5.8/fvwm/commands.h Wed Jul 16 11:10:40 2003 +++ fvwm-2.5.8-new/fvwm/commands.h Wed Nov 12 10:34:41 2003 @@ -183,6 +183,7 @@ F_UPDATE_DECOR, F_WARP, F_WINDOWID, + F_WINDOWNAMESUFFIX, F_WINDOW_SHADE, F_WINDOW_STYLE, @@ -373,6 +374,7 @@ P(WindowFont); P(WindowId); P(WindowList); +P(WindowNameSuffix); P(WindowShade); P(WindowShadeAnimate); P(WindowStyle); diff -ru fvwm-2.5.8/fvwm/functable.c fvwm-2.5.8-new/fvwm/functable.c --- fvwm-2.5.8/fvwm/functable.c Wed Jul 16 11:10:40 2003 +++ fvwm-2.5.8-new/fvwm/functable.c Wed Nov 12 10:33:35 2003 @@ -617,6 +617,10 @@ CMD_ENT("windowlist", CMD_WindowList, F_WINDOWLIST, 0, 0), /* - Display the window list as a menu to select a window */ + CMD_ENT("windownamesuffix", CMD_WindowNameSuffix, F_WINDOWNAMESUFFIX, + FUNC_NEEDS_WINDOW, CRS_SELECT), + /* - Set name suffix for window */ + CMD_ENT("windowshade", CMD_WindowShade, F_WINDOW_SHADE, FUNC_NEEDS_WINDOW, CRS_SELECT), /* - Shade/unshade a window */ diff -ru fvwm-2.5.8/fvwm/fvwm.h fvwm-2.5.8-new/fvwm/fvwm.h --- fvwm-2.5.8/fvwm/fvwm.h Wed Sep 24 11:15:20 2003 +++ fvwm-2.5.8-new/fvwm/fvwm.h Wed Nov 12 10:33:35 2003 @@ -618,6 +618,7 @@ char *visible_icon_name; int name_count; int icon_name_count; + char *name_suffix; /* next fvwm window */ struct FvwmWindow *next; /* prev fvwm window */ diff -ru fvwm-2.5.8/fvwm/update.c fvwm-2.5.8-new/fvwm/update.c --- fvwm-2.5.8/fvwm/update.c Thu Aug 14 10:48:20 2003 +++ fvwm-2.5.8-new/fvwm/update.c Wed Nov 12 10:33:35 2003 @@ -752,3 +752,33 @@ return; } + +void CMD_WindowNameSuffix(F_CMD_ARGS) +{ + char *name; + FvwmWindow *fw = exc->w.fw; + window_style style; + update_win flags; + + + /* parse style name */ + name = PeekToken(action, &action); + + /* in case there was no argument! */ + if (name == NULL) + return; + + if (fw->name_suffix) + free(fw->name_suffix); + + fw->name_suffix = safestrdup(name); + /* setup_visible_name(fw, False); */ + + lookup_style(fw, &style); + memset(&flags, 0, sizeof(flags)); + flags.do_update_visible_window_name = True; + flags.do_redecorate = True; + apply_window_updates(fw, &flags, &style, get_focus_window()); + + return; +}