diff --git a/include/sway/config.h b/include/sway/config.h index dfa3c1b7b..1d8c8992b 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -507,6 +507,7 @@ struct sway_config { struct bar_config *current_bar; uint32_t floating_mod; bool floating_mod_inverse; + bool floating_mod_inhibited; uint32_t dragging_key; uint32_t resizing_key; char *floating_scroll_up_cmd; diff --git a/sway/commands/floating_modifier.c b/sway/commands/floating_modifier.c index c02bce978..d809851d0 100644 --- a/sway/commands/floating_modifier.c +++ b/sway/commands/floating_modifier.c @@ -19,13 +19,22 @@ struct cmd_results *cmd_floating_modifier(int argc, char **argv) { return cmd_results_new(CMD_INVALID, "Invalid modifier"); } - if (argc == 1 || strcasecmp(argv[1], "normal") == 0) { - config->floating_mod_inverse = false; - } else if (strcasecmp(argv[1], "inverse") == 0) { - config->floating_mod_inverse = true; - } else { - return cmd_results_new(CMD_INVALID, - "Usage: floating_modifier [inverse|normal]"); + argv++; + argc--; + while (argc > 0) + { + if (strcasecmp(argv[0], "normal") == 0) { + config->floating_mod_inverse = false; + } else if (strcasecmp(argv[0], "inverse") == 0) { + config->floating_mod_inverse = true; + } else if (strcasecmp(argv[0], "--inhibited") == 0){ + config->floating_mod_inhibited = true; + } else { + return cmd_results_new(CMD_INVALID, + "Usage: floating_modifier [inverse|normal [--inhibited]"); + } + argv++; + argc--; } config->floating_mod = mod; diff --git a/sway/config.c b/sway/config.c index 5058efcc0..d61d3f813 100644 --- a/sway/config.c +++ b/sway/config.c @@ -242,6 +242,7 @@ static void config_defaults(struct sway_config *config) { config->floating_mod = 0; config->floating_mod_inverse = false; + config->floating_mod_inhibited = false; config->dragging_key = BTN_LEFT; config->resizing_key = BTN_RIGHT; diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 42ce333b8..7fd00d718 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c @@ -403,7 +403,12 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, } // Handle tiling resize via mod - bool mod_pressed = modifiers & config->floating_mod; + struct sway_keyboard_shortcuts_inhibitor *sway_inhibitor = + keyboard_shortcuts_inhibitor_get_for_focused_surface(seat); + bool shortcuts_inhibited = sway_inhibitor && sway_inhibitor->inhibitor->active; + bool mod_pressed = modifiers & config->floating_mod && (!shortcuts_inhibited + || config->floating_mod_inhibited); + if (cont && !is_floating_or_child && mod_pressed && state == WL_POINTER_BUTTON_STATE_PRESSED) { uint32_t btn_resize = config->floating_mod_inverse ?