all repos — tint2 @ d21507cd4b0a9fe65fd9262dae7cdf654b4ede3a

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

Add support for Path in .desktop files
Mike Messmore mike@messmore.org
commit

d21507cd4b0a9fe65fd9262dae7cdf654b4ede3a

parent

48078ffb2550e67c38d70c6cd99b376158e26f84

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

@@ -110,7 +110,7 @@ }

gboolean read_desktop_file_full_path(const char *path, DesktopEntry *entry) { - entry->name = entry->generic_name = entry->icon = entry->exec = NULL; + entry->name = entry->generic_name = entry->icon = entry->exec = entry->cwd = NULL; entry->hidden_from_menus = FALSE; FILE *fp = fopen(path, "rt");

@@ -185,6 +185,8 @@ }

} } else if (!entry->exec && strcmp(key, "Exec") == 0) { entry->exec = strdup(value); + } else if (!entry->cwd && strcmp(key, "Path") == 0) { + entry->cwd = strdup(value); } else if (!entry->icon && strcmp(key, "Icon") == 0) { entry->icon = strdup(value); } else if (strcmp(key, "NoDisplay") == 0) {
M src/launcher/apps-common.hsrc/launcher/apps-common.h

@@ -15,6 +15,7 @@ char *generic_name;

char *exec; char *icon; char *path; + char *cwd; gboolean hidden_from_menus; } DesktopEntry;
M src/launcher/launcher.csrc/launcher/launcher.c

@@ -441,6 +441,7 @@ #endif // HAVE_SN

// Allow children to exist after parent destruction setsid(); // Run the command + chdir(icon->cwd); execl("/bin/sh", "/bin/sh", "-c", icon->cmd, NULL); fprintf(stderr, "Failed to execlp %s\n", icon->cmd); #if HAVE_SN

@@ -507,6 +508,13 @@ schedule_redraw(&launcherIcon->area);

if (launcherIcon->cmd) free(launcherIcon->cmd); launcherIcon->cmd = strdup(entry.exec); + if (launcherIcon->cwd) + free(launcherIcon->cwd); + if (entry.cwd) { + launcherIcon->cwd = strdup(entry.cwd); + } else { + launcherIcon->cwd = get_current_dir_name(); + } if (launcherIcon->icon_name) free(launcherIcon->icon_name); launcherIcon->icon_name = entry.icon ? strdup(entry.icon) : strdup(DEFAULT_ICON);
M src/launcher/launcher.hsrc/launcher/launcher.h

@@ -28,6 +28,7 @@ Imlib_Image image;

Imlib_Image image_hover; Imlib_Image image_pressed; char *cmd; + char *cwd; char *icon_name; char *icon_path; char *icon_tooltip;