Report kanshi config errors in the info bar only

This commit is contained in:
Mars-Wave
2026-03-03 19:17:07 +01:00
parent 9cf3651140
commit e0699ff04d
3 changed files with 8 additions and 11 deletions
+1 -5
View File
@@ -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);
}
+6 -5
View File
@@ -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);
}
+1 -1
View File
@@ -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