summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-12-26 15:58:51 +0100
committerDave Davenport <qball@gmpclient.org>2016-12-26 15:58:51 +0100
commitee310c8470424eb6e7c35600fcbcdfbfd0324a68 (patch)
tree5d75e9f9c2bd4490ff28a3cca007b5a780b248c8
parent5a638b1fa04ab2b0a23ac4ea6fb816d25c7b2bc7 (diff)
Strip pango markup from workspace names when detecting I3.
Thanks I3 for this crap. Issue: #507
-rw-r--r--source/dialogs/window.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/dialogs/window.c b/source/dialogs/window.c
index 5b2a7a79..31c406e7 100644
--- a/source/dialogs/window.c
+++ b/source/dialogs/window.c
@@ -56,6 +56,8 @@
#define CLIENTSTATE 10
#define CLIENTWINDOWTYPE 10
+#define LOG_DOMAIN "Dialogs.Window"
+
// a manageable window
typedef struct
{
@@ -97,6 +99,7 @@ typedef struct
unsigned int title_len;
unsigned int role_len;
GRegex *window_regex;
+ gboolean i3_mode;
} ModeModePrivateData;
winlist *cache_client = NULL;
@@ -390,6 +393,16 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
int nwins = 0;
xcb_window_t wins[100];
xcb_window_t curr_win_id;
+
+ // Check if we are in I3 mode. I3 has to be special and allow markup in it window name......
+ char *i3_socket_path = window_get_text_prop ( xcb_stuff_get_root_window ( xcb ), netatoms[I3_SOCKET_PATH] );
+ if ( i3_socket_path != NULL ){
+ g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Detected I3 Window manager running.");
+ pd->i3_mode = TRUE;
+ g_free ( i3_socket_path );
+ }
+
+
// Create cache
x11_cache_create ();
@@ -470,7 +483,19 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
}
if ( c->wmdesktop != 0xFFFFFFFF ) {
if ( has_names ) {
- c->wmdesktopstr = g_strdup ( _window_name_list_entry ( names.strings, names.strings_len, c->wmdesktop ) );
+ if ( pd->i3_mode ) {
+ char *output = NULL;
+ if (pango_parse_markup ( _window_name_list_entry ( names.strings, names.strings_len,
+ c->wmdesktop ),-1, 0, NULL, &output, NULL, NULL)){
+ c->wmdesktopstr = output;
+ }
+ else {
+ c->wmdesktopstr = g_strdup ( "Invalid name");
+ }
+
+ } else {
+ c->wmdesktopstr = g_strdup ( _window_name_list_entry ( names.strings, names.strings_len, c->wmdesktop ) );
+ }
}
else {
c->wmdesktopstr = g_strdup_printf ( "%u", (uint32_t) c->wmdesktop );