aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-04-14 00:27:47 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2019-04-14 12:41:59 +0300
commit6961bf2e4ce2c116e41a8db158691f6c993707ce (patch)
treea381146599a5f19e565006cafeb23edc04247d2b /sway/config.c
parentswaynag: fix pointer management (diff)
downloadsway-6961bf2e4ce2c116e41a8db158691f6c993707ce.tar.gz
sway-6961bf2e4ce2c116e41a8db158691f6c993707ce.tar.zst
sway-6961bf2e4ce2c116e41a8db158691f6c993707ce.zip
Spawn swaynag as a wayland client
This spawns swaynag as a wayland client similar to how swaybar and swaybg are already done
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/sway/config.c b/sway/config.c
index d5bfe105..4944ec02 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -175,15 +175,13 @@ static void set_color(float dest[static 4], uint32_t color) {
175 175
176static void config_defaults(struct sway_config *config) { 176static void config_defaults(struct sway_config *config) {
177 if (!(config->swaynag_command = strdup("swaynag"))) goto cleanup; 177 if (!(config->swaynag_command = strdup("swaynag"))) goto cleanup;
178 config->swaynag_config_errors = (struct swaynag_instance){ 178 config->swaynag_config_errors = (struct swaynag_instance){0};
179 .args = "--type error " 179 config->swaynag_config_errors.args = "--type error "
180 "--message 'There are errors in your config file' " 180 "--message 'There are errors in your config file' "
181 "--detailed-message " 181 "--detailed-message "
182 "--button 'Exit sway' 'swaymsg exit' " 182 "--button-no-terminal 'Exit sway' 'swaymsg exit' "
183 "--button 'Reload sway' 'swaymsg reload'", 183 "--button-no-terminal 'Reload sway' 'swaymsg reload'";
184 .pid = -1, 184 config->swaynag_config_errors.detailed = true;
185 .detailed = true,
186 };
187 185
188 if (!(config->symbols = create_list())) goto cleanup; 186 if (!(config->symbols = create_list())) goto cleanup;
189 if (!(config->modes = create_list())) goto cleanup; 187 if (!(config->modes = create_list())) goto cleanup;
@@ -411,10 +409,9 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
411 config->reloading = true; 409 config->reloading = true;
412 config->active = true; 410 config->active = true;
413 411
414 swaynag_kill(&old_config->swaynag_config_errors); 412 if (old_config->swaynag_config_errors.client != NULL) {
415 memcpy(&config->swaynag_config_errors, 413 wl_client_destroy(old_config->swaynag_config_errors.client);
416 &old_config->swaynag_config_errors, 414 }
417 sizeof(struct swaynag_instance));
418 415
419 input_manager_reset_all_inputs(); 416 input_manager_reset_all_inputs();
420 } 417 }
@@ -486,7 +483,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
486 spawn_swaybg(); 483 spawn_swaybg();
487 484
488 config->reloading = false; 485 config->reloading = false;
489 if (config->swaynag_config_errors.pid > 0) { 486 if (config->swaynag_config_errors.client != NULL) {
490 swaynag_show(&config->swaynag_config_errors); 487 swaynag_show(&config->swaynag_config_errors);
491 } 488 }
492 489