PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Add non-updating mode for Crop-And-Lock

Open fm-sys opened this issue 5 months ago • 11 comments

Summary of the Pull Request

Adds a "screenshot" mode to Crop And Lock, which allows creating a window showing a freezed snapshot of the original window.

PR Checklist

  • [x] Closes: #31799, #33071 (also requested in the already closed duplicate issues #28633, #33812, #37337, )
  • [ ] Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • [x] Tests: Added/updated and all pass (crop-and-lock utility doesn't have any tests)
  • [x] Localization: All end-user-facing strings can be localized
  • [x] Dev docs: Added/updated
  • [x] New binaries: Added on the required places
  • [x] Documentation updated: https://github.com/MicrosoftDocs/windows-dev-docs/pull/5528

Detailed Description of the Pull Request / Additional comments

It was asked why this feature is needed at all, because it could be done with snipping tool and just AoT that window as well. While this is true, PowerToys goal always was to improve and speed up workflows. Instead of capturing the screenshot, opening it, and then apply "Crop and Lock" or "Always on Top" on the screenshots window, this PR aims to provide this functionality in a single step.

Example use cases:

  • when I want to compare between two situations like previous output result and current output result. (#31799)
  • Allow cropping a section of a large code file (say top while working at the bottom) as reference while working elsewhere in the file. (#33071)
  • Can be useful for the work in the same document, like excel or word where you are actively checking the data from the same document. (#28633)
  • In lot's of older applications, if you need to get some information or data from one dialog do another, but because of dialog modality it's not possible to have both windows open at the same time. (#33812)
  • nowadays quite a lot is happening inside the browser. Quite often, I want to keep a small portion of the current website visible and switch to e.g. the writing tool also running in a different tab in the same browser window. (#31799)

I've used win+ctrl+shift+s as the default activation shortcut, as it's not yet used by other powertoys utilities, has similarity with the normal win+shift+s shortcut hotkey and is consistent with the other Crop and Lock shortcuts win+ctrl+shift+r (Reparent Mode) and win+ctrl+shift+t (Thumbnail Mode).

Validation Steps Performed

Compatibility tested manually with a large set of applications I have installed on my computer. However, automated tests don't really make sense as there is not much business logic which could be tested.

fm-sys avatar Jul 20 '25 09:07 fm-sys

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

RENDERFULLCONTENT

These words are not needed and should be removed fff

Some files were automatically ignored :see_no_evil:

These sample patterns would exclude them:

^src/modules/powerrename/PowerRenameUITest/testItems/

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:fm-sys/PowerToys.git repository on the crop-and-lock-with-lock branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/16398267128/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Warnings :warning: (1)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:warning: Warnings Count
:warning: binary-file 3

See :warning: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Jul 20 '25 09:07 github-actions[bot]

@microsoft-github-policy-service agree

fm-sys avatar Jul 20 '25 09:07 fm-sys

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (55)
aktuellen
alle
aus
automatisch
bearbeiten
berschreibt
dann
Datei
diese
dieser
Eigenschaft
ein
eine
einem
einen
entfernen
erneut
erstellen
falsches
gehen
generiert
Gibt
hinzuzuf
hnelt
hren
Ihr
Instanz
Klasse
Laufzeitversion
lokalisierte
lokalisierten
nderungen
neu
nnen
oder
Projekt
Ressourcenklasse
Ressourcenzuordnungen
Suchen
Sucht
typisierte
und
Verhalten
verloren
verursachen
verwenden
verwendet
wenn
wie
wurde
Zeichenfolge
Zeichenfolgen
zum
zur
zwischengespeicherte
These words are not needed and should be removed advancedpasteui advancedpasteuishortcut allpc fff hotkeylockmachine hotkeyreconnect hotkeyswitch hotkeytoggleeasymouse imagetotext imagetotextshortcut LOCKMACHINE measuretool mousepointercrosshairs pasteashtmlfile pasteashtmlfileshortcut pasteasjson pasteasjsonshortcut pasteasmarkdown pasteasmarkdownshortcut pasteasplaintext pasteasplaintextshortcut pasteaspngfile pasteaspngfileshortcut pasteastxtfile pasteastxtfileshortcut powerocr reparenthotkey thumbnailhotkey TOGGLEEASYMOUSE transcodetomp

Some files were automatically ignored :see_no_evil:

These sample patterns would exclude them:

^\Qsrc/modules/peek/Peek.UITests/TestAssets/4.qoi\E$
^src/modules/powerrename/PowerRenameUITest/testItems/

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:fm-sys/PowerToys.git repository on the crop-and-lock-with-lock branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/17111794773/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Forbidden patterns :no_good: (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

Should be a

\san (?=(?:[b-df-gj-npqtv-xz]|h(?!our|tml|ttp)|r(?!c\b)|s(?!sh|vg))[a-z])
Pattern suggestions :scissors: (3)

You could add these patterns to .github/actions/spell-check/patterns.txt:

# Automatically suggested patterns

# hit-count: 26 file-count: 2
# Alternatively, if you're using check-spelling v0.0.25+, and you would like to _check_ the Non-English content for spelling errors, you can. For information on how to do so, see:
# https://docs.check-spelling.dev/Feature:-Configurable-word-characters.html#unicode
[a-zA-Z]*[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]*|[a-zA-Z]{3,}[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]|[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3,}

# hit-count: 1 file-count: 1
# marker to ignore all code on line
^.*/\* #no-spell-check-line \*/.*$

# hit-count: 1 file-count: 1
# marker to ignore all code on line
^.*\bno-spell-check(?:-line|)(?:\s.*|)$

Alternatively, if a pattern suggestion doesn't make sense for this project, add a # to the beginning of the line in the candidates file with the pattern to stop suggesting it.

Errors, Warnings, and Notices :x: (5)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors, Warnings, and Notices Count
:warning: binary-file 4
:information_source: candidate-pattern 4
:x: forbidden-pattern 2
:warning: ignored-expect-variant 1
:warning: no-newline-at-eof 1

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Aug 20 '25 22:08 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (55)
aktuellen
alle
aus
automatisch
bearbeiten
berschreibt
dann
Datei
diese
dieser
Eigenschaft
ein
eine
einem
einen
entfernen
erneut
erstellen
falsches
gehen
generiert
Gibt
hinzuzuf
hnelt
hren
Ihr
Instanz
Klasse
Laufzeitversion
lokalisierte
lokalisierten
nderungen
neu
nnen
oder
Projekt
Ressourcenklasse
Ressourcenzuordnungen
Suchen
Sucht
typisierte
und
Verhalten
verloren
verursachen
verwenden
verwendet
wenn
wie
wurde
Zeichenfolge
Zeichenfolgen
zum
zur
zwischengespeicherte
These words are not needed and should be removed advancedpasteui advancedpasteuishortcut allpc fff hotkeylockmachine hotkeyreconnect hotkeyswitch hotkeytoggleeasymouse imagetotext imagetotextshortcut LOCKMACHINE measuretool mousepointercrosshairs pasteashtmlfile pasteashtmlfileshortcut pasteasjson pasteasjsonshortcut pasteasmarkdown pasteasmarkdownshortcut pasteasplaintext pasteasplaintextshortcut pasteaspngfile pasteaspngfileshortcut pasteastxtfile pasteastxtfileshortcut powerocr reparenthotkey thumbnailhotkey TOGGLEEASYMOUSE transcodetomp

Some files were automatically ignored :see_no_evil:

These sample patterns would exclude them:

^\Qsrc/modules/peek/Peek.UITests/TestAssets/4.qoi\E$
^src/modules/powerrename/PowerRenameUITest/testItems/

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:fm-sys/PowerToys.git repository on the crop-and-lock-with-lock branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/17112653311/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Forbidden patterns :no_good: (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

Should be a

\san (?=(?:[b-df-gj-npqtv-xz]|h(?!our|tml|ttp)|r(?!c\b)|s(?!sh|vg))[a-z])
Pattern suggestions :scissors: (3)

You could add these patterns to .github/actions/spell-check/patterns.txt:

# Automatically suggested patterns

# hit-count: 26 file-count: 2
# Alternatively, if you're using check-spelling v0.0.25+, and you would like to _check_ the Non-English content for spelling errors, you can. For information on how to do so, see:
# https://docs.check-spelling.dev/Feature:-Configurable-word-characters.html#unicode
[a-zA-Z]*[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]*|[a-zA-Z]{3,}[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]|[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3,}

# hit-count: 1 file-count: 1
# marker to ignore all code on line
^.*/\* #no-spell-check-line \*/.*$

# hit-count: 1 file-count: 1
# marker to ignore all code on line
^.*\bno-spell-check(?:-line|)(?:\s.*|)$

Alternatively, if a pattern suggestion doesn't make sense for this project, add a # to the beginning of the line in the candidates file with the pattern to stop suggesting it.

Errors, Warnings, and Notices :x: (5)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors, Warnings, and Notices Count
:warning: binary-file 4
:information_source: candidate-pattern 4
:x: forbidden-pattern 2
:warning: ignored-expect-variant 1
:warning: no-newline-at-eof 1

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Aug 20 '25 23:08 github-actions[bot]

/azp run

yeelam-gordon avatar Aug 22 '25 05:08 yeelam-gordon

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

azure-pipelines[bot] avatar Aug 22 '25 05:08 azure-pipelines[bot]

There is a new Conflict Detection added, need to update accordingly: https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/core/settings/settings-implementation.md#shortcut-conflict-detection

yeelam-gordon avatar Aug 22 '25 05:08 yeelam-gordon

/azp run

yeelam-gordon avatar Aug 28 '25 23:08 yeelam-gordon

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 28 '25 23:08 azure-pipelines[bot]

Hi @yeelam-gordon, anything which needs to be done from my side?

fm-sys avatar Sep 16 '25 14:09 fm-sys

@fm-sys Would you mind looking at the conflict? We can then review it and hopefully get it in for 0.97 :)

niels9001 avatar Dec 05 '25 11:12 niels9001

Seems like you were faster, thanks for resolving the conflicts for me :)

fm-sys avatar Dec 11 '25 02:12 fm-sys