diff --git a/src/outputs.c b/src/outputs.c index 9c404b7..b393feb 100644 --- a/src/outputs.c +++ b/src/outputs.c @@ -53,11 +53,7 @@ static void config_handle_succeeded(void *data, zwlr_output_configuration_v1_destroy(config); wd_ui_apply_done(pending->state, pending->outputs); #ifdef WITH_KANSHI - if (wd_store_config(pending->outputs) == 0) - { - wd_ui_show_error(pending->state, - "Change was applied successfully and config was saved."); - } + wd_store_config(pending->state, pending->outputs); #endif destroy_pending(pending); } diff --git a/src/store.c b/src/store.c index c96aaaa..d5ae05a 100644 --- a/src/store.c +++ b/src/store.c @@ -513,7 +513,7 @@ static bool write_config(const char *path, const char *contents, return g_file_set_contents(path, contents, -1, error); } -int wd_store_config(struct wl_list *outputs) { +void wd_store_config(struct wd_state *state, struct wl_list *outputs) { g_autofree char *path = get_config_path(); g_autofree char *contents = NULL; g_autofree char *updated = NULL; @@ -529,9 +529,10 @@ int wd_store_config(struct wl_list *outputs) { if (updated == NULL || !write_config(path, updated, &error)) { goto err; } - return 0; + return; -err: - fprintf(stderr, "Could not save the kanshi config %s: %s\n", path, error->message); - return 1; +err:; + g_autofree char *message = g_strdup_printf( + "Could not save the kanshi config %s: %s", path, error->message); + wd_ui_show_error(state, message); } diff --git a/src/wdisplays.h b/src/wdisplays.h index ce0f6e2..de77538 100644 --- a/src/wdisplays.h +++ b/src/wdisplays.h @@ -349,7 +349,7 @@ void wd_destroy_overlay(struct wd_output *output); /* * Updates kanshi config */ -int wd_store_config(struct wl_list *outputs); +void wd_store_config(struct wd_state *state, struct wl_list *outputs); #endif // SPDX-SnippetEnd #endif