Skip to content

ZoomIt: Make Snip Save hotkey separately configurable#45809

Open
SeanKilleen wants to merge 4 commits intomicrosoft:mainfrom
SeanKilleen:45808_zoomit-add-snipandsave-hotkey
Open

ZoomIt: Make Snip Save hotkey separately configurable#45809
SeanKilleen wants to merge 4 commits intomicrosoft:mainfrom
SeanKilleen:45808_zoomit-add-snipandsave-hotkey

Conversation

@SeanKilleen
Copy link
Contributor

@SeanKilleen SeanKilleen commented Feb 26, 2026

ℹ️ Transparency: Claude Code was used in the creation of this pull request, guided by me, given my ancient familiarity with C++. I am submitting this as a human and will be reviewing my own code prior to asking others to review it.

I also understand this work might be rejected if this isn't the approach folks want to take. I won't be mad it it gets closed. 😄

Summary of the Pull Request

  • Fixes ZoomIt: Ignores "Shift" in hotkey setting for snip #45808 — ZoomIt's "Snip Save" hotkey was auto-derived by XOR'ing the Shift modifier from the Snip hotkey, causing Ctrl+S to be stolen when Snip was set to Ctrl+Shift+S
  • The Snip Save hotkey is now a separate, independently configurable setting (default: Ctrl+Shift+6, complementing the default Snip hotkey Ctrl+6)
  • Updated both the PowerToys Settings UI and the standalone ZoomIt options dialog

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass N/A (no ZoomIt tests in repo)
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated N/A in this case I think
  • New binaries: Added on the required places N/A
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

ZoomIt registered two hotkeys for Snip — the primary (SNIP_HOTKEY) and a "save to file" variant (SNIP_SAVE_HOTKEY) derived by toggling the Shift modifier via XOR:

RegisterHotKey(hWnd, SNIP_SAVE_HOTKEY, (g_SnipToggleMod ^ MOD_SHIFT), g_SnipToggleKey & 0xFF);

This worked fine for the default Ctrl+6 (save became Ctrl+Shift+6), but when a user configured Ctrl+Shift+S as their Snip hotkey, the XOR removed Shift, making the save variant Ctrl+S — stealing a ubiquitous shortcut from every other application.

Changes

C++ Backend (ZoomIt core)

  • resource.h — Added IDC_SNIP_SAVE_HOTKEY control ID for the new dialog control
  • ZoomItSettings.h — Added g_SnipSaveToggleKey global variable (default: Ctrl+Shift+6) and its RegSettings[] entry for registry persistence
  • ZoomIt.rc — Added a second hotkey control ("Snip Save Toggle") to the standalone SNIP options dialog
  • Zoomit.cpp — Added g_SnipSaveToggleMod global; replaced all 4 XOR-derived RegisterHotKey calls with the new explicit setting; updated the options dialog init, read, validation, and save logic

Settings Interop

  • ZoomItSettings.cpp — Added SnipSaveToggleKey to the settings_with_special_semantics map so it serializes as a hotkey JSON object

C# Settings UI

  • ZoomItProperties.cs — Added DefaultSnipSaveToggleKey and SnipSaveToggleKey property
  • ZoomItViewModel.cs — Replaced the computed XOR-derived read-only getter with a full get/set property backed by the new SnipSaveToggleKey setting
  • ZoomItPage.xaml — Replaced the read-only markdown description with an editable ShortcutControl for the save hotkey
  • Resources.resw — Added "Save snip to file" header string; removed the old templated description

Validation Steps Performed

Built and tested locally --

✅ App shows additional shortcut for ZoomIt

image

✅ I am able to save files via CTRL + S as normal

✅ I am able to use Snip activation with CTRL + Shift + S

✅ I am able to use Save snip to file with the assigned shortcut of CTRL + Shift + 6

✅ Other ZoomIt commands run as expected (e.g. LiveZoom with my mapping of ALT + 4

@github-actions

This comment has been minimized.

@SeanKilleen
Copy link
Contributor Author

Built and tested locally --

✅ App shows additional shortcut for ZoomIt

image

✅ I am able to save files via CTRL + S as normal

✅ I am able to use Snip activation with CTRL + Shift + S

✅ I am able to use Save snip to file with the assigned shortcut of CTRL + Shift + 6

✅ Other ZoomIt commands run as expected (e.g. LiveZoom with my mapping of ALT + 4

@SeanKilleen SeanKilleen marked this pull request as ready for review February 26, 2026 16:52
@jiripolasek
Copy link
Collaborator

Hi,

could you please split the changes to setup-dev-environment.ps1 out of this PR? It is not related to the issue.

@SeanKilleen
Copy link
Contributor Author

@jiripolasek done 👍 thanks for the guidance

@SeanKilleen
Copy link
Contributor Author

@jiripolasek apologies for pinging you; doing so because I realized I replied very quickly to your comment 2 weeks ago and you may not have seen that I'd made the requested changes

@jiripolasek jiripolasek requested a review from vanzue March 10, 2026 16:39
@vanzue
Copy link
Contributor

vanzue commented Mar 11, 2026

Thanks for the PR!
One thing I noticed is that the XOR-with-Shift behavior is not only used for Snip.
For example, video recording and live draw in ZoomIt also derive their secondary hotkeys the same way.
If we want to fully address this class of issues, we might need to reconsider the silently derived key-binding behavior itself, rather than fixing only the Snip case.

@niels9001 thought?

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.

ZoomIt: Ignores "Shift" in hotkey setting for snip

3 participants