Skip to content

Commit

Permalink
Set $W to the absolute path.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharacternyk committed Sep 16, 2020
1 parent ae838c5 commit 2092e09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/hook/gsettings
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
hook: "S=$(xdpyinfo | grep dimensions | sed -r \"s/^[^0-9]*([0-9]+x[0-9]+).*$/\1/\");"
"convert '$W' -gravity center -background '#073642' -extent '$S' '$W';"
"gsettings set org.gnome.desktop.background picture-uri '$(realpath '$W')';"
"gsettings set org.gnome.desktop.background picture-uri '$W';"
7 changes: 6 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ int main(int argc, char **argv) {
}

if (!opts._skip_hook && opts.hook != NULL) {
setenv("W", "./pacwall.png", 1);
char *cwd = getcwd(NULL, 0);
char *w = malloc(strlen(cwd) + strlen("/pacwall.png") + 1);
stpcpy(stpcpy(w, cwd), "/pacwall.png");
free(cwd);
setenv("W", w, 1);

execlp(opts.shell, opts.shell, "-c", opts.hook, (char *)NULL);
panic("Could not execute shell %s: %s", opts.shell, strerror(errno));
}
Expand Down

0 comments on commit 2092e09

Please sign in to comment.