Parse the title_format and display the customized window title if a format was set.

The format string set with "title_format" can contain the placeholder "%title" which will be replaced with the actual window title.

By not overwriting window->name itself, we make sure that assignment matching still works as expected.

fixes #1723
This commit is contained in:
Ingo Bürk
2015-06-10 19:01:05 +02:00
parent 55e8d06ee4
commit 5a8d66a1d5
6 changed files with 103 additions and 2 deletions

View File

@ -13,6 +13,10 @@
#include <stdlib.h>
#include <string.h>
#if PANGO_SUPPORT
#include <glib.h>
#endif
#include "libi3.h"
struct _i3String {
@ -185,6 +189,18 @@ void i3string_set_markup(i3String *str, bool is_markup) {
str->is_markup = is_markup;
}
/*
* Escape pango markup characters in the given string.
*/
i3String *i3string_escape_markup(i3String *str) {
#if PANGO_SUPPORT
const char *text = i3string_as_utf8(str);
return i3string_from_utf8(g_markup_escape_text(text, -1));
#else
return str;
#endif
}
/*
* Returns the number of glyphs in an i3String.
*