Commit 553d6f90 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Fix ~/.fehbg creation when using --randomize or directory arguments

Closes #456

Note that --randomize and directory names are not saved in fehbg. It only
contains the command line needed to recreate the wallpaper setup which
resulted from its invocation, i.e., after randomization etc. have been
applied. This is intentional.
parent 444a28c3
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -502,16 +502,17 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
					}
					fputc(' ', fp);
					if (use_filelist) {
						for (int i = 0; i < cmdargc; i++) {
							if (filelist_pos && !strcmp(FEH_FILE(filelist_pos->data)->filename, cmdargv[i])) {
								/* argument is a file */
								absolute_path = feh_absolute_path(cmdargv[i]);
#ifdef HAVE_LIBXINERAMA
						for (int i = 0; (i < num_xinerama_screens) && filelist_pos; i++) {
#else
						for (int i = 0; (i < 1                   ) && filelist_pos; i++) {
#endif
							absolute_path = feh_absolute_path(FEH_FILE(filelist_pos->data)->filename);
							fputs(shell_escape(absolute_path), fp);
							filelist_pos = filelist_pos->next;
							free(absolute_path);
							fputc(' ', fp);
						}
						}
					} else if (fil) {
						absolute_path = feh_absolute_path(fil);
						fputs(shell_escape(absolute_path), fp);