Attached is an updated version of a patch that adds a 'titlechanged'
hook for when the current window's title changes, suitable for keeping
the current window's title in a dzen status bar. The old one didn't
work against the current source (since the newwindow hook was
committed); this one also includes an appropriate doc patch.
diff --git doc/ratpoison.texi doc/ratpoison.texi
index 9bfe8b9..7d9adfd 100644
--- doc/ratpoison.texi
+++ doc/ratpoison.texi
@@ -1269,6 +1269,8 @@ Run when the user switches to a different group.
Run when a window is deleted.
@item newwindow
Run after a new window is mapped.
+...@item titlechanged
+Run when the current window's title changes.
@item quit
Run when ratpoison exits.
@item restart
diff --git src/actions.c src/actions.c
index dabb8e5..b3baadb 100644
--- src/actions.c
+++ src/actions.c
@@ -1407,6 +1407,7 @@ cmd_rename (int interactive UNUSED, struct cmdarg **args)
free (current_window()->user_name);
current_window()->user_name = xstrdup (ARG_STRING(0));
current_window()->named = 1;
+ hook_run (&rp_title_changed_hook);
/* Update the program bar. */
update_window_names (current_screen(), defaults.window_fmt);
diff --git src/events.c src/events.c
index d973639..6a229b8 100644
--- src/events.c
+++ src/events.c
@@ -624,8 +624,10 @@ property_notify (XEvent *ev)
{
case XA_WM_NAME:
PRINT_DEBUG (("updating window name\n"));
- if (update_window_name (win))
+ if (update_window_name (win)) {
update_window_names (win->scr, defaults.window_fmt);
+ hook_run (&rp_title_changed_hook);
+ }
break;
case XA_WM_NORMAL_HINTS:
diff --git src/globals.c src/globals.c
index eb94db6..3029aef 100644
--- src/globals.c
+++ src/globals.c
@@ -232,6 +232,7 @@ LIST_HEAD (rp_quit_hook);
LIST_HEAD (rp_restart_hook);
LIST_HEAD (rp_delete_window_hook);
LIST_HEAD (rp_new_window_hook);
+LIST_HEAD (rp_title_changed_hook);
struct rp_hook_db_entry rp_hook_db[]=
{{"key", &rp_key_hook},
@@ -243,6 +244,7 @@ struct rp_hook_db_entry rp_hook_db[]=
{"quit", &rp_quit_hook},
{"restart", &rp_restart_hook},
{"newwindow", &rp_new_window_hook},
+ {"titlechanged", &rp_title_changed_hook},
{NULL, NULL}};
void
diff --git src/globals.h src/globals.h
index aa73451..e5ba32a 100644
--- src/globals.h
+++ src/globals.h
@@ -182,6 +182,7 @@ extern struct list_head rp_delete_window_hook;
extern struct list_head rp_quit_hook;
extern struct list_head rp_restart_hook;
extern struct list_head rp_new_window_hook;
+extern struct list_head rp_title_changed_hook;
extern struct rp_hook_db_entry rp_hook_db[];
_______________________________________________
Ratpoison-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/ratpoison-devel