mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-05 05:28:32 +00:00
Add basename support to if_running
Currently, in order to match a running process with ${if_running}, a user needs to specify the full command line plus arguments in conky.conf. This commit keeps that behavior and adds a fallback that is equivalent to the 1.9.x bevahior, namely matching against the executable name contained in /proc/<pid>/stat. This completes the fix for #121.
This commit is contained in:
parent
d8ff24a6f0
commit
99ffe6a0d6
@ -132,7 +132,10 @@ struct process *get_process_by_name(const char *name)
|
||||
struct process *p = first_process;
|
||||
|
||||
while (p) {
|
||||
if (p->name && !strcmp(p->name, name))
|
||||
/* Try matching against the full command line first. If that fails,
|
||||
* fall back to the basename.
|
||||
*/
|
||||
if ((p->name && !strcmp(p->name, name)) || (p->basename && !strcmp(p->basename, name)))
|
||||
return p;
|
||||
p = p->next;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user