summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZed Lopez <zed.lopez@gmail.com>2010-05-18 09:06:26 -0700
committerShawn Betts <sabetts@Woaaahdudelike.local>2010-05-18 11:29:09 -0700
commitc48f75e86aea05a8b09a9e52eebe202ac2e84c3c (patch)
treed8b132368e81287193d41f764754d6c921b5c1f2
parent7ca1af7c055d435888f1c5e3dd02f1456334c599 (diff)
downloadratpoison-c48f75e86aea05a8b09a9e52eebe202ac2e84c3c.zip
add a titlechanged hook
-rw-r--r--doc/ratpoison.texi2
-rw-r--r--src/actions.c1
-rw-r--r--src/events.c4
-rw-r--r--src/globals.c2
-rw-r--r--src/globals.h1
5 files changed, 9 insertions, 1 deletions
diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi
index 9bfe8b9..7d9adfd 100644
--- a/doc/ratpoison.texi
+++ b/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 a/src/actions.c b/src/actions.c
index dabb8e5..b3baadb 100644
--- a/src/actions.c
+++ b/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 a/src/events.c b/src/events.c
index d973639..6a229b8 100644
--- a/src/events.c
+++ b/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 a/src/globals.c b/src/globals.c
index eb94db6..3029aef 100644
--- a/src/globals.c
+++ b/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 a/src/globals.h b/src/globals.h
index aa73451..e5ba32a 100644
--- a/src/globals.h
+++ b/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[];