Skip to content

Commit

Permalink
Shortcuts: Add an interactive screenshot shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Nov 24, 2024
1 parent f252f74 commit 8029d59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions data/gala.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
<default><![CDATA[['Print']]]></default>
<summary>Take a screenshot</summary>
</key>
<key name="interactive-screenshot" type="as">
<default><![CDATA[['<Super>Print']]]></default>
<summary>Launch the interactive screenshot tool</summary>
</key>
<key name="window-screenshot" type="as">
<default><![CDATA[['<Alt>Print']]]></default>
<summary>Take a screenshot of a window</summary>
Expand Down
8 changes: 8 additions & 0 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ namespace Gala {
display.add_keybinding ("switch-input-source-backward", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_switch_input_source);

display.add_keybinding ("screenshot", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
display.add_keybinding ("interactive-screenshot", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
display.add_keybinding ("window-screenshot", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
display.add_keybinding ("area-screenshot", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
display.add_keybinding ("screenshot-clip", keybinding_settings, Meta.KeyBindingFlags.IGNORE_AUTOREPEAT, (Meta.KeyHandlerFunc) handle_screenshot);
Expand Down Expand Up @@ -516,6 +517,13 @@ namespace Gala {
case "screenshot":
screenshot_screen.begin ();
break;
case "interactive-screenshot":
try {
Process.spawn_command_line_async ("io.elementary.screenshot");
} catch (Error e) {
warning ("Failed to launch interactive screenshot: %s", e.message);
}
break;
case "area-screenshot":
screenshot_area.begin ();
break;
Expand Down

0 comments on commit 8029d59

Please sign in to comment.