Add systray_hide_by_icon_name Exact Match, Deliminator ','

This commit is contained in:
iflyun@gmail.com 2017-02-12 12:56:09 -08:00
parent f438ef712b
commit 4c103423ba
3 changed files with 20 additions and 1 deletions

View file

@ -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 */

View file

@ -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;

View file

@ -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();