Skip to content

Conversation

@anudeep2710
Copy link

@anudeep2710 anudeep2710 commented Dec 14, 2025

PR Description

I've added keyboard shortcut support for the save action as requested in #475 .

Users can now press Ctrl+S (Windows/Linux) or Cmd+S (macOS) to save collections and environments.

Implementation Details

I used Flutter's built-in Shortcuts and Actions widgets to intercept keyboard events. I wrapped the Dashboard's Scaffold with these widgets to enable global keyboard shortcut support.

The save action:

  • Only triggers when there are unsaved changes
  • Prevents multiple simultaneous saves
  • Reuses existing save logic from save_utils.dart
  • Shows the same visual feedback (overlay) as the save button
  • Works globally across all tabs (Requests, Variables, History, Logs, Settings)

Testing

I've tested this thoroughly on Windows:

  • Verified Ctrl+S triggers save when there are unsaved changes
  • Verified it does nothing when there are no changes
  • Verified it prevents duplicate saves on rapid key presses
  • Tested across all different tabs
  • All existing tests pass

Related Issues

Checklist

  • I have gone through the contributing guide
  • I have updated my branch and synced it with project main branch before making this PR
  • I am using the latest Flutter stable branch (run flutter upgrade and verify)
  • I have run the tests (flutter test) and all tests are passing

Added/updated tests?

  • Yes

I've added basic tests in test/actions/save_action_test.dart for the SaveIntent and SaveAction classes, as well as tests to verify the keyboard shortcut registration.

OS on which you have developed and tested the feature?

  • Windows
  • macOS
  • Linux

I developed and tested this feature on Windows 11. The implementation uses platform detection (kIsMacOS) to automatically use the correct modifier key (Ctrl on Windows/Linux, Cmd on macOS).

- Created SaveIntent and SaveAction classes in lib/actions/
- Modified Dashboard to add keyboard shortcut support using Shortcuts and Actions widgets
- Added support for Ctrl+S (Windows/Linux) and Cmd+S (macOS)
- Reuses existing save logic from save_utils.dart
- Only triggers when there are unsaved changes
- Prevents multiple simultaneous saves
- Added basic tests in test/actions/save_action_test.dart

Fixes foss42#475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add keyboard shortcut for the "Save" action

1 participant