diff options
| author | Victor Kareh <[email protected]> | 2025-08-29 13:45:48 -0400 |
|---|---|---|
| committer | Luke from DC <[email protected]> | 2025-11-01 19:22:36 +0000 |
| commit | 7433837df6c936ffaadd6af689a83ba4e9c4f64a (patch) | |
| tree | 0ec6f20b308e03e9d7e0f314d525168fddfeba88 | |
| parent | 7e100f3ed4f1279c67d596654b665e3f347ca455 (diff) | |
| download | marco-7433837df6c936ffaadd6af689a83ba4e9c4f64a.tar.bz2 marco-7433837df6c936ffaadd6af689a83ba4e9c4f64a.tar.xz | |
Add Shift+Print keybinding to trigger 'mate-screenshot --area' for
interactive area selection. This gives users a dedicated keybinding for
area screenshots in addition to the existing Print (screen) and
Alt+Print (window) shortcuts.
Fixes mate-desktop/marco#157
| -rw-r--r-- | src/50-marco-desktop-key.xml.in | 2 | ||||
| -rw-r--r-- | src/core/keybindings.c | 2 | ||||
| -rw-r--r-- | src/core/prefs.c | 7 | ||||
| -rw-r--r-- | src/include/all-keybindings.h | 1 | ||||
| -rw-r--r-- | src/include/prefs.h | 7 | ||||
| -rw-r--r-- | src/org.mate.marco.gschema.xml | 10 |
6 files changed, 25 insertions, 4 deletions
diff --git a/src/50-marco-desktop-key.xml.in b/src/50-marco-desktop-key.xml.in index 61f2ff4f..661476cc 100644 --- a/src/50-marco-desktop-key.xml.in +++ b/src/50-marco-desktop-key.xml.in @@ -9,6 +9,8 @@ <KeyListEntry name="run-command-window-screenshot" description="Take a screenshot of a window" /> + <KeyListEntry name="run-command-area-screenshot" description="Take a screenshot of an area" /> + <KeyListEntry name="run-command-terminal" description="Run a terminal" /> <KeyListEntry name="rename-workspace" description="Rename current workspace" /> diff --git a/src/core/keybindings.c b/src/core/keybindings.c index b1b1780a..45be2353 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2514,7 +2514,7 @@ handle_run_command (MetaDisplay *display, * 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) + if (which >= SCREENSHOT_COMMAND_IDX && which <= AREA_SCREENSHOT_COMMAND_IDX) { ungrab_keyboard (display, event->xkey.time); } diff --git a/src/core/prefs.c b/src/core/prefs.c index 5299cf81..e1e09153 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -2065,6 +2065,10 @@ update_command (const char *name, { i = WIN_SCREENSHOT_COMMAND_IDX; } + else if (strcmp (name, "command-area-screenshot") == 0) + { + i = AREA_SCREENSHOT_COMMAND_IDX; + } else { meta_topic (META_DEBUG_KEYBINDINGS, @@ -2119,6 +2123,9 @@ meta_prefs_get_settings_key_for_command (int i) case WIN_SCREENSHOT_COMMAND_IDX: key = g_strdup (KEY_COMMAND_PREFIX "window-screenshot"); break; + case AREA_SCREENSHOT_COMMAND_IDX: + key = g_strdup (KEY_COMMAND_PREFIX "area-screenshot"); + break; default: key = g_strdup_printf (KEY_COMMAND_PREFIX"%d", i + 1); break; diff --git a/src/include/all-keybindings.h b/src/include/all-keybindings.h index 992d077f..02452878 100644 --- a/src/include/all-keybindings.h +++ b/src/include/all-keybindings.h @@ -194,6 +194,7 @@ keybind (run-command-32, handle_run_command, 31, 0) keybind (run-command-screenshot, handle_run_command, 32, 0) keybind (run-command-window-screenshot, handle_run_command, 33, 0) +keybind (run-command-area-screenshot, handle_run_command, 34, 0) keybind (run-command-terminal, handle_run_terminal, 0, 0) keybind (rename-workspace, handle_rename_workspace, 0, 0) diff --git a/src/include/prefs.h b/src/include/prefs.h index ebfd2c55..1170e8e8 100644 --- a/src/include/prefs.h +++ b/src/include/prefs.h @@ -30,9 +30,10 @@ #include <pango/pango-font.h> #define MAX_COMMANDS (32 + NUM_EXTRA_COMMANDS) -#define NUM_EXTRA_COMMANDS 2 -#define SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 2) -#define WIN_SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 1) +#define NUM_EXTRA_COMMANDS 3 +#define SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 3) +#define WIN_SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 2) +#define AREA_SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 1) typedef enum { diff --git a/src/org.mate.marco.gschema.xml b/src/org.mate.marco.gschema.xml index 178e4207..ec80cf40 100644 --- a/src/org.mate.marco.gschema.xml +++ b/src/org.mate.marco.gschema.xml @@ -670,6 +670,11 @@ <summary>Take a screenshot of a window</summary> <description>The format looks like "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description> </key> + <key name="run-command-area-screenshot" type="s"> + <default>'<Shift>Print'</default> + <summary>Take a screenshot of an area</summary> + <description>The format looks like "<Control>a" or "<Shift><Alt>F1". The parser is fairly liberal and allows lower or upper case, and also abbreviations such as "<Ctl>" and "<Ctrl>". If you set the option to the special string "disabled", then there will be no keybinding for this action.</description> + </key> <key name="run-command-terminal" type="s"> <default>'disabled'</default> <summary>Run a terminal</summary> @@ -753,6 +758,11 @@ <summary>The window screenshot command</summary> <description>The /apps/marco/global_keybindings/run_command_window_screenshot key defines a keybinding which causes the command specified by this setting to be invoked.</description> </key> + <key name="command-area-screenshot" type="s"> + <default>'mate-screenshot --area'</default> + <summary>The area screenshot command</summary> + <description>The /apps/marco/global_keybindings/run_command_area_screenshot key defines a keybinding which causes the command specified by this setting to be invoked.</description> + </key> </schema> <schema id="org.mate.Marco.window-keybindings" path="/org/mate/marco/window-keybindings/"> |
