summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-08-19 10:18:14 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-08-19 10:18:14 +0200
commit9ffb418ac2a43ed0f76af84cb3269ab4d244e12b (patch)
tree648aefd410c1cf264bc3aff4729393c61a9acdb2
parent19655b459dd99d31d05b43c4c68cd755bfe30d95 (diff)
Save --geometry flags in .fehbg if specified (closes #313)
-rw-r--r--src/wallpaper.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/wallpaper.c b/src/wallpaper.c
index 93994b3..41f2b55 100644
--- a/src/wallpaper.c
+++ b/src/wallpaper.c
@@ -300,6 +300,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
char *fehbg = NULL;
char fehbg_args[512];
fehbg_args[0] = '\0';
+ char *argptr = fehbg_args;
char *home;
char filbuf[4096];
char *bgfill = NULL;
@@ -308,13 +309,26 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
#ifdef HAVE_LIBXINERAMA
if (opt.xinerama) {
if (opt.xinerama_index >= 0) {
- snprintf(fehbg_args, sizeof(fehbg_args),
+ snprintf(argptr, sizeof(fehbg_args),
"--xinerama-index %d", opt.xinerama_index);
}
}
else
- snprintf(fehbg_args, sizeof(fehbg_args), "--no-xinerama");
+ snprintf(argptr, sizeof(fehbg_args), "--no-xinerama");
+ argptr += strlen(argptr);
#endif /* HAVE_LIBXINERAMA */
+ if ((opt.geom_flags & XValue) && (sizeof(fehbg_args) - strlen(fehbg_args) > 20)) {
+ snprintf(argptr, sizeof(fehbg_args) - strlen(fehbg_args), " --geometry %c%d",
+ opt.geom_flags & XNegative ? '-' : '+',
+ opt.geom_flags & XNegative ? abs(opt.geom_x) : opt.geom_x);
+ argptr += strlen(argptr);
+ if (opt.geom_flags & YValue) {
+ snprintf(argptr, sizeof(fehbg_args) - strlen(fehbg_args), "%c%d",
+ opt.geom_flags & YNegative ? '-' : '+',
+ opt.geom_flags & YNegative ? abs(opt.geom_y) : opt.geom_y);
+ argptr += strlen(argptr);
+ }
+ }
/* local display to set closedownmode on */
Display *disp2;