mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 16:06:37 +01:00
Allow to set relative path for wallpapers in config
This commit is contained in:
parent
db0e1d6bc1
commit
500ee0a731
1 changed files with 11 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -1551,6 +1552,13 @@ static struct cmd_results *cmd_output(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_INVALID, "output", "Invalid syntax (%s)", src);
|
return cmd_results_new(CMD_INVALID, "output", "Invalid syntax (%s)", src);
|
||||||
}
|
}
|
||||||
src = p.we_wordv[0];
|
src = p.we_wordv[0];
|
||||||
|
if (config->reading && *src != '/') {
|
||||||
|
char *conf = strdup(config->current_config);
|
||||||
|
char *conf_path = dirname(conf);
|
||||||
|
src = malloc(strlen(conf_path) + strlen(src) + 2);
|
||||||
|
sprintf(src, "%s/%s", conf_path, p.we_wordv[0]);
|
||||||
|
free(conf);
|
||||||
|
}
|
||||||
if (access(src, F_OK) == -1) {
|
if (access(src, F_OK) == -1) {
|
||||||
return cmd_results_new(CMD_INVALID, "output", "Background file unreadable (%s)", src);
|
return cmd_results_new(CMD_INVALID, "output", "Background file unreadable (%s)", src);
|
||||||
}
|
}
|
||||||
|
@ -1569,6 +1577,9 @@ static struct cmd_results *cmd_output(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
output->background = strdup(src);
|
output->background = strdup(src);
|
||||||
output->background_option = strdup(mode);
|
output->background_option = strdup(mode);
|
||||||
|
if (src != p.we_wordv[0]) {
|
||||||
|
free(src);
|
||||||
|
}
|
||||||
wordfree(&p);
|
wordfree(&p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue