From 4c103423baa178ba01e501d575901b32a3bf45c9 Mon Sep 17 00:00:00 2001 From: "iflyun@gmail.com" Date: Sun, 12 Feb 2017 12:56:09 -0800 Subject: [PATCH] Add systray_hide_by_icon_name Exact Match, Deliminator ',' --- src/config.c | 2 ++ src/systray/systraybar.c | 18 +++++++++++++++++- src/systray/systraybar.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index e13cacd..8326280 100644 --- a/src/config.c +++ b/src/config.c @@ -1132,6 +1132,8 @@ void add_entry(char *key, char *value) systray.brightness = atoi(value3); } else if (strcmp(key, "systray_monitor") == 0) { systray_monitor = atoi(value) - 1; + } else if (strcmp(key, "systray_hide_by_icon_name") == 0) { + strcpy(systray_hide_icons, value); } /* Launcher */ diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index 23a4f5b..6954fc2 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -54,6 +54,7 @@ int systray_monitor; int chrono; int systray_composited; int systray_profile; +char systray_hide_icons[100]; // background pixmap if we render ourselves the icons static Pixmap render_background; @@ -583,6 +584,22 @@ gboolean add_icon(Window win) } } + char *name = get_window_name(win); + + // Filter out systray_hide_by_icon_name + char *token; + char *string; + string = strdup(systray_hide_icons); + if (string != NULL) { + while ((token = strsep(&string, ",")) != NULL) { + if (strcmp(token,name) == 0) { + if (strcmp(token,"") == 0) token = "empty name"; + fprintf(stderr, GREEN "filtering out '%s'\n", token); + return FALSE; + } + } + } + // Dangerous actions begin XSync(server.display, False); error = FALSE; @@ -590,7 +607,6 @@ gboolean add_icon(Window win) XSelectInput(server.display, win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask); - char *name = get_window_name(win); if (systray_profile) fprintf(stderr, "[%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __FUNCTION__, __LINE__, win, name); Panel *panel = systray.area.panel; diff --git a/src/systray/systraybar.h b/src/systray/systraybar.h index a7eba2e..413040f 100644 --- a/src/systray/systraybar.h +++ b/src/systray/systraybar.h @@ -75,6 +75,7 @@ extern gboolean systray_enabled; extern int systray_max_icon_size; extern int systray_monitor; extern gboolean systray_profile; +extern char systray_hide_icons[100]; // default global data void default_systray();