summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlec Cox <avlecxk@gmail.com>2021-01-28 12:46:24 -0800
committerAlec Cox <avlecxk@gmail.com>2021-01-28 12:46:24 -0800
commit31fd2f6412e3535500fef9da6164320dbbdb6bff (patch)
tree815ca8dafc92e819184323aae9fc7e0209231408 /src
parent43cb03e314513a9a9cecf6d8922146832f0c6c2b (diff)
added detection for path vs env PATH launch for use in .fehbg script gen.
Diffstat (limited to 'src')
-rw-r--r--src/wallpaper.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/wallpaper.c b/src/wallpaper.c
index 8660cde..b62d28b 100644
--- a/src/wallpaper.c
+++ b/src/wallpaper.c
@@ -258,17 +258,23 @@ void feh_wm_gen_bg_script(char* fil, int centered, int scaled, int filled, int u
FILE *fp;
int fd;
char *path;
- char *exec_absolute_path;
+ char *exec_method;
char *absolute_path;
struct stat s;
gib_list *filelist_pos = filelist;
- exec_absolute_path = feh_absolute_path(cmdargv[0]);
+
+ if (strchr(cmdargv[0], '/'))
+ exec_method = feh_absolute_path(cmdargv[0]);
+ else
+ exec_method = cmdargv[0];
+
path = estrjoin("/", home, ".fehbg", NULL);
+
if ((fp = fopen(path, "w")) == NULL) {
weprintf("Can't write to %s", path);
} else {
fputs("#!/bin/sh\n", fp);
- fputs(exec_absolute_path, fp);
+ fputs(exec_method, fp);
fputs(" --no-fehbg --bg-", fp);
if (centered)
fputs("center", fp);
@@ -334,7 +340,9 @@ void feh_wm_gen_bg_script(char* fil, int centered, int scaled, int filled, int u
fclose(fp);
}
free(path);
- free(exec_absolute_path);
+
+ if(exec_method != cmdargv[0])
+ free(exec_method);
}
void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,