Commit f68160e7 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Only save background setting-related options in ~/.fehbg

This restores pre-2.21 ~/.fehbg behaviour. Replicating the entire commandline
in ~/.fehbg turned out to do more harm than good.

Closes #398
parent 0460870b
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -965,14 +965,6 @@ So to have your background restored every time you start X, you can add
.Qq ~/.fehbg &
to your X startup script
.Pq such as Pa ~/.xinitrc .
Note that
.Pq unless the wallpaper is set via the menu
.Nm
saves the files and directories it was passed on the commandline, not the
files which actually ended up as wallpaper.
So, if you have randomization enabled,
.Pa ~/.fehbg
may set different wallpapers on each execution.
.
.Pp
.
+35 −21
Original line number Diff line number Diff line
@@ -461,22 +461,8 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
					weprintf("Can't write to %s", path);
				} else {
					fputs("#!/bin/sh\n", 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]);
								fputs(shell_escape(absolute_path), fp);
								filelist_pos = filelist_pos->next;
								free(absolute_path);
							} else {
								/* argument is an option / option arg */
								fputs(shell_escape(cmdargv[i]), fp);
							}
							fputc(' ', fp);
						}
					} else if (fil) {
						fputs("feh --bg-", fp);
					fputs(cmdargv[0], fp);
					fputs(" --bg-", fp);
					if (centered)
						fputs("center", fp);
					else if (scaled)
@@ -485,14 +471,42 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
						fputs("fill", fp);
					else
						fputs("tile", fp);

						if (opt.force_aliasing)
							fputs(" --force-aliasing", fp);
#ifdef HAVE_LIBXINERAMA
						if (!opt.xinerama)
					if (opt.xinerama) {
						if (opt.xinerama_index >= 0) {
							fprintf(fp, " --xinerama-index %d", opt.xinerama_index);
						}
					}
					else {
						fputs(" --no-xinerama", fp);
#endif
					}
#endif			/* HAVE_LIBXINERAMA */
					if (opt.geom_flags & XValue) {
						fprintf(fp, " --geometry %c%d",
								opt.geom_flags & XNegative ? '-' : '+',
								opt.geom_flags & XNegative ? abs(opt.geom_x) : opt.geom_x);
						if (opt.geom_flags & YValue) {
							fprintf(fp, "%c%d",
									opt.geom_flags & YNegative ? '-' : '+',
									opt.geom_flags & YNegative ? abs(opt.geom_y) : opt.geom_y);
						}
					}
					if (opt.force_aliasing) {
						fputs(" --force-aliasing", fp);
					}
					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]);
								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);
						free(absolute_path);