mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 01:11:28 +00:00
Use default black background if no wallpaper is specified
Fixes: https://github.com/SirCmpwn/sway/issues/865
This commit is contained in:
parent
f99992a8ae
commit
4c32212ada
|
@ -247,6 +247,9 @@ struct sway_config {
|
|||
int32_t floating_maximum_height;
|
||||
int32_t floating_minimum_width;
|
||||
int32_t floating_minimum_height;
|
||||
|
||||
char *default_background;
|
||||
char *default_background_option;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -196,6 +196,8 @@ void free_config(struct sway_config *config) {
|
|||
free(config->floating_scroll_down_cmd);
|
||||
free(config->floating_scroll_left_cmd);
|
||||
free(config->floating_scroll_right_cmd);
|
||||
free(config->default_background);
|
||||
free(config->default_background_option);
|
||||
free(config);
|
||||
}
|
||||
|
||||
|
@ -299,6 +301,9 @@ static void config_defaults(struct sway_config *config) {
|
|||
config->border_colors.placeholder.child_border = 0x0C0C0CFF;
|
||||
|
||||
config->border_colors.background = 0xFFFFFFFF;
|
||||
|
||||
config->default_background = strdup("#000000");
|
||||
config->default_background_option = strdup("solid_color");
|
||||
}
|
||||
|
||||
static int compare_modifiers(const void *left, const void *right) {
|
||||
|
@ -859,7 +864,7 @@ void apply_input_config(struct input_config *ic, struct libinput_device *dev) {
|
|||
}
|
||||
|
||||
void apply_output_config(struct output_config *oc, swayc_t *output) {
|
||||
if (oc->enabled == 0) {
|
||||
if (oc && oc->enabled == 0) {
|
||||
destroy_output(output);
|
||||
return;
|
||||
}
|
||||
|
@ -911,30 +916,31 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
|
|||
}
|
||||
}
|
||||
|
||||
if (oc && oc->background) {
|
||||
if (output->bg_pid != 0) {
|
||||
terminate_swaybg(output->bg_pid);
|
||||
}
|
||||
char *bg = oc && oc->background ? oc->background : config->default_background;
|
||||
char *bg_option = oc && oc->background_option ? oc->background_option : config->default_background_option;
|
||||
|
||||
sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background);
|
||||
if (output->bg_pid != 0) {
|
||||
terminate_swaybg(output->bg_pid);
|
||||
}
|
||||
|
||||
size_t bufsize = 4;
|
||||
char output_id[bufsize];
|
||||
snprintf(output_id, bufsize, "%d", output_i);
|
||||
output_id[bufsize-1] = 0;
|
||||
sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, bg);
|
||||
|
||||
char *const cmd[] = {
|
||||
"swaybg",
|
||||
output_id,
|
||||
oc->background,
|
||||
oc->background_option,
|
||||
NULL,
|
||||
};
|
||||
size_t bufsize = 4;
|
||||
char output_id[bufsize];
|
||||
snprintf(output_id, bufsize, "%d", output_i);
|
||||
output_id[bufsize-1] = 0;
|
||||
|
||||
output->bg_pid = fork();
|
||||
if (output->bg_pid == 0) {
|
||||
execvp(cmd[0], cmd);
|
||||
}
|
||||
char *const cmd[] = {
|
||||
"swaybg",
|
||||
output_id,
|
||||
bg,
|
||||
bg_option,
|
||||
NULL,
|
||||
};
|
||||
|
||||
output->bg_pid = fork();
|
||||
if (output->bg_pid == 0) {
|
||||
execvp(cmd[0], cmd);
|
||||
}
|
||||
|
||||
// reload swaybars
|
||||
|
|
Loading…
Reference in a new issue