Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow all glob patterns in output configs #5629

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/sway/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ struct sway_config {

// swaybg
char *swaybg_command;
char **swaybg_full_command;
struct wl_client *swaybg_client;
struct wl_listener swaybg_client_destroy;

Expand Down Expand Up @@ -586,6 +587,7 @@ void config_add_swaynag_warning(char *fmt, ...);
/**
* Free config struct
*/
void free_swaybg_full_command(char** cmd);
void free_config(struct sway_config *config);

void free_sway_variable(struct sway_variable *var);
Expand Down Expand Up @@ -644,7 +646,7 @@ struct output_config *store_output_config(struct output_config *oc);

struct output_config *find_output_config(struct sway_output *output);

void apply_output_config_to_outputs(struct output_config *oc);
void apply_output_config_to_outputs();

void reset_outputs(void);

Expand Down
9 changes: 2 additions & 7 deletions sway/commands/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,13 @@ 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);
store_output_config(output);

// If reloading, the output configs will be applied after reading the
// entire config and before the deferred commands so that an auto generated
// workspace name is not given to re-enabled outputs.
if (!config->reloading && !config->validating) {
apply_output_config_to_outputs(output);
if (background) {
spawn_swaybg();
}
apply_output_config_to_outputs();
}

return cmd_results_new(CMD_SUCCESS, NULL);
Expand Down
15 changes: 14 additions & 1 deletion sway/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ static void free_mode(struct sway_mode *mode) {
free(mode);
}

void free_swaybg_full_command(char **cmd) {
if (!cmd) {
return;
}

char **pos = cmd;
while (*pos) {
free(*pos);
pos++;
}
free(cmd);
}

void free_config(struct sway_config *config) {
if (!config) {
return;
Expand Down Expand Up @@ -160,6 +173,7 @@ void free_config(struct sway_config *config) {
free(config->floating_scroll_right_cmd);
free(config->font);
free(config->swaybg_command);
free_swaybg_full_command(config->swaybg_full_command);
free(config->swaynag_command);
free((char *)config->current_config_path);
free((char *)config->current_config);
Expand Down Expand Up @@ -528,7 +542,6 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
sway_switch_retrigger_bindings_for_all();

reset_outputs();
spawn_swaybg();

config->reloading = false;
if (config->swaynag_config_errors.client != NULL) {
Expand Down
Loading