all repos — tint2 @ 734af1c0253eefad4486cd8dbc907141032f48ff

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

tint2conf: Do not load desktop files marked as NoDisplay
o9000 mrovi9000@gmail.com
commit

734af1c0253eefad4486cd8dbc907141032f48ff

parent

1000cbf4914a0babf5d6a72831b484899d63d7d3

3 files changed, 13 insertions(+), 4 deletions(-)

jump to
M src/launcher/apps-common.csrc/launcher/apps-common.c

@@ -54,8 +54,8 @@ // %c -> Name

// %k -> path if (entry->exec) { char *exec2 = calloc(strlen(entry->exec) + (entry->name ? strlen(entry->name) : 1) + - (entry->icon ? strlen(entry->icon) : 1) + 100, - 1); + (entry->icon ? strlen(entry->icon) : 1) + 100, + 1); char *p, *q; // p will never point to an escaped char for (p = entry->exec, q = exec2; *p; p++, q++) {

@@ -112,13 +112,14 @@ int i;

entry->path = strdup(path); entry->name = entry->icon = entry->exec = NULL; + entry->hidden_from_menus = FALSE; if ((fp = fopen(path, "rt")) == NULL) { fprintf(stderr, "Could not open file %s\n", path); return 0; } - const gchar **languages = (const gchar **)g_get_language_names(); + const gchar **languages = (const gchar **)g_get_language_names(); // lang_index is the index of the language for the best Name key in the language vector // lang_index_default is a constant that encodes the Name key without a language int lang_index, lang_index_default;

@@ -165,6 +166,8 @@ } else if (!entry->exec && strcmp(key, "Exec") == 0) {

entry->exec = strdup(value); } else if (!entry->icon && strcmp(key, "Icon") == 0) { entry->icon = strdup(value); + } else if (!entry->icon && strcmp(key, "NoDisplay") == 0) { + entry->hidden_from_menus = strcasecmp(value, "true") == 0; } } }

@@ -205,7 +208,8 @@ return apps_locations;

apps_locations = load_locations_from_env(apps_locations, "XDG_DATA_HOME", "applications", NULL); - apps_locations = g_slist_append(apps_locations, g_build_filename(g_get_home_dir(), ".local/share/applications", NULL)); + apps_locations = + g_slist_append(apps_locations, g_build_filename(g_get_home_dir(), ".local/share/applications", NULL)); apps_locations = load_locations_from_env(apps_locations, "XDG_DATA_DIRS", "applications", NULL);
M src/launcher/apps-common.hsrc/launcher/apps-common.h

@@ -14,6 +14,7 @@ char *name;

char *exec; char *icon; char *path; + gboolean hidden_from_menus; } DesktopEntry; // Parses a line of the form "key = value". Modifies the line.
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -2367,6 +2367,10 @@ {

DesktopEntry *entry = calloc(1, sizeof(DesktopEntry)); if (!read_desktop_file(file, entry)) printf("Could not load %s\n", file); + if (entry->hidden_from_menus) { + free(entry); + return; + } if (!entry->name) entry->name = strdup(file); if (!entry->icon)