Save to the kanshi config only on a manual apply

This commit is contained in:
Mars-Wave
2026-03-17 21:58:17 +01:00
parent 3a2a1878d5
commit be98542f4e
3 changed files with 9 additions and 4 deletions
+5 -3
View File
@@ -50,10 +50,12 @@ static gboolean send_apply(gpointer data) {
struct wl_display *wl_display = gdk_wayland_display_get_wl_display(display);
wd_apply_state(state, outputs, wl_display);
state->apply_pending = FALSE;
state->apply_manual = false;
return FALSE;
}
static void apply_state(struct wd_state *state) {
static void apply_state(struct wd_state *state, bool manual) {
state->apply_manual = state->apply_manual || manual;
gtk_stack_set_visible_child_name(GTK_STACK(state->header_stack), "title");
if (!state->autoapply) {
gtk_style_context_add_class(gtk_widget_get_style_context(state->spinner), "visible");
@@ -300,7 +302,7 @@ static void show_apply(struct wd_state *state) {
const gchar *page = "title";
if (has_changes(state)) {
if (state->autoapply) {
apply_state(state);
apply_state(state, false);
} else {
page = "apply";
}
@@ -842,7 +844,7 @@ static void cancel_changes(GSimpleAction *action, GVariant *param, gpointer data
}
static void apply_changes(GSimpleAction *action, GVariant *param, gpointer data) {
apply_state(data);
apply_state(data, true);
}
static void info_response(GtkInfoBar *info_bar, gint response_id, gpointer data) {
+3 -1
View File
@@ -35,6 +35,7 @@ static void noop() {
struct wd_pending_config {
struct wd_state *state;
struct wl_list *outputs;
bool manual;
};
static void destroy_pending(struct wd_pending_config *pending) {
@@ -53,7 +54,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 (pending->state->save_kanshi_config) {
if (pending->manual && pending->state->save_kanshi_config) {
wd_store_config(pending->state, pending->outputs);
}
#endif
@@ -95,6 +96,7 @@ void wd_apply_state(struct wd_state *state, struct wl_list *new_outputs,
struct wd_pending_config *pending = calloc(1, sizeof(*pending));
pending->state = state;
pending->outputs = new_outputs;
pending->manual = state->apply_manual;
zwlr_output_configuration_v1_add_listener(config, &config_listener, pending);
+1
View File
@@ -187,6 +187,7 @@ struct wd_state {
uint32_t serial;
bool apply_pending;
bool apply_manual;
bool autoapply;
bool capture;
bool show_overlay;