diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c index e98889a4..ba6bbbe6 100644 --- a/src/fe-common/core/module-formats.c +++ b/src/fe-common/core/module-formats.c @@ -37,6 +37,7 @@ FORMAT_REC fecommon_core_formats[] = { { "error_server_sticky", "Window's server is sticky and it cannot be changed without -unsticky option", 0 }, { "set_server_sticky", "Window's server set sticky", 1, { 0 } }, { "unset_server_sticky", "Window's server isn't sticky anymore", 0 }, + { "window_name_not_unique", "Window names must be unique", 1, { 0 } }, { "window_level", "Window level is now $0", 1, { 0 } }, { "windowlist_header", "Ref Name Active item Server Level", 0 }, { "windowlist_line", "$[3]0 %|$[20]1 $[15]2 $[15]3 $4", 5, { 1, 0, 0, 0, 0 } }, diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h index 2b25530f..e5e7d99b 100644 --- a/src/fe-common/core/module-formats.h +++ b/src/fe-common/core/module-formats.h @@ -14,7 +14,8 @@ enum { TXT_REFNUM_TOO_LOW, TXT_ERROR_SERVER_STICKY, TXT_SET_SERVER_STICKY, - TXT_UNSET_SERVER_STICKY, + TXT_UNSET_SERVER_STICKY, + TXT_WINDOW_NAME_NOT_UNIQUE, TXT_WINDOW_LEVEL, TXT_WINDOWLIST_HEADER, TXT_WINDOWLIST_LINE, diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 8ba83ea4..34cd3099 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -460,7 +460,12 @@ static void cmd_window_number(const char *data) /* SYNTAX: WINDOW NAME */ static void cmd_window_name(const char *data) { - window_set_name(active_win, data); + if (window_find_name(data) == NULL) + window_set_name(active_win, data); + else { + printformat_window(active_win, MSGLEVEL_CLIENTERROR, + TXT_WINDOW_NAME_NOT_UNIQUE, data); + } } /* we're moving the first window to last - move the first contiguous block