summaryrefslogtreecommitdiff
path: root/src/wallpaper.c
diff options
context:
space:
mode:
authorDrew DeVault <ddevault@hosting.com>2014-08-21 11:21:28 -0600
committerDrew DeVault <ddevault@hosting.com>2014-08-21 11:21:28 -0600
commit27b4aa629fe7c90e894aed718e22ef39588ae0b9 (patch)
tree02920948ccfd5f21236045fad04ed143a82b6549 /src/wallpaper.c
parent2b04e7f4bd422c015edbc8de601b6aed951b3f71 (diff)
Add shebang and set executable bit on ~/.fehbg
Diffstat (limited to 'src/wallpaper.c')
-rw-r--r--src/wallpaper.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wallpaper.c b/src/wallpaper.c
index 6e629dc..61eb1c3 100644
--- a/src/wallpaper.c
+++ b/src/wallpaper.c
@@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "options.h"
#include "wallpaper.h"
#include <limits.h>
+#include <sys/stat.h>
Window ipc_win = None;
Window my_ipc_win = None;
Atom ipc_atom = None;
@@ -450,12 +451,17 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
if (home) {
FILE *fp;
char *path;
+ struct stat s;
path = estrjoin("/", home, ".fehbg", NULL);
if ((fp = fopen(path, "w")) == NULL) {
weprintf("Can't write to %s", path);
} else {
- fprintf(fp, "%s\n", fehbg);
+ fprintf(fp, "#!/bin/bash\n%s\n", fehbg);
fclose(fp);
+ stat(path, &s);
+ if (chmod(path, s.st_mode | S_IXUSR | S_IXGRP) != 0) {
+ weprintf("Can't set %s as executable", path);
+ }
}
free(path);
}