summaryrefslogtreecommitdiff
path: root/src/wallpaper.c
AgeCommit message (Collapse)AuthorLines
2021-01-26added early exit condition as per Ferada's suggestionAlec Cox-72/+73
2021-01-25Removed unused variable.Alec Cox-2/+0
2021-01-25absolute file path for .fehbg, moved script creation into helper functionAlec Cox-82/+92
2021-01-22fixed for simpler parenthesis matchingAlec Cox-2/+3
2020-04-11update copyrightDaniel Friesel-1/+1
2019-07-22Use --no-fehbg in .fehbg commandlineDaniel Friesel-1/+1
This ensures that X11 layout or other changes do not affect the .fehbg contents, which are meant to only be updated when a --bg-option is used manually. Closes #482
2019-07-12Check stat for error before setting permissions.Tobias Stoeckmann-3/+4
When setting wallpapers without --no-fehbg option, a ~/.fehbg file is created. This file is set to be an executable for later re-use. Calling stat() without checking the return value can lead to issues. If the call fails, then s.st_mode is undefined and excessive permissions could be set to .fehbg, at worst even setuid/setgid bits for a world writable file. While adjusting this, I changed the code to use fstat() and fchmod() to avoid a further -- but very unlikely -- issue: race condition in form of TOCTOU. If the file ~/.fehsetbg is replaced by a symlink right before the chmod call, then a different file would be set executable + the default mode of the (newly created) file. I don't expect this to be a real world issue but changed this part "while at it" anyway for more robust code and a good example on how to handle files. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-02-14Do not omit filenames in ~/.fehbg when using --no-xinerama (#456)Daniel Friesel-1/+1
2019-02-08Fix ~/.fehbg creation when using --randomize or directory argumentsDaniel Friesel-9/+10
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.
2018-10-17Use random() instead of rand() to increase portabilityDaniel Friesel-1/+1
Quoting glibc rand(3): The versions of rand() and srand() in the Linux C Library use the same random number generator as random(3) and srandom(3), so the lower-order bits should be as random as the higher-order bits. However, on older rand() implementations, and on current implementations on different systems, the lower-order bits are much less random than the higher-order bits. Do not use this function in applications intended to be portable when good randomness is needed. (Use random(3) instead.)
2018-06-10fix .fehbg output for --bg-maxSebastian Bickerle-1/+3
2018-05-16properly escape image-bg argument in ~/.fehbgDaniel Friesel-1/+1
Closes #400
2018-05-11Update copyright noticeDaniel Friesel-1/+1
2018-05-10Save image-bg setting in ~/.fehbgDaniel Friesel-0/+4
2018-05-10Only save background setting-related options in ~/.fehbgDaniel Friesel-21/+35
This restores pre-2.21 ~/.fehbg behaviour. Replicating the entire commandline in ~/.fehbg turned out to do more harm than good. Closes #398
2018-04-18Always save absolute paths in ~/fehbg (closes #389)Daniel Friesel-2/+15
2018-02-28Respect --geometry in --bg-fill (closes #209)Daniel Friesel-1/+26
2018-02-27Handle transparency when setting background imagesDaniel Friesel-4/+4
2018-02-27Merge branch 'custom-background-color' of https://github.com/ulteq/feh into ↵Daniel Friesel-17/+12
ulteq-custom-background-color
2018-01-29Include system headers before local ones to fix type conflict on OpenBSDDaniel Friesel-2/+4
2018-01-17Allow any XColor values as --image-bg argumentPaul O'Day-17/+12
2017-11-07Fix ~/.fehbg no longer being source-able (closes #342)2.22.1Daniel Friesel-1/+1
2017-11-01wallpaper.c: Remove unused variableDaniel Friesel-2/+0
2017-11-01Fix ~/.fehbg not being updated when setting wallpaper via menuDaniel Friesel-44/+25
2017-10-03Always save user-provided commandline in ~/.fehbgDaniel Friesel-41/+7
This fixes --force-aliasing (and possibly other options) missing from the file.
2017-09-16Replace legacy signal(...) call with sigaction(...)Daniel Friesel-6/+22
2017-08-21Release v2.19.32.19.3Daniel Friesel-1/+1
2017-08-19Save --geometry flags in .fehbg if specified (closes #313)Daniel Friesel-2/+16
2017-03-23Fix double-free/OOB-write while receiving IPC dataTobias Stoeckmann-1/+1
If a malicious client pretends to be the E17 window manager, it is possible to trigger an out of boundary heap write while receiving an IPC message. The length of the already received message is stored in an unsigned short, which overflows after receiving 64 KB of data. It's comparably small amount of data and therefore achievable for an attacker. When len overflows, realloc() will either be called with a small value and therefore chars will be appended out of bounds, or len + 1 will be exactly 0, in which case realloc() behaves like free(). This could be abused for a later double-free attack as it's even possible to overwrite the free information -- but this depends on the malloc implementation. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2016-05-02always initialize data_root and data_esetrootDaniel Friesel-1/+1
2016-05-01src/wallpaper.c: free up some data allocated by X.Daniel Lockyer-0/+7
The if statements are needed because we cannot pass a NULL pointer to XFree.
2015-06-26adjust coding style in patch, always free gc, coherent HAVE_LIBXINERAMA wrappingDaniel Friesel-36/+24
2015-06-22support background setter for specific screenJames Knight-20/+77
The following adds the ability, when using `feh` as a background setter, to use a specific Xinerama screen to render a provided image. Along with the provided '--bg-*' option, the '--xinerama-index' argument will be used to identify the index of the detected Xinerama screen to use. Signed-off-by: James Knight <james.d.knight@live.com>
2015-06-22ensure fehbg is free'edJames Knight-1/+2
The 'fehbg' variable can be allocated whether or not the user wishes to generated a fehbg file. Ensure the variable is free'ed before we return. Signed-off-by: James Knight <james.d.knight@live.com>
2014-08-21Swap bash for shDrew DeVault-1/+1
2014-08-21Add shebang and set executable bit on ~/.fehbgDrew DeVault-1/+7
2014-05-22wallpaper.c: Handle missing HOMEDaniel Friesel-0/+10
2014-05-11wallpaper.c: remove dead code snippetDaniel Friesel-1/+0
2014-02-27always use absolute paths in .fehbgDaniel Friesel-1/+5
2013-09-26Support geometry in --bg-max and --bg-centerJoel Bradshaw-4/+34
Overloads the --geometry option for wallpaper setting Currently only supports the two options that result in black borders, --bg-max and --bg-center. For both, if a geometry offset is specified (w/h is ignored), the image will be offset the specified pixels from the screen edge Left side for + numbers, right side for -. +/-0 will align at the edge of the screen.
2012-12-04--bg-max: Respect --image-bg settingDaniel Friesel-6/+3
2012-10-17Add --image-bg option for wallpaper borderRob Cornish-3/+12
Previously feh would set a black background around wallpaper images, with no option to change. This commit extends the functionality offered by the --image-bg option, which is available for regular image viewing, to centered and max'ed feh backgrounds. Essentially, this means a white border can now be chosen in addition to a black one.
2011-11-03Chaning the name of the option to suppress .fehbgFelix Crux-1/+1
2011-11-03Adds an option --bg-no-bgfile that prevents the writing of a ~/.fehbg file.Felix Crux-1/+1
2011-10-10Code cleanupDaniel Friesel-18/+26
2011-09-28feh_wm_set_bg: .fehbg: Do not overflow filbuf by writing too many filenamesDaniel Friesel-1/+1
2011-09-26Add support for multiple files in --bg-options (closes #64)Daniel Friesel-131/+198
Squashed commit of the following: commit 55e66e15af898f4c01d7d265013124fefce795e4 Author: Daniel Friesel <derf@finalrewind.org> Date: Mon Sep 26 19:59:46 2011 +0200 Save all filenames in ~/.fehbg commit afc2774f315fc379aa96de58decf8370772036af Author: Daniel Friesel <derf@finalrewind.org> Date: Mon Sep 26 19:24:38 2011 +0200 Update test/bg --bg-fill images (off-by-one due to changed implementation) commit bd4210cff2e895414df12868f6cab7f193c5adf5 Author: Daniel Friesel <derf@finalrewind.org> Date: Mon Sep 26 14:47:00 2011 +0200 Fix feh_wm_set_bg_maxed commit d9ada9dc2a74aef6ae0924e9c0ff296b94ee25bc Author: Daniel Friesel <derf@finalrewind.org> Date: Mon Sep 26 14:39:11 2011 +0200 Fix for non-xinerama setups commit be2cf0f1f8c00b737e7141a372d3cbc9db4c949f Author: Daniel Friesel <derf@finalrewind.org> Date: Mon Sep 26 14:24:44 2011 +0200 Move wallpaper calculation code into separate functions commit 4e07c1f9734569fdd778a813c5a85c63b51b3175 Author: Daniel Friesel <derf@finalrewind.org> Date: Mon Sep 26 13:01:46 2011 +0200 Remove unnecessary temporary variable commit 23d1d733b21d1560e1fbcadddc34cae3d666b21d Author: Daniel Friesel <derf@finalrewind.org> Date: Mon Sep 26 12:46:25 2011 +0200 Initial conversion, works with --bg-scale
2011-09-03Rename support.c to wallpaper.cDaniel Friesel-0/+681