mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 09:21: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_maximum_height;
|
||||||
int32_t floating_minimum_width;
|
int32_t floating_minimum_width;
|
||||||
int32_t floating_minimum_height;
|
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_down_cmd);
|
||||||
free(config->floating_scroll_left_cmd);
|
free(config->floating_scroll_left_cmd);
|
||||||
free(config->floating_scroll_right_cmd);
|
free(config->floating_scroll_right_cmd);
|
||||||
|
free(config->default_background);
|
||||||
|
free(config->default_background_option);
|
||||||
free(config);
|
free(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +301,9 @@ static void config_defaults(struct sway_config *config) {
|
||||||
config->border_colors.placeholder.child_border = 0x0C0C0CFF;
|
config->border_colors.placeholder.child_border = 0x0C0C0CFF;
|
||||||
|
|
||||||
config->border_colors.background = 0xFFFFFFFF;
|
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) {
|
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) {
|
void apply_output_config(struct output_config *oc, swayc_t *output) {
|
||||||
if (oc->enabled == 0) {
|
if (oc && oc->enabled == 0) {
|
||||||
destroy_output(output);
|
destroy_output(output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -911,12 +916,14 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oc && oc->background) {
|
char *bg = oc && oc->background ? oc->background : config->default_background;
|
||||||
|
char *bg_option = oc && oc->background_option ? oc->background_option : config->default_background_option;
|
||||||
|
|
||||||
if (output->bg_pid != 0) {
|
if (output->bg_pid != 0) {
|
||||||
terminate_swaybg(output->bg_pid);
|
terminate_swaybg(output->bg_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background);
|
sway_log(L_DEBUG, "Setting background for output %d to %s", output_i, bg);
|
||||||
|
|
||||||
size_t bufsize = 4;
|
size_t bufsize = 4;
|
||||||
char output_id[bufsize];
|
char output_id[bufsize];
|
||||||
|
@ -926,8 +933,8 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
|
||||||
char *const cmd[] = {
|
char *const cmd[] = {
|
||||||
"swaybg",
|
"swaybg",
|
||||||
output_id,
|
output_id,
|
||||||
oc->background,
|
bg,
|
||||||
oc->background_option,
|
bg_option,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -935,7 +942,6 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
|
||||||
if (output->bg_pid == 0) {
|
if (output->bg_pid == 0) {
|
||||||
execvp(cmd[0], cmd);
|
execvp(cmd[0], cmd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// reload swaybars
|
// reload swaybars
|
||||||
load_swaybars();
|
load_swaybars();
|
||||||
|
|
Loading…
Reference in a new issue