From 7e100f3ed4f1279c67d596654b665e3f347ca455 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Fri, 29 Aug 2025 12:18:09 -0400 Subject: keybindings: Release keyboard grab on screenshot commands This prevents race conditions with applications like mate-screenshot that need to grab input (e.g. for area selection). Fixes mate-desktop/mate-utils#37 --- src/core/keybindings.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/core/keybindings.c') diff --git a/src/core/keybindings.c b/src/core/keybindings.c index c74577f9..b1b1780a 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2510,6 +2510,15 @@ handle_run_command (MetaDisplay *display, return; } + /* Release keyboard grabs immediately for screenshot commands that may need + * input grabbing. This prevents race conditions with applications like + * mate-screenshot that need to grab input for area selection. + */ + if (which >= SCREENSHOT_COMMAND_IDX && which <= WIN_SCREENSHOT_COMMAND_IDX) + { + ungrab_keyboard (display, event->xkey.time); + } + err = NULL; if (!meta_spawn_command_line_async_on_screen (command, screen, &err)) { -- cgit v1.2.1