swaybg: one instance for all outputs

This makes it so there will only be one swaybg instance running
instead of one per output. swaybg's cli has been changed to a xrandr
like interface, where you select an output and then change properties
for that output and then select another output and repeat. This also
makes it so swaybg is only killed and respawned when a background
changes or when reloading.
This commit is contained in:
Brian Ashworth 2019-04-03 21:53:43 -04:00 committed by Simon Ser
parent 0ad905f23c
commit 75e7bd24cc
8 changed files with 497 additions and 251 deletions

View file

@ -68,6 +68,8 @@ struct cmd_results *cmd_output(int argc, char **argv) {
config->handler_context.leftovers.argc = 0;
config->handler_context.leftovers.argv = NULL;
bool background = output->background;
output = store_output_config(output);
// If reloading, the output configs will be applied after reading the
@ -75,6 +77,9 @@ struct cmd_results *cmd_output(int argc, char **argv) {
// workspace name is not given to re-enabled outputs.
if (!config->reloading) {
apply_output_config_to_outputs(output);
if (background) {
spawn_swaybg();
}
}
return cmd_results_new(CMD_SUCCESS, NULL);