diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index 219aa9ba..08e749dc 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h @@ -43,6 +43,12 @@ struct sway_seat *input_manager_get_default_seat(void); struct sway_seat *input_manager_get_seat(const char *seat_name); +/** + * If none of the seat configs have a fallback setting (either true or false), + * create the default seat (if needed) and set it as the fallback + */ +void input_manager_verify_fallback_seat(void); + /** * Gets the last seat the user interacted with */ diff --git a/sway/config.c b/sway/config.c index bb18c739..303774b4 100644 --- a/sway/config.c +++ b/sway/config.c @@ -465,6 +465,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { if (config->swaynag_config_errors.pid > 0) { swaynag_show(&config->swaynag_config_errors); } + input_manager_verify_fallback_seat(); } if (old_config) { diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 055f6752..9aaeb4d6 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c @@ -95,6 +95,17 @@ static bool input_has_seat_fallback_configuration(void) { return false; } +void input_manager_verify_fallback_seat(void) { + struct sway_seat *seat = NULL; + if (!input_has_seat_fallback_configuration()) { + wlr_log(WLR_DEBUG, "no fallback seat config - creating default"); + seat = input_manager_get_default_seat(); + struct seat_config *sc = new_seat_config(seat->wlr_seat->name); + sc->fallback = true; + store_seat_config(sc); + } +} + static void input_manager_libinput_config_keyboard( struct sway_input_device *input_device) { struct wlr_input_device *wlr_device = input_device->wlr_device; @@ -296,16 +307,10 @@ static void handle_new_input(struct wl_listener *listener, void *data) { wl_signal_add(&device->events.destroy, &input_device->device_destroy); input_device->device_destroy.notify = handle_device_destroy; - struct sway_seat *seat = NULL; - if (!input_has_seat_fallback_configuration()) { - wlr_log(WLR_DEBUG, "no seat config - creating default seat config"); - seat = input_manager_get_default_seat(); - struct seat_config *sc = new_seat_config(seat->wlr_seat->name); - sc->fallback = true; - store_seat_config(sc); - } + input_manager_verify_fallback_seat(); bool added = false; + struct sway_seat *seat = NULL; wl_list_for_each(seat, &input->seats, link) { struct seat_config *seat_config = seat_get_config(seat); bool has_attachment = seat_config &&