Support for Path in .desktop files (fixes issue #611)

This commit is contained in:
o9000
2016-12-04 17:39:34 +01:00
parent c37d61c862
commit cd76bd311d
5 changed files with 242 additions and 18 deletions

View File

@@ -441,7 +441,8 @@ void launcher_action(LauncherIcon *icon, XEvent *evt)
// Allow children to exist after parent destruction
setsid();
// Run the command
chdir(icon->cwd);
if (icon->cwd)
chdir(icon->cwd);
execl("/bin/sh", "/bin/sh", "-c", icon->cmd, NULL);
fprintf(stderr, "Failed to execlp %s\n", icon->cmd);
#if HAVE_SN
@@ -510,11 +511,10 @@ void launcher_reload_icon(Launcher *launcher, LauncherIcon *launcherIcon)
launcherIcon->cmd = strdup(entry.exec);
if (launcherIcon->cwd)
free(launcherIcon->cwd);
if (entry.cwd) {
if (entry.cwd)
launcherIcon->cwd = strdup(entry.cwd);
} else {
launcherIcon->cwd = get_current_dir_name();
}
else
launcherIcon->cwd = NULL;
if (launcherIcon->icon_name)
free(launcherIcon->icon_name);
launcherIcon->icon_name = entry.icon ? strdup(entry.icon) : strdup(DEFAULT_ICON);