From 4477ae4da46a5553756d368e0fe95e6ccbf1ddda Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Thu, 20 Jun 2019 21:23:55 +0100 Subject: [PATCH] Prefer TryExec to Exec when generating menu entries from XDG desktop files. From the comments at the top of wmmenugen_parse_xdg.c: Since there is no passing of file name arguments or anything of the sort to applications from the menu, execname is determined as follows: - If `TryExec' is present, use that; - else use `Exec' with any switches stripped However, Exec used to be preferred. Changed code to prefer TryExec. Signed-off-by: Jeremy Sowden --- util/wmmenugen_parse_xdg.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/util/wmmenugen_parse_xdg.c b/util/wmmenugen_parse_xdg.c index cc5cbc68..1d8975da 100644 --- a/util/wmmenugen_parse_xdg.c +++ b/util/wmmenugen_parse_xdg.c @@ -212,22 +212,23 @@ static Bool xdg_to_wm(XDGMenuEntry *xdg, WMMenuEntry *wm) if (xdg->Name) { wm->Name = xdg->Name; } else { - if (xdg->Exec) - wm->Name = wstrdup(xdg->Exec); - else /* xdg->TryExec */ + if (xdg->TryExec) wm->Name = wstrdup(xdg->TryExec); + else /* xdg->Exec */ + wm->Name = wstrdup(xdg->Exec); p = strchr(wm->Name, ' '); if (p) *p = '\0'; } - if (xdg->Exec) { + if (xdg->TryExec) + wm->CmdLine = xdg->TryExec; + else { /* xdg->Exec */ wm->CmdLine = parse_xdg_exec(xdg->Exec); if (!wm->CmdLine) return False; - } else /* xdg->TryExec */ - wm->CmdLine = xdg->TryExec; + } wm->SubMenu = xdg->Category; wm->Flags = xdg->Flags;