From 9ffb418ac2a43ed0f76af84cb3269ab4d244e12b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 19 Aug 2017 10:18:14 +0200 Subject: Save --geometry flags in .fehbg if specified (closes #313) --- src/wallpaper.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/wallpaper.c') 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; -- cgit v1.2.3