2 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 b2f8982ee6 chore(release): 2.1.0 (#35)
* test(ui): keep the capture modes in a static array (CA1861)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(release): 2.1.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:15:08 +00:00
poli0981andClaude Opus 5.5 3f90cbe19a feat(a11y): keyboard region selection, screen-reader announcements and accessibility statement (#34)
- Region overlay: arrow keys move, Shift+arrows resize, Ctrl for 1-pixel
  steps, Tab/Shift+Tab switch monitor, Enter/Esc; keys held as temporary
  hotkeys (arrows auto-repeat, callbacks run in press order).
- LiveRegion behavior and Announcer: status text and notifications are
  announced to screen readers; notifications honour Windows' duration.
- Hotkey recorder: Tab/Shift+Tab leave without saving (Shift+Tab was saved
  as the hotkey); buttons named with their mode and binding.
- List items expose their badges; About cards named; disclaimer headings.
- Tray icon: Enter / Shift+F10 after Win+B; page transitions follow
  Windows' animation setting; contrast colours in the region overlay.
- ACCESSIBILITY.md, accessibility issue template, PR checklist, docs sync.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:09:46 +00:00
61 changed files with 1774 additions and 153 deletions

No files matched your search

+129
View File
@@ -0,0 +1,129 @@
name: Accessibility barrier
description: Something is hard or impossible to use with a keyboard, a screen reader, magnification, a contrast theme or other assistive technology.
title: "[a11y] "
labels: ["accessibility", "triage"]
body:
- type: markdown
attributes:
value: |
Thank you for reporting this. Accessibility barriers are handled before cosmetic issues;
see [ACCESSIBILITY.md](https://github.com/poli0981/captureimg/blob/main/ACCESSIBILITY.md)
for what is supported today and the known limitations.
You don't need to tell us about a disability or any other personal information. If you'd
rather not use GitHub, email `contact@poli0981.dev` instead.
- type: textarea
id: summary
attributes:
label: What were you trying to do?
description: The task, in a sentence or two.
placeholder: "Change the region hotkey in Settings using only the keyboard."
validations:
required: true
- type: textarea
id: actual
attributes:
label: What happened?
description: What you heard, saw or couldn't do.
placeholder: "Narrator reads the button as 'Region' but doesn't say which keys are set."
validations:
required: true
- type: textarea
id: expected
attributes:
label: What did you expect?
validations:
required: true
- type: textarea
id: repro
attributes:
label: Steps to reproduce
description: Starting from opening CaptureImage. Keys you pressed are especially helpful.
placeholder: |
1. Open Settings with Tab and Enter.
2. Tab to the Region hotkey.
3. …
- type: dropdown
id: technology
attributes:
label: Assistive technology or setting
multiple: true
options:
- Narrator
- NVDA
- JAWS
- Magnifier or another magnifier
- Voice access or speech recognition
- Keyboard only (no mouse)
- Contrast theme
- Large display scaling or text size
- Reduced motion (animation effects off)
- Other (please describe below)
validations:
required: true
- type: input
id: technology-version
attributes:
label: Assistive technology version
description: "For example `NVDA 2026.3`, or `built-in` for Narrator."
- type: input
id: version
attributes:
label: CaptureImage version
description: "Shown in the title bar and on the About page, e.g. `2.1.0 (abc1234)`."
validations:
required: true
- type: input
id: windows
attributes:
label: Windows version
description: "Run `winver`, e.g. `Windows 11 Pro 24H2 (26100.2454)`."
validations:
required: true
- type: input
id: language
attributes:
label: App language
description: "The language CaptureImage is shown in, e.g. English, Tiếng Việt, العربية."
- type: dropdown
id: impact
attributes:
label: How much does this affect you?
description: Your impression is enough; the maintainer assigns the final severity.
options:
- I can't complete the task at all
- I can complete it only with great difficulty or a workaround
- It is slower or confusing, but I can do it
- It is a small issue
- type: textarea
id: workaround
attributes:
label: Workaround
description: If you found a way around it, it may help others until it is fixed.
- type: textarea
id: attachments
attributes:
label: Screenshots, recordings or diagnostics (optional)
description: |
Only if you're comfortable sharing them. **Settings → Advanced → Export diagnostics**
creates a zip with your user paths removed.
- type: checkboxes
id: preflight
attributes:
label: Before submitting
options:
- label: I searched existing issues for a duplicate.
required: true
+3
View File
@@ -13,6 +13,9 @@ body:
reproduce the problem, then use **Export diagnostics** and attach the zip below (user
paths are removed automatically).
Something that is hard to use with a keyboard, a screen reader or another assistive
technology? Please use the **Accessibility barrier** template instead.
- type: textarea
id: summary
attributes:
@@ -45,6 +45,7 @@ body:
- Preview / editing
- Tray / hotkey
- Localization
- Accessibility (keyboard, screen readers, contrast, motion)
- Update / About / docs
- Build / release / installer
- Cloud upload (post-1.0)
+10
View File
@@ -20,6 +20,16 @@
- [ ] New or changed behavior is covered by tests
- [ ] Tried it in the app (describe what you checked)
## Accessibility (UI changes)
<!-- See ACCESSIBILITY.md → "Contributor expectations". Delete this section if no UI changed. -->
- [ ] Everything changed works with the keyboard alone, with a visible focus and no focus trap
- [ ] Controls have a unique accessible name (icon-only buttons too) and status text is announced
- [ ] Colour is not the only signal; theme brushes are used, and it looks right in a contrast theme
- [ ] New animations respect Windows' "Animation effects"; nothing takes the focus unasked
- [ ] Checked once with Narrator
## Checklist
- [ ] I read [`CONTRIBUTING.md`](../CONTRIBUTING.md) and license this contribution under GPL-3.0-or-later.
+261
View File
@@ -0,0 +1,261 @@
# Accessibility
CaptureImage should work for everyone who plays games on Windows. That includes people who use only
a keyboard, people who use a screen reader, magnification, a contrast theme or large display
scaling, and people who are sensitive to motion. This document describes what the app supports
today, what it does not support yet, how we test it, and how to report a barrier.
It is a statement of goals and of the current state, not a claim of conformance.
## Priorities
- **Target:** [WCAG 2.2](https://www.w3.org/TR/WCAG22/) level AA, applied to desktop software as
described in the W3C's [WCAG2ICT](https://www.w3.org/TR/wcag2ict-22/) guidance. This is a goal.
No formal audit has been made, so CaptureImage makes no conformance claim.
- **Keyboard:** everything can be done without a mouse, including region selection and the tray
icon. The one exception is listed under [known limitations](#known-limitations).
- **Screen readers:** every control has a name, and status changes and notifications are
announced. We test with Narrator.
- **Vision:** the app follows Windows contrast themes. Colour is never the only way information
is shown. Text stays sharp at any display scaling.
- **Motion and timing:** the app follows Windows' animation and notification-time settings, and
nothing flashes.
- **Stays out of your way:** notifications never take the keyboard focus away from your game or
your assistive technology.
- **Language:** the interface is available in 11 languages, and Arabic is laid out right to left.
## What works today
### Keyboard
- **Main window:** Tab and Shift+Tab move between controls. The arrow keys move within lists and
the navigation pane. Enter or Space activates the focused control.
- **Capture:** each capture mode has its own global hotkey (see the
[keyboard reference](#keyboard-reference)). The keys are registered only while CaptureImage is
armed.
- **Region selection:** the selection can be drawn, moved and resized with the keyboard. It works
on every monitor, even while a full-screen game keeps the keyboard focus.
- **Hotkey recorder:** you can record a new hotkey from the keyboard. Tab and Shift+Tab leave the
recorder without changing the hotkey.
- **Tray icon:** it can be reached with Win+B. Starting CaptureImage again from the Start menu also
brings its window back.
### Screen readers
- Buttons, toggles, lists and text fields have names. This includes buttons that show only an
icon, and each hotkey row's Clear and Reset buttons, which name their capture mode.
- **Status changes are read as they happen:**
- armed or disarmed
- the update status
- hotkey problems
- an invalid Steam App ID
- **Notifications are sent to screen readers** as UI Automation notification events. This happens
both from the main window and from the pop-up shown when the main window isn't in front. Errors
are marked as important.
- **List items are read with the details shown next to them:**
- Windows: title, process and the Steam, profile, minimized and locked badges.
- Captures: file name, game, date and HDR.
- Profiles: what the profile matches, and the auto-arm and disabled badges.
- **Headings:** page titles are level 1, sections are level 2 and the disclaimer headings on the
About page are level 3. In Narrator's scan mode (Caps Lock+Space), H jumps between them.
- The region overlay is named "Select an area", and its help text lists the keys. The size of the
selection is read when you change it with the keyboard.
### Vision
- **Themes:**
- Light, dark and high contrast are available in **Settings → Appearance**.
- **System** follows Windows, including its contrast themes.
- The region overlay draws its selection and labels in the contrast theme's colours.
- **Colour is backed by text:**
- The armed state is also shown as text on the Dashboard, in the tray icon's tooltip and in the
tray menu.
- Log levels and error messages are shown as words.
- The app is per-monitor DPI aware, so it stays sharp at any display scaling and across monitors
with different scaling.
### Motion and timing
- Page transitions are turned off when **Settings → Accessibility → Visual effects → Animation
effects** is off in Windows.
- Notification pop-ups stay up at least as long as **Dismiss notifications after this amount of
time** (same page in Windows Settings). Pointing at a pop-up keeps it open.
- Captures never depend on a time limit. The optional countdown (3, 5 or 10 seconds) is a feature
you choose, and Esc cancels a region selection at any time.
### Language
- English, Tiếng Việt, العربية, 日本語, 简体中文, 한국어, Español, Français, Deutsch, Português (Brasil)
and Русский.
- The language follows Windows on first run and can be changed in **Settings**.
## Keyboard reference
| Where | Keys | What they do |
|---|---|---|
| Anywhere, while armed | `Ctrl+Shift+F12` | Capture the window in front (or the locked window) |
| Anywhere, while armed | `Ctrl+Shift+F11` | Select a region to capture |
| Anywhere, while armed | `Ctrl+Shift+F10` | Capture the screen under the mouse pointer |
| Region selection | Arrow keys | Move the selection (the first press selects a centred area half the screen's width and height) |
| Region selection | `Shift` + arrow keys | Make the selection wider, narrower, taller or shorter |
| Region selection | `Ctrl` (with the above) | Move or resize by a single pixel |
| Region selection | `Tab` / `Shift+Tab` | Continue on the next / previous monitor |
| Region selection | `Enter` | Capture the selection, or the whole screen if nothing is selected |
| Region selection | `Esc` | Cancel |
| Preview | `Enter` / `Esc` / `Ctrl+C` | Save / discard / copy the capture |
| Settings → Hotkeys | `Enter` or `Space` on a hotkey | Start recording, then press the new combination |
| Settings → Hotkeys, recording | `Esc` / `Backspace` / `Tab` | Cancel / clear the hotkey / leave without changing it |
| Notification area | `Win+B`, arrow keys, then `Enter` | Show the CaptureImage window |
| Notification area | `Win+B`, arrow keys, then `Shift+F10` | Open the tray menu (capture, arm, settings, exit) |
The three capture hotkeys can be changed in **Settings → Hotkeys**. While the region overlay is up,
the arrow keys, Tab, Enter and Esc go to CaptureImage, and other apps get them back as soon as the
overlay closes.
## Supported environments
| Area | Status |
|---|---|
| Windows | Windows 11 22H2 or later, 64-bit (the same as the app) |
| Keyboard only | Supported and tested |
| Narrator | Supported and tested |
| NVDA, JAWS | Should work, because the app uses UI Automation; **not tested** |
| Magnifier | Should work; not tested |
| Voice access | Not tested |
| Contrast themes | Supported (Theme: System or High contrast) |
| Display scaling | Supported per monitor, including mixed scaling |
| Windows "Text size" | **Not supported** (see [known limitations](#known-limitations)) |
## Testing record
| Date | Version | Environment | Method | Result |
|---|---|---|---|---|
| 2026-11-09 | 2.0.3 | Windows 11 (Insider build 29648) | Maintainer: keyboard only with the mouse disconnected, and Narrator, across the main window's pages | No blocking problems found |
Version 2.1.0 adds keyboard region selection, the announcements and the other changes listed in
the [changelog](CHANGELOG.md). Unit tests and the UI tests cover them, but they have not yet been
checked by hand with Narrator.
On every pull request, CI checks that:
- every page opens and has its automation id;
- the hotkey buttons have distinct names that include the current binding;
- Tab leaves the hotkey recorder without saving a hotkey;
- arming the hotkeys raises a live-region announcement.
## Known limitations
| Limitation | Workaround |
|---|---|
| The app doesn't follow **Settings → Accessibility → Text size** (a WPF limitation). | Increase **Settings → System → Display → Scale**, or use Magnifier (`Win` + `+`). |
| Pinned thumbnails work only with a mouse. They never take the focus, so they can't interrupt a game. | The **Library** offers the same actions from the keyboard: open, copy, show in folder. |
| Notifications close on their own. | Everything they report is also in the **Library** (captures) and on the **Logs** page. Windows' notification-time setting makes them stay longer. |
| A capture has no text description. | **Extract text** (Preview or Library) copies the text inside a capture to the clipboard. |
| While armed, a capture hotkey doesn't reach other apps. A clash with a shortcut of your assistive technology is possible. | Change the hotkey in **Settings → Hotkeys**, or disarm. The keys are only held while armed. |
| Translations are machine-assisted, so wording or pronunciation may be off. | Please report it (see below); corrections from native speakers are welcome. |
| Screen readers other than Narrator haven't been tested. | Reports from NVDA and JAWS users are especially welcome. |
## Contributor expectations
Accessibility is part of "done" for every change to the user interface.
**Testing.** Before opening a pull request that changes the UI:
- Use every changed screen with the keyboard alone, with a visible focus at every step and no
place where the focus gets stuck.
- Check it once with Narrator (`Ctrl+Win+Enter`). Every control should be read with a name, a role
and a state, and changes should be announced.
- Check it in a Windows contrast theme and at 200 % display scaling.
- Optionally run [Accessibility Insights for Windows](https://accessibilityinsights.io/docs/windows/overview/)
FastPass on the changed window.
**User interface (XAML).**
- Give every control that shows only an icon an `AutomationProperties.Name`. Names must be unique
within a page, so add the context (the mode, the card) when the same action appears twice.
- Give list items an accessible name that includes the badges shown next to them (see
`TargetItemViewModel.AutomationName`).
- Use the `PageTitle` and `SectionHeader` styles (which set heading levels) for headings, and
`AutomationProperties.HeadingLevel` for any other heading.
- Text that changes to report a status needs `AutomationProperties.LiveSetting`,
`a11y:LiveRegion.IsEnabled="True"` and a binding with `NotifyOnTargetUpdated=True`. WPF doesn't
announce live regions on its own.
- Use theme brushes (`{DynamicResource …}`), not hard-coded colours. Never use colour alone to show
a state.
- New animations must respect `SystemParameters.ClientAreaAnimation`. Notifications and pop-ups
must not take the focus.
- Every new string goes into all 11 language files, including names and help text read only by
screen readers.
**Documentation.**
- Use headings in order, without skipping a level.
- Write link text that says where the link goes.
- Give images alt text that describes them, for example the README screenshots.
- Keep tables for tabular data, and give diagrams (such as the Mermaid diagrams in
`docs/ARCHITECTURE.md`) a text explanation next to them.
**CI.** There is no automated accessibility scanner for WPF in CI. The `ui-tests` job checks
automation ids, names and announcements through UI Automation. Reviews use the accessibility
checklist in the pull request template.
## Reporting accessibility issues
If something in CaptureImage is hard or impossible to use with your setup, please tell us:
- Open an [accessibility issue](https://github.com/poli0981/captureimg/issues/new?template=accessibility.yml).
- Or, if you'd rather not use GitHub, email `contact@poli0981.dev`.
It helps to include:
- what you were trying to do, what you expected and what happened;
- your assistive technology and its version (or "keyboard only", "contrast theme", …);
- your Windows version, the CaptureImage version (shown on the About page) and the app's
language.
Screenshots and recordings are optional. You never need to tell us about a disability or any
other personal information.
### Severity
The maintainer assigns a severity when triaging a report:
| Severity | Meaning |
|---|---|
| Critical | Blocks a core task with no workaround: capturing, arming or disarming, changing hotkeys, finding your captures, updating |
| Serious | A core task is possible only with great difficulty or a workaround |
| Moderate | Something is slower, confusing or inconsistent, but works |
| Minor | A small issue with little effect on use |
### How we respond
CaptureImage is maintained by one volunteer, so there are **no fixed response or fix times**. That
is the same as for other reports (see [`SUPPORT.md`](SUPPORT.md)). What you can expect:
- Every report is read and labelled `accessibility`.
- Questions are asked respectfully, without doubting your experience.
- Critical and Serious barriers are fixed before cosmetic work, usually in the next release.
- A workaround is suggested when one exists.
- The fix is listed in the [changelog](CHANGELOG.md). If you're willing, we'll ask you to confirm
that it works for you.
## Ownership
The maintainer, [poli0981](https://github.com/poli0981), is responsible for accessibility. That
means:
- triaging accessibility reports and keeping their issues up to date;
- running the keyboard and Narrator check before releases that change the user interface;
- keeping this document current: the features, the known limitations and the testing record.
## Feedback
Suggestions for this statement or for our practices are welcome in
[GitHub Discussions](https://github.com/poli0981/captureimg/discussions). An actual barrier is best
reported as described [above](#reporting-accessibility-issues).
This statement is based on the template of the
[Open Source Accessibility toolkit](https://github.com/open-source-accessibility/accessibility-toolkit)
and the [Open Source Guide on accessibility](https://opensource.guide/accessibility-best-practices-for-your-project/).
_Last reviewed: 2026-11-09, for CaptureImage 2.1.0._
+55
View File
@@ -7,6 +7,61 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [2.1.0] - 2026-11-09
### Added
- **Region selection from the keyboard.**
- In the region overlay, the arrow keys move the selection. The first press selects a centred
area.
- Shift+arrows resize the selection. Holding Ctrl moves or resizes it one pixel at a time.
- Tab and Shift+Tab continue on the next or previous monitor, Enter captures and Esc cancels.
- The keys work even while a full-screen game keeps the keyboard focus. Holding an arrow key
repeats it. Mouse and keyboard can be combined, for example to drag an area and then
fine-tune it.
- **Screen readers hear what changes.** Narrator and other UI Automation screen readers now
announce:
- capture notifications, sent as UI Automation notification events;
- the armed status;
- the update status;
- hotkey problems and an invalid Steam App ID.
- **Tray icon from the keyboard.** After Win+B, Enter shows the CaptureImage window and Shift+F10
opens its menu.
- [`ACCESSIBILITY.md`](https://github.com/poli0981/captureimg/blob/main/ACCESSIBILITY.md) describes what CaptureImage supports for keyboard, screen
reader, contrast and motion users. It lists every key, what has been tested, the known
limitations, and how to report a barrier.
### Changed
- Page transitions are turned off when Windows' **Animation effects** setting is off.
- Notifications stay up at least as long as Windows' **Dismiss notifications after this amount of
time** setting.
- In a Windows contrast theme, the region overlay draws its selection and labels in the theme's
colours. Its hint now lists the keyboard keys.
- Screen readers read more detail:
- each hotkey button now includes its current combination;
- window, capture and profile list items include the badges shown next to them (Steam, profile,
minimized, locked, HDR, auto-arm, disabled);
- each hotkey row's Clear and Reset buttons, the About page's contact cards and repeated buttons
such as "Open folder" now say what they belong to;
- the disclaimer headings on the About page are headings.
### Fixed
- While recording a hotkey, Shift+Tab was saved as the new hotkey, and Tab left the keyboard focus
stuck on the button. Both keys now end recording without changing the hotkey and move the focus
on.
- The announcement of a notification pop-up could be lost before a screen reader read it. Pop-ups
now send their text with the notification event itself.
### Project
- New **Accessibility barrier** issue template and `accessibility` label.
- The pull request template has an accessibility checklist, and `CONTRIBUTING.md` points to the
rules for user-interface changes.
- UI tests check the live-region announcement and the hotkey buttons' names, and that Tab leaves
the recorder.
## [2.0.3] - 2026-11-09
### Changed
+15
View File
@@ -68,6 +68,21 @@ tests/* Core, Infrastructure, ViewModels tests + App.Ui
`[LibraryImport]` rather than `[DllImport]` (SYSLIB1054). Fixers for one diagnostic at a time are
safe: `dotnet format style|analyzers --diagnostics <ID> --severity info`.
## Accessibility
[`ACCESSIBILITY.md`](ACCESSIBILITY.md) is the public statement (supported keys, testing record, known
limitations) — update it when UI behaviour changes. In XAML:
- Every icon-only control gets `AutomationProperties.Name`, unique per page (add the mode or card
when an action repeats); list items bind the container's name to an `AutomationName` that
includes their badges.
- Status text: `AutomationProperties.LiveSetting` + `a11y:LiveRegion.IsEnabled="True"` + a
binding with `NotifyOnTargetUpdated=True` (WPF never raises `LiveRegionChanged` itself);
notifications go through `Announcer`.
- Headings via the `PageTitle`/`SectionHeader` styles or `AutomationProperties.HeadingLevel`; theme
brushes, never colour alone; animations honour `SystemParameters.ClientAreaAnimation`; nothing
takes the focus from a game.
## Pitfalls already hit
- System.Text.Json source generation treats `init` properties as constructor parameters, so a
+7
View File
@@ -12,6 +12,9 @@ Please follow the [Code of Conduct](CODE_OF_CONDUCT.md).
file-name tokens unchanged.
- **Fix a bug or build a feature.** For anything larger than a small fix, please open an issue or a
discussion first so we can agree on the approach.
- **Report or fix an accessibility barrier.** Reports from people who use a screen reader, a
contrast theme or only a keyboard are especially valuable — see
[`ACCESSIBILITY.md`](ACCESSIBILITY.md).
## Development setup
@@ -71,6 +74,10 @@ Conventions:
- Packages are managed centrally in `Directory.Packages.props` with lock files; after changing a
dependency run `dotnet restore --force-evaluate` and commit the updated `packages.lock.json` files.
- Commits must be signed (GPG or SSH) — the `main` branch requires verified signatures.
- User-interface changes follow the accessibility rules in
[`ACCESSIBILITY.md`](ACCESSIBILITY.md#contributor-expectations): keyboard access, unique
accessible names, announced status text, theme brushes, reduced motion — and a quick check with
Narrator. The pull request template has a checklist.
Before pushing, the quick local check is:
+1 -1
View File
@@ -34,7 +34,7 @@
</PropertyGroup>
<PropertyGroup Label="Version (single source of truth — the release workflow checks the tag against it)">
<Version>2.0.3</Version>
<Version>2.1.0</Version>
<AssemblyVersion>$([System.Text.RegularExpressions.Regex]::Match('$(Version)', '^\d+\.\d+\.\d+').Value).0</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
+12
View File
@@ -52,6 +52,9 @@ small tray app that does nothing until you press a hotkey.
Français, Deutsch, Português (Brasil), Русский. Translations are machine-assisted — see
[`docs/legal/DISCLAIMER.md`](docs/legal/DISCLAIMER.md).
- **Light, dark and high-contrast themes**, following Windows by default.
- **Keyboard and screen-reader friendly** — everything works without a mouse, including region
selection with the arrow keys; Narrator reads every control, status change and notification. See
[`ACCESSIBILITY.md`](ACCESSIBILITY.md).
- **Start with Windows**, start minimized, arm on startup.
- **Private by default** — no telemetry, no account, no cloud. The only network request is the
update check. See [`docs/legal/PRIVACY.md`](docs/legal/PRIVACY.md).
@@ -117,6 +120,15 @@ Tips:
- Settings, logs and the library index are kept in `%LocalAppData%\poli0981\CaptureImage`.
**Settings → Advanced → Export diagnostics** creates a zip for bug reports (user paths removed).
## Accessibility
CaptureImage aims to be fully usable with a keyboard, a screen reader (tested with Narrator), a
contrast theme and large display scaling, and it follows Windows' animation and notification-time
settings. In the region overlay the arrow keys move the selection, Shift+arrows resize it, Tab moves
to the next monitor and Enter captures. [`ACCESSIBILITY.md`](ACCESSIBILITY.md) lists every key, what
has been tested, the known limitations, and how to
[report a barrier](https://github.com/poli0981/captureimg/issues/new?template=accessibility.yml).
## Build from source
You need the **.NET 10 SDK** (the exact version is pinned in [`global.json`](global.json)) on
+3 -1
View File
@@ -53,7 +53,9 @@ targets rather than guarantees.
described in the [README](README.md#unsigned-installer--smartscreen).
- An anti-cheat system flags the app — CaptureImage doesn't inject into or read from games, but we
can't control how anti-cheat software classifies capture tools.
- Translation, documentation or accessibility issues, and feature requests.
- Translation or documentation issues, and feature requests.
- Accessibility barriers — please use the accessibility issue template described in
[`ACCESSIBILITY.md`](ACCESSIBILITY.md#reporting-accessibility-issues).
## After you report
+1
View File
@@ -7,6 +7,7 @@ CaptureImage is maintained by one volunteer. Here is where to go:
| Ask a question or share an idea | [GitHub Discussions](https://github.com/poli0981/captureimg/discussions) |
| Report a bug | [Bug report](https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml) — or **About → Report a bug** in the app |
| Suggest a feature | [Feature request](https://github.com/poli0981/captureimg/issues/new?template=feature_request.yml) |
| Report an accessibility barrier | [Accessibility barrier](https://github.com/poli0981/captureimg/issues/new?template=accessibility.yml) or `contact@poli0981.dev` — see [`ACCESSIBILITY.md`](ACCESSIBILITY.md) |
| Report a security problem | Privately — see [`SECURITY.md`](SECURITY.md) (`security@poli0981.dev`) |
| Ask about privacy | `privacy@poli0981.dev` — see [`docs/legal/PRIVACY.md`](docs/legal/PRIVACY.md) |
| Raise a game-compatibility or anti-cheat concern (publishers, vendors) | `games@poli0981.dev` |
+13 -3
View File
@@ -95,8 +95,10 @@ sequenceDiagram
- Registration results (registered, conflict, invalid) are shown on the Dashboard and in Settings.
- While the hotkey recorder in Settings is listening, the coordinator suspends the hotkeys so the
current combination can be pressed again.
- During region selection Esc and Enter are registered temporarily, so they work even when a
full-screen game keeps the keyboard focus.
- During region selection the overlay's keys (`RegionKeyboard` in Core: Esc, Enter, Tab,
Shift+Tab, and the arrow keys with Shift / Ctrl) are registered temporarily, so they work even
when a full-screen game keeps the keyboard focus. The arrow keys auto-repeat; temporary-key
callbacks run off the hotkey thread one at a time, in the order the keys were pressed.
### Coordinator
@@ -162,7 +164,15 @@ stateDiagram-v2
- Region overlays are placed over each monitor in physical pixels and show the frozen frame at the
monitor's DPI, so one image pixel is one screen pixel; the selection is converted back to physical
pixels.
- The tray icon (H.NotifyIcon) shows a red dot while armed and is re-added after Explorer restarts.
- The tray icon (H.NotifyIcon) shows a red dot while armed and is re-added after Explorer restarts;
Enter and Shift+F10 on it (after Win+B) show the window and open the menu.
- Accessibility (see [`ACCESSIBILITY.md`](../ACCESSIBILITY.md)): pages expose themselves through
`PageAutomationPeer`, and every control has an automation id and name. Status text uses
`LiveRegion` (`CaptureImage.UI/Accessibility`) to raise `LiveRegionChanged`, which WPF never
does on its own. Notifications are read through `Announcer` (UI Automation notification events)
and stay up at least as long as Windows' notification-time setting. Page transitions follow
`SystemParameters.ClientAreaAnimation`, and region overlays use system colours in contrast
themes.
- The main window hides to the tray while it idles and the process then runs in Windows' efficiency
mode (EcoQoS), lifted during captures.
+3
View File
@@ -55,6 +55,9 @@ The workflow then:
(`Update.exe apply --package <full.nupkg>` in the install folder, or the in-app updater once
published) — settings are kept and migrated.
- [ ] The portable zip starts with `--smoke-test --data-dir <temp>` and exits 0.
- [ ] If the release changes the user interface: a quick pass with the keyboard alone and with
Narrator over the changed screens (see [`ACCESSIBILITY.md`](../ACCESSIBILITY.md)); add the
result to its testing record.
## 4. Publish
+1 -1
View File
@@ -1,6 +1,6 @@
# Third-party Notices
_Last updated: 2026-11-09 (CaptureImage 2.0.3)_
_Last updated: 2026-11-09 (CaptureImage 2.1.0)_
CaptureImage is built on open-source components. This file lists every package that ships with
the app, with its license and upstream project; the short form is the repository root
+4 -4
View File
@@ -356,7 +356,7 @@
"captureimage.infrastructure": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.3, )",
"CaptureImage.Core": "[2.1.0, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )",
"Serilog": "[4.4.0, )",
"SkiaSharp": "[4.154.0, )",
@@ -369,8 +369,8 @@
"captureimage.ui": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.3, )",
"CaptureImage.ViewModels": "[2.0.3, )",
"CaptureImage.Core": "[2.1.0, )",
"CaptureImage.ViewModels": "[2.1.0, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"H.NotifyIcon.Wpf": "[2.4.1, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
@@ -381,7 +381,7 @@
"captureimage.viewmodels": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.3, )",
"CaptureImage.Core": "[2.1.0, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
@@ -49,8 +49,13 @@ public interface IHotkeyService : IDisposable
bool IsTakenByAnotherApp(HotkeyBinding binding);
/// <summary>
/// Register extra keys for a short time (Esc / Enter while the region overlay is up, so
/// they work even if the overlay never gets keyboard focus). Dispose to release them.
/// Register extra keys for a short time (the region overlay's keys, so they work even if
/// the overlay never gets keyboard focus). Keys another program holds are skipped. The
/// callback runs off the hotkey thread, one press at a time and in the order the keys were
/// pressed. Dispose to release the keys.
/// </summary>
IDisposable RegisterTemporary(IReadOnlyList<HotkeyBinding> bindings, Action<HotkeyBinding> callback);
/// <param name="bindings">The keys to hold.</param>
/// <param name="callback">Called with the binding of each press.</param>
/// <param name="repeat">Whether holding a key down repeats it (arrow keys) instead of firing once.</param>
IDisposable RegisterTemporary(IReadOnlyList<HotkeyBinding> bindings, Action<HotkeyBinding> callback, bool repeat = false);
}
@@ -0,0 +1,181 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using CaptureImage.Core.Models;
namespace CaptureImage.Core.Capture;
/// <summary>What a key does while the region overlay is up.</summary>
public enum RegionKeyAction
{
/// <summary>Close the overlay without capturing (Esc).</summary>
Cancel,
/// <summary>Capture the selection, or the whole monitor when nothing is selected (Enter).</summary>
Confirm,
/// <summary>Move the selection by <see cref="RegionKeyCommand.Dx"/> / <see cref="RegionKeyCommand.Dy"/>.</summary>
Move,
/// <summary>Grow or shrink the selection from its bottom-right corner.</summary>
Resize,
/// <summary>Continue on the next monitor (Tab).</summary>
NextMonitor,
/// <summary>Continue on the previous monitor (Shift+Tab).</summary>
PreviousMonitor,
}
/// <summary>A key press translated for the region overlay; the offsets are in physical pixels.</summary>
public readonly record struct RegionKeyCommand(RegionKeyAction Action, int Dx = 0, int Dy = 0);
/// <summary>
/// Keyboard control of the region overlay, in physical pixels relative to the monitor: the
/// arrow keys move the selection, Shift+arrows resize it, Ctrl turns either into a one-pixel
/// step, Tab / Shift+Tab continue on the next / previous monitor, Enter captures and Esc
/// cancels. The keys are registered only while the overlay is up, so they work even when a
/// full-screen game keeps the keyboard focus.
/// </summary>
public static class RegionKeyboard
{
/// <summary>Smallest selection, in physical pixels, that is captured instead of the whole monitor.</summary>
public const int MinimumSize = 4;
/// <summary>Length of a normal step in device-independent pixels (scaled by the monitor's DPI).</summary>
public const int StepDips = 10;
private const uint VkTab = 0x09;
private const uint VkEnter = 0x0D;
private const uint VkEscape = 0x1B;
private const uint VkLeft = 0x25;
private const uint VkUp = 0x26;
private const uint VkRight = 0x27;
private const uint VkDown = 0x28;
/// <summary>Keys that act once per press: Esc, Enter, Tab and Shift+Tab.</summary>
public static IReadOnlyList<HotkeyBinding> SingleKeys { get; } =
[
new(HotkeyModifiers.None, VkEscape),
new(HotkeyModifiers.None, VkEnter),
new(HotkeyModifiers.None, VkTab),
new(HotkeyModifiers.Shift, VkTab),
];
/// <summary>The arrow keys alone and with Shift, Ctrl and Ctrl+Shift; holding one repeats it.</summary>
public static IReadOnlyList<HotkeyBinding> RepeatingKeys { get; } =
[
.. new[] { HotkeyModifiers.None, HotkeyModifiers.Shift, HotkeyModifiers.Control, HotkeyModifiers.Control | HotkeyModifiers.Shift }
.SelectMany(modifiers => new[] { VkLeft, VkUp, VkRight, VkDown }.Select(key => new HotkeyBinding(modifiers, key))),
];
/// <summary>A normal step in physical pixels on a monitor with the given scale (1.0 = 100 %).</summary>
public static int StepFor(double scale) => Math.Max(1, (int)Math.Round(StepDips * scale, MidpointRounding.AwayFromZero));
/// <summary>What <paramref name="key"/> does, or <see langword="null"/> when the overlay ignores it.</summary>
/// <param name="key">The key and the modifiers held with it.</param>
/// <param name="step">Length of a normal step in physical pixels (see <see cref="StepFor"/>).</param>
public static RegionKeyCommand? Map(HotkeyBinding key, int step)
{
var modifiers = key.Modifiers;
switch (key.VirtualKey)
{
case VkEscape when modifiers == HotkeyModifiers.None:
return new RegionKeyCommand(RegionKeyAction.Cancel);
case VkEnter when modifiers == HotkeyModifiers.None:
return new RegionKeyCommand(RegionKeyAction.Confirm);
case VkTab when modifiers == HotkeyModifiers.None:
return new RegionKeyCommand(RegionKeyAction.NextMonitor);
case VkTab when modifiers == HotkeyModifiers.Shift:
return new RegionKeyCommand(RegionKeyAction.PreviousMonitor);
}
if ((modifiers & ~(HotkeyModifiers.Control | HotkeyModifiers.Shift)) != 0)
{
return null;
}
(int X, int Y)? direction = key.VirtualKey switch
{
VkLeft => (-1, 0),
VkRight => (1, 0),
VkUp => (0, -1),
VkDown => (0, 1),
_ => null,
};
if (direction is not { } d)
{
return null;
}
var distance = modifiers.HasFlag(HotkeyModifiers.Control) ? 1 : Math.Max(1, step);
var action = modifiers.HasFlag(HotkeyModifiers.Shift) ? RegionKeyAction.Resize : RegionKeyAction.Move;
return new RegionKeyCommand(action, d.X * distance, d.Y * distance);
}
/// <summary>The selection a first arrow key creates: half the monitor, centred.</summary>
public static PixelRect Initial(int width, int height)
{
var w = Math.Max(1, width / 2);
var h = Math.Max(1, height / 2);
return new PixelRect((width - w) / 2, (height - h) / 2, w, h);
}
/// <summary>
/// The selection after <paramref name="command"/> on a monitor of the given size. Without a
/// selection a move or resize only creates the <see cref="Initial"/> one. Moves stop at the
/// monitor's edges; resizes keep the top-left corner and stay between
/// <see cref="MinimumSize"/> and the monitor's edges.
/// </summary>
public static PixelRect? Apply(PixelRect? current, RegionKeyCommand command, int width, int height)
{
if (command.Action is not (RegionKeyAction.Move or RegionKeyAction.Resize))
{
return current;
}
if (current is not { IsEmpty: false } rect)
{
return Initial(width, height);
}
return command.Action == RegionKeyAction.Move
? rect with
{
X = Math.Clamp(rect.X + command.Dx, 0, Math.Max(0, width - rect.Width)),
Y = Math.Clamp(rect.Y + command.Dy, 0, Math.Max(0, height - rect.Height)),
}
: rect with
{
Width = ClampSize(rect.Width + command.Dx, width - rect.X),
Height = ClampSize(rect.Height + command.Dy, height - rect.Y),
};
}
/// <summary>
/// Index of the monitor after (or before) <paramref name="current"/>, ordering the monitors
/// left to right and then top to bottom and wrapping around at the ends.
/// </summary>
public static int Cycle(IReadOnlyList<PixelRect> monitors, int current, bool backwards)
{
ArgumentNullException.ThrowIfNull(monitors);
if (monitors.Count == 0)
{
return current;
}
var order = Enumerable.Range(0, monitors.Count)
.OrderBy(i => monitors[i].X)
.ThenBy(i => monitors[i].Y)
.ToList();
var position = order.IndexOf(current);
if (position < 0)
{
return order[0];
}
return order[(position + (backwards ? order.Count - 1 : 1)) % order.Count];
}
private static int ClampSize(int value, int available) => Math.Clamp(value, Math.Min(MinimumSize, available), available);
}
@@ -19,7 +19,8 @@ namespace CaptureImage.Infrastructure.Win32;
/// <remarks>
/// A registered combination is consumed by Windows and never reaches other applications,
/// which is why bindings are only registered while the coordinator is armed.
/// <c>MOD_NOREPEAT</c> is always added so holding a key fires once.
/// <c>MOD_NOREPEAT</c> is added so holding a capture key fires once; temporary keys can opt
/// into auto-repeat (the region overlay's arrow keys).
/// </remarks>
public sealed partial class Win32HotkeyService : IHotkeyService
{
@@ -34,6 +35,7 @@ public sealed partial class Win32HotkeyService : IHotkeyService
private readonly Dictionary<int, (HotkeyBinding Binding, Action<HotkeyBinding> Callback)> _temporaryIds = [];
private IReadOnlyList<HotkeyRegistration> _registrations = [];
private int _nextTemporaryId = FirstTemporaryId;
private Task _temporaryQueue = Task.CompletedTask;
private bool _disposed;
public Win32HotkeyService(ILogger<Win32HotkeyService> logger)
@@ -134,7 +136,7 @@ public sealed partial class Win32HotkeyService : IHotkeyService
});
}
public IDisposable RegisterTemporary(IReadOnlyList<HotkeyBinding> bindings, Action<HotkeyBinding> callback)
public IDisposable RegisterTemporary(IReadOnlyList<HotkeyBinding> bindings, Action<HotkeyBinding> callback, bool repeat = false)
{
ArgumentNullException.ThrowIfNull(bindings);
ArgumentNullException.ThrowIfNull(callback);
@@ -146,7 +148,7 @@ public sealed partial class Win32HotkeyService : IHotkeyService
foreach (var binding in bindings)
{
var id = _nextTemporaryId++;
if (PInvoke.RegisterHotKey(HWND.Null, id, ToModifiers(binding.Modifiers), binding.VirtualKey))
if (PInvoke.RegisterHotKey(HWND.Null, id, ToModifiers(binding.Modifiers, noRepeat: !repeat), binding.VirtualKey))
{
lock (_gate)
{
@@ -263,12 +265,20 @@ public sealed partial class Win32HotkeyService : IHotkeyService
}
else if (temporary is { } t)
{
ThreadPool.QueueUserWorkItem(_ => t.Callback(t.Binding));
// One press at a time, in order: a held arrow key and the Enter after it must not overtake each other.
lock (_gate)
{
_temporaryQueue = _temporaryQueue.ContinueWith(
_ => t.Callback(t.Binding),
CancellationToken.None,
TaskContinuationOptions.None,
TaskScheduler.Default);
}
}
}
private static HOT_KEY_MODIFIERS ToModifiers(HotkeyModifiers modifiers) =>
(HOT_KEY_MODIFIERS)(uint)modifiers | HOT_KEY_MODIFIERS.MOD_NOREPEAT;
private static HOT_KEY_MODIFIERS ToModifiers(HotkeyModifiers modifiers, bool noRepeat = true) =>
noRepeat ? (HOT_KEY_MODIFIERS)(uint)modifiers | HOT_KEY_MODIFIERS.MOD_NOREPEAT : (HOT_KEY_MODIFIERS)(uint)modifiers;
[LoggerMessage(Level = LogLevel.Warning, Message = "{Mode} hotkey {Binding} not registered: {Status}.")]
private partial void LogNotRegistered(CaptureMode mode, string binding, HotkeyRegistrationStatus status);
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
namespace CaptureImage.UI.Accessibility;
/// <summary>
/// Reads a notification to screen readers with a UI Automation notification event; the text
/// travels with the event, so it doesn't depend on what has focus or is visible.
/// </summary>
public static class Announcer
{
private const string ActivityId = "CaptureImage.Notification";
/// <summary>Announce <paramref name="text"/> from <paramref name="source"/>.</summary>
/// <param name="source">An element of the window the notification belongs to.</param>
/// <param name="text">What to read.</param>
/// <param name="important">Errors: read even when the user is busy, replacing older notifications.</param>
public static void Announce(UIElement source, string text, bool important = false)
{
ArgumentNullException.ThrowIfNull(source);
if (string.IsNullOrWhiteSpace(text) || !AutomationPeer.ListenerExists(AutomationEvents.Notification))
{
return;
}
UIElementAutomationPeer.CreatePeerForElement(source)?.RaiseNotificationEvent(
AutomationNotificationKind.Other,
important ? AutomationNotificationProcessing.ImportantMostRecent : AutomationNotificationProcessing.MostRecent,
text,
ActivityId);
}
/// <summary>"Title. Message", or just the title when there is no message.</summary>
public static string Compose(string title, string? message) =>
string.IsNullOrEmpty(message) ? title : $"{title}. {message}";
}
@@ -0,0 +1,100 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Threading;
namespace CaptureImage.UI.Accessibility;
/// <summary>
/// Makes a screen reader read a status text when it changes. WPF never raises
/// <c>LiveRegionChanged</c> on its own, so <c>AutomationProperties.LiveSetting</c> alone stays
/// silent: with <c>IsEnabled</c> set, the element raises it when a binding with
/// <c>NotifyOnTargetUpdated=True</c> updates its text and when it becomes visible. Changes in
/// quick succession are announced once.
/// </summary>
public static class LiveRegion
{
public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached(
"IsEnabled",
typeof(bool),
typeof(LiveRegion),
new PropertyMetadata(false, OnIsEnabledChanged));
private static readonly DependencyProperty IsPendingProperty = DependencyProperty.RegisterAttached(
"IsPending",
typeof(bool),
typeof(LiveRegion),
new PropertyMetadata(false));
public static bool GetIsEnabled(DependencyObject element)
{
ArgumentNullException.ThrowIfNull(element);
return (bool)element.GetValue(IsEnabledProperty);
}
public static void SetIsEnabled(DependencyObject element, bool value)
{
ArgumentNullException.ThrowIfNull(element);
element.SetValue(IsEnabledProperty, value);
}
/// <summary>Announce <paramref name="element"/> (its accessible name) on the next idle moment.</summary>
public static void Announce(UIElement element)
{
ArgumentNullException.ThrowIfNull(element);
if ((bool)element.GetValue(IsPendingProperty))
{
return;
}
element.SetValue(IsPendingProperty, true);
element.Dispatcher.BeginInvoke(DispatcherPriority.Background, () =>
{
element.SetValue(IsPendingProperty, false);
if (!element.IsVisible
|| element is TextBlock { Text.Length: 0 }
|| !AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged))
{
return;
}
UIElementAutomationPeer.CreatePeerForElement(element)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
});
}
private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is not UIElement element)
{
return;
}
element.RemoveHandler(Binding.TargetUpdatedEvent, (EventHandler<DataTransferEventArgs>)OnTargetUpdated);
element.IsVisibleChanged -= OnIsVisibleChanged;
if (e.NewValue is true)
{
element.AddHandler(Binding.TargetUpdatedEvent, (EventHandler<DataTransferEventArgs>)OnTargetUpdated);
element.IsVisibleChanged += OnIsVisibleChanged;
}
}
private static void OnTargetUpdated(object? sender, DataTransferEventArgs e)
{
if (ReferenceEquals(e.TargetObject, sender) && e.Property == TextBlock.TextProperty && sender is UIElement element)
{
Announce(element);
}
}
private static void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue is true && sender is UIElement element)
{
Announce(element);
}
}
}
+12 -37
View File
@@ -10,8 +10,9 @@ namespace CaptureImage.UI.Controls;
/// <summary>
/// Attached to the hotkey button in Settings: while its <see cref="HotkeyBindingViewModel"/>
/// is recording, key presses are turned into a binding. Esc cancels, Backspace/Delete clear;
/// Alt combinations arrive as <see cref="Key.System"/> and Print Screen only as a key-up.
/// is recording, key presses are turned into a binding. Esc cancels, Backspace/Delete clear,
/// Tab / Shift+Tab cancel and move the focus on; Alt combinations arrive as
/// <see cref="Key.System"/> and Print Screen only as a key-up.
/// </summary>
public static class HotkeyRecorder
{
@@ -63,9 +64,14 @@ public static class HotkeyRecorder
return;
}
var key = KeyInput.ActualKey(e);
var modifiers = KeyInput.CurrentModifiers();
if (vm.ReleaseFocus(modifiers, (uint)KeyInterop.VirtualKeyFromKey(key)))
{
return; // not handled: Tab moves the focus as usual
}
e.Handled = true;
var key = ActualKey(e);
var modifiers = CurrentModifiers();
if (modifiers == HotkeyModifiers.None && key == Key.Escape)
{
vm.CancelRecordingCommand.Execute(null);
@@ -83,44 +89,13 @@ public static class HotkeyRecorder
private static void OnPreviewKeyUp(object sender, KeyEventArgs e)
{
// Windows never delivers a key-down for Print Screen.
if (Recording(sender) is { } vm && ActualKey(e) == Key.Snapshot)
if (Recording(sender) is { } vm && KeyInput.ActualKey(e) == Key.Snapshot)
{
e.Handled = true;
vm.Submit(CurrentModifiers(), VkSnapshot);
vm.Submit(KeyInput.CurrentModifiers(), VkSnapshot);
}
}
private static void OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) =>
Recording(sender)?.CancelRecordingCommand.Execute(null);
private static Key ActualKey(KeyEventArgs e) => e.Key switch
{
Key.System => e.SystemKey,
Key.ImeProcessed => e.ImeProcessedKey,
Key.DeadCharProcessed => e.DeadCharProcessedKey,
_ => e.Key,
};
private static HotkeyModifiers CurrentModifiers()
{
var keyboard = Keyboard.Modifiers;
var modifiers = HotkeyModifiers.None;
if (keyboard.HasFlag(ModifierKeys.Control))
{
modifiers |= HotkeyModifiers.Control;
}
if (keyboard.HasFlag(ModifierKeys.Alt))
{
modifiers |= HotkeyModifiers.Alt;
}
if (keyboard.HasFlag(ModifierKeys.Shift))
{
modifiers |= HotkeyModifiers.Shift;
}
if (keyboard.HasFlag(ModifierKeys.Windows))
{
modifiers |= HotkeyModifiers.Win;
}
return modifiers;
}
}
+47
View File
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Windows.Input;
using CaptureImage.Core.Models;
namespace CaptureImage.UI.Controls;
/// <summary>Turns WPF key events into the Win32 virtual keys and modifiers hotkeys use.</summary>
internal static class KeyInput
{
/// <summary>The key that was really pressed: Alt combinations arrive as <see cref="Key.System"/>.</summary>
public static Key ActualKey(KeyEventArgs e) => e.Key switch
{
Key.System => e.SystemKey,
Key.ImeProcessed => e.ImeProcessedKey,
Key.DeadCharProcessed => e.DeadCharProcessedKey,
_ => e.Key,
};
public static HotkeyModifiers CurrentModifiers()
{
var keyboard = Keyboard.Modifiers;
var modifiers = HotkeyModifiers.None;
if (keyboard.HasFlag(ModifierKeys.Control))
{
modifiers |= HotkeyModifiers.Control;
}
if (keyboard.HasFlag(ModifierKeys.Alt))
{
modifiers |= HotkeyModifiers.Alt;
}
if (keyboard.HasFlag(ModifierKeys.Shift))
{
modifiers |= HotkeyModifiers.Shift;
}
if (keyboard.HasFlag(ModifierKeys.Windows))
{
modifiers |= HotkeyModifiers.Win;
}
return modifiers;
}
/// <summary>The pressed key with the modifiers held, as a hotkey binding.</summary>
public static HotkeyBinding Binding(KeyEventArgs e) =>
new(CurrentModifiers(), (uint)KeyInterop.VirtualKeyFromKey(ActualKey(e)));
}
+18 -2
View File
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using CaptureImage.Core.Capture;
@@ -10,9 +11,20 @@ using Windows.Win32.UI.WindowsAndMessaging;
namespace CaptureImage.UI.Interop;
/// <summary>Win32 window tweaks WPF has no property for.</summary>
internal static class WindowInterop
/// <summary>Win32 window tweaks and system settings WPF has no property for.</summary>
internal static partial class WindowInterop
{
private const uint SpiGetMessageDuration = 0x2016;
/// <summary>
/// Windows' "Dismiss notifications after this amount of time" (Settings → Accessibility →
/// Visual effects), or <see langword="null"/> when it can't be read.
/// </summary>
public static TimeSpan? NotificationDuration() =>
SystemParametersInfo(SpiGetMessageDuration, 0, out var seconds, 0) && seconds > 0
? TimeSpan.FromSeconds(seconds)
: null;
/// <summary>
/// Keep the window out of screenshots and screen recordings (toasts, overlays, pinned
/// thumbnails must never end up in the user's captures).
@@ -74,4 +86,8 @@ internal static class WindowInterop
}
private static HWND GetHandle(Window window) => new(new WindowInteropHelper(window).EnsureHandle());
[LibraryImport("user32.dll", EntryPoint = "SystemParametersInfoW")]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool SystemParametersInfo(uint action, uint parameter, out uint value, uint update);
}
+18 -2
View File
@@ -60,6 +60,9 @@
<!-- Contact -->
<TextBlock Style="{StaticResource SectionHeader}" Text="{loc:Tr About_ContactSection}" />
<ui:CardControl
AutomationProperties.AutomationId="About_Email"
AutomationProperties.HelpText="{Binding Contact}"
AutomationProperties.Name="{loc:Tr About_Email}"
Command="{Binding EmailContactCommand}"
Icon="{ui:SymbolIcon Mail24}"
Margin="0,0,0,4">
@@ -72,6 +75,9 @@
<ui:SymbolIcon Symbol="ArrowUpRight24" />
</ui:CardControl>
<ui:CardControl
AutomationProperties.AutomationId="About_OtherChannels"
AutomationProperties.HelpText="{Binding LinksPage}"
AutomationProperties.Name="{loc:Tr About_OtherChannels}"
Command="{Binding OpenLinksPageCommand}"
Icon="{ui:SymbolIcon Link24}"
Margin="0,0,0,4">
@@ -84,6 +90,9 @@
<ui:SymbolIcon Symbol="ArrowUpRight24" />
</ui:CardControl>
<ui:CardControl
AutomationProperties.AutomationId="About_Repository"
AutomationProperties.HelpText="github.com/poli0981/captureimg"
AutomationProperties.Name="{loc:Tr About_RepositoryLabel}"
Command="{Binding OpenRepositoryCommand}"
Icon="{ui:SymbolIcon Code24}"
Margin="0,0,0,4">
@@ -229,18 +238,25 @@
<TextBlock Style="{StaticResource SectionHeader}" Text="{loc:Tr About_DisclaimersSection}" />
<TextBlock
AutomationProperties.HeadingLevel="Level3"
FontWeight="SemiBold"
Text="{loc:Tr About_TranslationDisclaimer}" />
<TextBlock
Margin="0,2,0,10"
Style="{StaticResource SecondaryText}"
Text="{loc:Tr About_TranslationDisclaimerBody}" />
<TextBlock FontWeight="SemiBold" Text="{loc:Tr About_CaptureDisclaimer}" />
<TextBlock
AutomationProperties.HeadingLevel="Level3"
FontWeight="SemiBold"
Text="{loc:Tr About_CaptureDisclaimer}" />
<TextBlock
Margin="0,2,0,10"
Style="{StaticResource SecondaryText}"
Text="{loc:Tr About_CaptureLimitationDisclaimerBody}" />
<TextBlock FontWeight="SemiBold" Text="{loc:Tr About_LiabilityDisclaimer}" />
<TextBlock
AutomationProperties.HeadingLevel="Level3"
FontWeight="SemiBold"
Text="{loc:Tr About_LiabilityDisclaimer}" />
<TextBlock
Margin="0,2,0,10"
Style="{StaticResource SecondaryText}"
+8 -1
View File
@@ -2,6 +2,7 @@
x:Class="CaptureImage.UI.Pages.DashboardPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:a11y="clr-namespace:CaptureImage.UI.Accessibility"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:loc="clr-namespace:CaptureImage.UI.Localization"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -59,11 +60,12 @@
</Ellipse>
<StackPanel Grid.Column="1">
<TextBlock
a11y:LiveRegion.IsEnabled="True"
AutomationProperties.AutomationId="Dashboard_Status"
AutomationProperties.LiveSetting="Polite"
FontSize="15"
FontWeight="SemiBold"
Text="{Binding StatusText}"
Text="{Binding StatusText, NotifyOnTargetUpdated=True}"
TextWrapping="Wrap" />
<StackPanel
Margin="0,6,0,0"
@@ -203,6 +205,11 @@
SelectionMode="Single"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.VirtualizationMode="Recycling">
<ui:ListView.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type ui:ListViewItem}}" TargetType="{x:Type ui:ListViewItem}">
<Setter Property="AutomationProperties.Name" Value="{Binding AutomationName}" />
</Style>
</ui:ListView.ItemContainerStyle>
<ui:ListView.ItemTemplate>
<DataTemplate DataType="{x:Type vm:TargetItemViewModel}">
<Grid Margin="4,6">
@@ -86,6 +86,11 @@
<ui:VirtualizingWrapPanel ItemSize="232,190" SpacingMode="None" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type ListBoxItem}}" TargetType="{x:Type ListBoxItem}">
<Setter Property="AutomationProperties.Name" Value="{Binding AutomationName}" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type vm:CaptureItemViewModel}">
<Grid Width="220">
@@ -2,6 +2,7 @@
x:Class="CaptureImage.UI.Pages.ProfilesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:a11y="clr-namespace:CaptureImage.UI.Accessibility"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:loc="clr-namespace:CaptureImage.UI.Localization"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -56,6 +57,11 @@
ItemsSource="{Binding Profiles}"
SelectedItem="{Binding SelectedProfile}"
SelectionMode="Single">
<ui:ListView.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type ui:ListViewItem}}" TargetType="{x:Type ui:ListViewItem}">
<Setter Property="AutomationProperties.Name" Value="{Binding AutomationName}" />
</Style>
</ui:ListView.ItemContainerStyle>
<ui:ListView.ItemTemplate>
<DataTemplate DataType="{x:Type vm:ProfileItemViewModel}">
<StackPanel Margin="4,6">
@@ -139,6 +145,7 @@
<ui:Button
Margin="8,0,0,0"
AutomationProperties.AutomationId="Profiles_BrowseExecutable"
AutomationProperties.HelpText="{loc:Tr Profiles_ExecutablePath}"
Command="{Binding BrowseExecutableCommand}"
Content="{loc:Tr Common_Browse}" />
</StackPanel>
@@ -162,6 +169,8 @@
<StackPanel>
<TextBlock Text="{loc:Tr Profiles_SteamAppId}" />
<TextBlock
a11y:LiveRegion.IsEnabled="True"
AutomationProperties.LiveSetting="Assertive"
Style="{StaticResource ErrorText}"
Text="{loc:Tr Profiles_SteamAppIdInvalid}"
Visibility="{Binding SteamAppIdInvalid, Converter={StaticResource BoolToVisibility}}" />
@@ -202,6 +211,7 @@
<StackPanel Orientation="Horizontal">
<ui:Button
AutomationProperties.AutomationId="Profiles_BrowseOutput"
AutomationProperties.HelpText="{loc:Tr Profiles_OutputFolder}"
Command="{Binding BrowseOutputFolderCommand}"
Content="{loc:Tr Common_Browse}" />
<ui:Button
+11 -4
View File
@@ -2,6 +2,7 @@
x:Class="CaptureImage.UI.Pages.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:a11y="clr-namespace:CaptureImage.UI.Accessibility"
xmlns:controls="clr-namespace:CaptureImage.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:loc="clr-namespace:CaptureImage.UI.Localization"
@@ -35,9 +36,10 @@
<TextBlock Style="{StaticResource CaptionText}" Text="{Binding Description}" />
<TextBlock
Margin="0,2,0,0"
a11y:LiveRegion.IsEnabled="True"
AutomationProperties.LiveSetting="Assertive"
Style="{StaticResource ErrorText}"
Text="{Binding Message}"
Text="{Binding Message, NotifyOnTargetUpdated=True}"
Visibility="{Binding HasError, Converter={StaticResource BoolToVisibility}}" />
</StackPanel>
</ui:CardControl.Header>
@@ -47,7 +49,7 @@
controls:HotkeyRecorder.IsEnabled="True"
Appearance="{Binding IsRecording, Converter={StaticResource RecordingAppearance}}"
AutomationProperties.AutomationId="{Binding Mode, StringFormat=Hotkey_{0}_Record}"
AutomationProperties.Name="{Binding ModeName}"
AutomationProperties.Name="{Binding AccessibleName}"
Command="{Binding StartRecordingCommand}"
Content="{Binding DisplayText}"
ToolTip="{loc:Tr Settings_HotkeyRecord}">
@@ -55,14 +57,14 @@
<ui:Button
Margin="8,0,0,0"
AutomationProperties.AutomationId="{Binding Mode, StringFormat=Hotkey_{0}_Clear}"
AutomationProperties.Name="{loc:Tr Settings_HotkeyClear}"
AutomationProperties.Name="{Binding ClearName}"
Command="{Binding ClearCommand}"
Icon="{ui:SymbolIcon Dismiss24}"
ToolTip="{loc:Tr Settings_HotkeyClear}" />
<ui:Button
Margin="8,0,0,0"
AutomationProperties.AutomationId="{Binding Mode, StringFormat=Hotkey_{0}_Reset}"
AutomationProperties.Name="{loc:Tr Settings_HotkeyReset}"
AutomationProperties.Name="{Binding ResetName}"
Command="{Binding ResetToDefaultCommand}"
Icon="{ui:SymbolIcon ArrowReset24}"
ToolTip="{loc:Tr Settings_HotkeyReset}" />
@@ -263,11 +265,13 @@
<StackPanel Orientation="Horizontal">
<ui:Button
AutomationProperties.AutomationId="Settings_BrowseOutput"
AutomationProperties.HelpText="{loc:Tr Settings_OutputFolder}"
Command="{Binding BrowseOutputFolderCommand}"
Content="{loc:Tr Common_Browse}" />
<ui:Button
Margin="8,0,0,0"
AutomationProperties.AutomationId="Settings_OpenOutput"
AutomationProperties.HelpText="{loc:Tr Settings_OutputFolder}"
AutomationProperties.Name="{loc:Tr Settings_OpenFolder}"
Command="{Binding OpenOutputFolderCommand}"
Icon="{ui:SymbolIcon FolderOpen24}"
@@ -275,6 +279,7 @@
<ui:Button
Margin="8,0,0,0"
AutomationProperties.AutomationId="Settings_ResetOutput"
AutomationProperties.HelpText="{loc:Tr Settings_OutputFolder}"
AutomationProperties.Name="{loc:Tr Settings_ResetToDefault}"
Command="{Binding ResetOutputFolderCommand}"
Icon="{ui:SymbolIcon ArrowReset24}"
@@ -307,6 +312,7 @@
<ui:Button
Margin="8,0,0,0"
AutomationProperties.AutomationId="Settings_ResetTemplate"
AutomationProperties.HelpText="{loc:Tr Settings_FileNameTemplate}"
AutomationProperties.Name="{loc:Tr Settings_ResetToDefault}"
Command="{Binding ResetFileNameTemplateCommand}"
Icon="{ui:SymbolIcon ArrowReset24}"
@@ -458,6 +464,7 @@
</ui:CardControl.Header>
<ui:Button
AutomationProperties.AutomationId="Settings_OpenDataFolder"
AutomationProperties.HelpText="{loc:Tr Settings_DataFolder}"
Command="{Binding OpenDataFolderCommand}"
Content="{loc:Tr Settings_OpenFolder}" />
</ui:CardControl>
+3 -1
View File
@@ -2,6 +2,7 @@
x:Class="CaptureImage.UI.Pages.UpdatePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:a11y="clr-namespace:CaptureImage.UI.Accessibility"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:loc="clr-namespace:CaptureImage.UI.Localization"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -30,11 +31,12 @@
</StackPanel>
<TextBlock
Margin="0,10,0,0"
a11y:LiveRegion.IsEnabled="True"
AutomationProperties.AutomationId="Update_Status"
AutomationProperties.LiveSetting="Polite"
FontSize="15"
FontWeight="SemiBold"
Text="{Binding StatusText}"
Text="{Binding StatusText, NotifyOnTargetUpdated=True}"
TextWrapping="Wrap" />
<ProgressBar
Height="4"
@@ -6,8 +6,11 @@ using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Threading;
using CaptureImage.Core.Abstractions;
using CaptureImage.Core.Capture;
using CaptureImage.Core.Models;
using CaptureImage.UI.Accessibility;
using CaptureImage.UI.Imaging;
using CaptureImage.UI.Interop;
using CaptureImage.UI.Windows;
using CaptureImage.ViewModels.Preview;
using CaptureImage.ViewModels.Services;
@@ -22,6 +25,8 @@ namespace CaptureImage.UI.Services;
/// <summary>
/// Notifications: a snackbar inside the main window while it has focus, otherwise a small
/// non-activating pop-up above the taskbar (never steals focus from a game, never captured).
/// Both are read to screen readers and stay up at least as long as Windows' "Dismiss
/// notifications after" setting asks.
/// </summary>
public sealed class ToastService(Dispatcher dispatcher, ShellContext shell, ISnackbarService snackbar) : IToastService
{
@@ -30,10 +35,14 @@ public sealed class ToastService(Dispatcher dispatcher, ShellContext shell, ISna
public void Show(ToastKind kind, string title, string message, TimeSpan? duration = null) => dispatcher.BeginInvoke(() =>
{
var timeout = duration ?? TimeSpan.FromSeconds(kind == ToastKind.Error ? 6 : 3.5);
var timeout = duration ?? DefaultTimeout(kind);
if (shell.IsMainWindowActive && snackbar.GetSnackbarPresenter() is not null)
{
snackbar.Show(title, message, Appearance(kind), new SymbolIcon(Symbol(kind)), timeout);
if (shell.MainWindow is { } window)
{
Announcer.Announce(window, Announcer.Compose(title, message), important: kind == ToastKind.Error);
}
return;
}
@@ -53,6 +62,12 @@ public sealed class ToastService(Dispatcher dispatcher, ShellContext shell, ISna
Arrange();
});
private static TimeSpan DefaultTimeout(ToastKind kind)
{
var own = TimeSpan.FromSeconds(kind == ToastKind.Error ? 6 : 3.5);
return WindowInterop.NotificationDuration() is { } windows && windows > own ? windows : own;
}
/// <summary>Stack the pop-ups upwards from the bottom-right corner of the primary work area.</summary>
private void Arrange()
{
@@ -204,12 +219,13 @@ public sealed class PreviewPresenter(
}).Task.Unwrap();
}
/// <summary>Region selection: one frozen full-screen overlay per monitor.</summary>
/// <summary>
/// Region selection: one frozen full-screen overlay per monitor, driven by the mouse or by the
/// keys of <see cref="RegionKeyboard"/>. The keys are registered as temporary hotkeys while the
/// overlays are up, so they work even when a full-screen game keeps the keyboard focus.
/// </summary>
public sealed class RegionSelector(Dispatcher dispatcher, IHotkeyService hotkeys) : IRegionSelector
{
private static readonly HotkeyBinding EscapeKey = new(HotkeyModifiers.None, 0x1B);
private static readonly HotkeyBinding EnterKey = new(HotkeyModifiers.None, 0x0D);
public Task<RegionSelection?> SelectAsync(IReadOnlyList<MonitorSnapshot> snapshots, CancellationToken cancellationToken = default) =>
dispatcher.InvokeAsync(() => RunAsync(snapshots, cancellationToken)).Task.Unwrap();
@@ -222,37 +238,63 @@ public sealed class RegionSelector(Dispatcher dispatcher, IHotkeyService hotkeys
var result = new TaskCompletionSource<RegionSelection?>(TaskCreationOptions.RunContinuationsAsynchronously);
var overlays = snapshots.Select(s => new RegionOverlayWindow(s)).ToList();
foreach (var overlay in overlays)
var bounds = overlays.Select(o => o.MonitorBounds).ToList();
var active = 0;
void OnKey(HotkeyBinding key)
{
var overlay = overlays[active];
switch (RegionKeyboard.Map(key, overlay.KeyboardStep))
{
case { Action: RegionKeyAction.Cancel }:
result.TrySetResult(null);
break;
case { Action: RegionKeyAction.Confirm }:
result.TrySetResult(overlay.CurrentOrFullSelection());
break;
case { Action: RegionKeyAction.NextMonitor or RegionKeyAction.PreviousMonitor } command:
var next = RegionKeyboard.Cycle(bounds, active, backwards: command.Action == RegionKeyAction.PreviousMonitor);
if (next != active)
{
active = next;
overlays[active].Activate();
overlays[active].ApplyKeyboard(command with { Action = RegionKeyAction.Move });
}
break;
case { } command:
overlay.ApplyKeyboard(command);
break;
}
}
for (var i = 0; i < overlays.Count; i++)
{
var index = i;
var overlay = overlays[i];
overlay.Completed += (_, selection) => result.TrySetResult(selection);
overlay.Cancelled += (_, _) => result.TrySetResult(null);
overlay.SelectionStarted += (sender, _) =>
overlay.KeyPressed += (_, key) => OnKey(key);
overlay.SelectionStarted += (_, _) =>
{
foreach (var other in overlays.Where(o => !ReferenceEquals(o, sender)))
active = index;
foreach (var other in overlays.Where(o => !ReferenceEquals(o, overlay)))
{
other.ClearSelection();
}
};
}
// Esc / Enter work even when a full-screen game keeps the keyboard focus.
using var keys = hotkeys.RegisterTemporary([EscapeKey, EnterKey], key => dispatcher.BeginInvoke(() =>
{
if (key == EscapeKey)
{
result.TrySetResult(null);
return;
}
var active = overlays.FirstOrDefault(o => o.HasSelection) ?? overlays.FirstOrDefault(o => o.IsMouseOver) ?? overlays[0];
result.TrySetResult(active.CurrentOrFullSelection());
}));
void OnHotkey(HotkeyBinding key) => dispatcher.BeginInvoke(() => OnKey(key));
using var singleKeys = hotkeys.RegisterTemporary(RegionKeyboard.SingleKeys, OnHotkey);
using var repeatingKeys = hotkeys.RegisterTemporary(RegionKeyboard.RepeatingKeys, OnHotkey, repeat: true);
await using var cancellation = cancellationToken.Register(() => result.TrySetResult(null));
foreach (var overlay in overlays)
{
overlay.Show();
}
(overlays.FirstOrDefault(o => o.IsMouseOver) ?? overlays[0]).Activate();
active = Math.Max(0, overlays.FindIndex(o => o.IsMouseOver));
overlays[active].Activate();
try
{
+1 -2
View File
@@ -61,8 +61,7 @@
IsPaneToggleVisible="True"
OpenPaneLength="230"
PaneDisplayMode="Left"
TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}"
Transition="FadeInWithSlide">
TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}">
<ui:NavigationView.MenuItems>
<ui:NavigationViewItem
AutomationProperties.AutomationId="Nav_Dashboard"
+18 -1
View File
@@ -14,13 +14,15 @@ using CaptureImage.ViewModels.Shell;
using CommunityToolkit.Mvvm.Messaging;
using Wpf.Ui;
using Wpf.Ui.Abstractions;
using Wpf.Ui.Animations;
using Wpf.Ui.Controls;
namespace CaptureImage.UI.Shell;
/// <summary>
/// The main window. Closing it hides to the tray (unless that option is off); its placement
/// is remembered; only the visible page's view model does background refreshes.
/// is remembered; only the visible page's view model does background refreshes. Page
/// transitions follow Windows' "Animation effects" setting.
/// </summary>
public partial class MainWindow : FluentWindow, IRecipient<NavigateMessage>
{
@@ -63,6 +65,9 @@ public partial class MainWindow : FluentWindow, IRecipient<NavigateMessage>
snackbar.SetSnackbarPresenter(SnackbarPresenter);
dialogs.SetDialogHost(DialogHost);
messenger.Register(this);
ApplyMotionPreference();
SystemParameters.StaticPropertyChanged += OnSystemParametersChanged;
Closed += (_, _) => SystemParameters.StaticPropertyChanged -= OnSystemParametersChanged;
Loaded += (_, _) => Navigation.Navigate(typeof(DashboardPage));
IsVisibleChanged += (_, _) => UpdateActivity();
@@ -140,6 +145,18 @@ public partial class MainWindow : FluentWindow, IRecipient<NavigateMessage>
UpdateActivity();
}
/// <summary>No sliding pages when the user turned animation effects off in Windows.</summary>
private void ApplyMotionPreference() =>
Navigation.Transition = SystemParameters.ClientAreaAnimation ? Transition.FadeInWithSlide : Transition.None;
private void OnSystemParametersChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(SystemParameters.ClientAreaAnimation))
{
Dispatcher.BeginInvoke(ApplyMotionPreference);
}
}
private void UpdateActivity()
{
var onScreen = IsVisible && WindowState != WindowState.Minimized;
+23 -2
View File
@@ -8,6 +8,7 @@ using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using CaptureImage.Core.Abstractions;
using CaptureImage.UI.Localization;
using CaptureImage.ViewModels.Services;
@@ -20,8 +21,10 @@ using MenuItem = System.Windows.Controls.MenuItem;
namespace CaptureImage.UI.Shell;
/// <summary>
/// The notification-area icon: left click shows the window, right click opens the menu. The
/// icon gets a red dot while the hotkeys are armed. H.NotifyIcon re-adds it after Explorer restarts.
/// The notification-area icon: left click shows the window, right click opens the menu; from
/// the keyboard (Win+B, arrow keys) Enter or Space shows the window and Shift+F10 or the menu
/// key opens the menu. The icon gets a red dot while the hotkeys are armed. H.NotifyIcon
/// re-adds it after Explorer restarts.
/// </summary>
public sealed class TrayIcon : IDisposable
{
@@ -46,6 +49,9 @@ public sealed class TrayIcon : IDisposable
ContextMenu = BuildMenu(viewModel),
};
_icon.SetBinding(TaskbarIcon.ToolTipTextProperty, new Binding(nameof(ShellViewModel.TrayToolTip)) { Source = viewModel, Mode = BindingMode.OneWay });
// H.NotifyIcon only reports keyboard use of the icon; it doesn't act on it.
_icon.TrayKeyboardKeySelect += OnKeyboardSelect;
_icon.TrayKeyboardContextMenu += OnKeyboardContextMenu;
LocalizationSource.Apply(_icon.ContextMenu);
_viewModel.PropertyChanged += OnViewModelChanged;
@@ -64,6 +70,8 @@ public sealed class TrayIcon : IDisposable
_disposed = true;
_viewModel.PropertyChanged -= OnViewModelChanged;
_localization.CultureChanged -= OnCultureChanged;
_icon.TrayKeyboardKeySelect -= OnKeyboardSelect;
_icon.TrayKeyboardContextMenu -= OnKeyboardContextMenu;
_icon.Dispose();
}
@@ -105,6 +113,19 @@ public sealed class TrayIcon : IDisposable
private static BitmapFrame LoadIcon(string name) =>
BitmapFrame.Create(new Uri($"pack://application:,,,/CaptureImage.UI;component/Assets/{name}", UriKind.Absolute));
private void OnKeyboardSelect(object sender, RoutedEventArgs e) => _viewModel.ShowWindowCommand.Execute(null);
private void OnKeyboardContextMenu(object sender, RoutedEventArgs e)
{
if (_icon.ContextMenu is not { IsOpen: false } menu)
{
return;
}
_icon.ShowContextMenu(TaskbarIcon.GetPopupTrayPosition());
menu.Dispatcher.BeginInvoke(DispatcherPriority.Input, () => menu.MoveFocus(new TraversalRequest(FocusNavigationDirection.First)));
}
private void OnViewModelChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(ShellViewModel.IsArmed))
@@ -3,7 +3,10 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="clr-namespace:CaptureImage.UI.Localization"
Title="{loc:Tr Region_Title}"
AutomationProperties.AutomationId="RegionOverlay"
AutomationProperties.HelpText="{loc:Tr Region_DragHint}"
AutomationProperties.Name="{loc:Tr Region_Title}"
Background="Black"
Cursor="Cross"
FlowDirection="LeftToRight"
@@ -37,13 +40,15 @@
Visibility="Collapsed">
<TextBlock
x:Name="SizeText"
AutomationProperties.LiveSetting="Polite"
FontSize="12"
Foreground="White" />
</Border>
</Canvas>
<Border
x:Name="Hint"
Margin="0,32,0,0"
MaxWidth="900"
Margin="16,32,16,0"
Padding="16,8"
HorizontalAlignment="Center"
VerticalAlignment="Top"
@@ -51,9 +56,12 @@
CornerRadius="6"
IsHitTestVisible="False">
<TextBlock
x:Name="HintText"
FontSize="14"
Foreground="White"
Text="{loc:Tr Region_DragHint}" />
Text="{loc:Tr Region_DragHint}"
TextAlignment="Center"
TextWrapping="Wrap" />
</Border>
</Grid>
</Window>
@@ -8,6 +8,9 @@ using System.Windows.Input;
using System.Windows.Media;
using CaptureImage.Core.Abstractions;
using CaptureImage.Core.Capture;
using CaptureImage.Core.Models;
using CaptureImage.UI.Accessibility;
using CaptureImage.UI.Controls;
using CaptureImage.UI.Imaging;
using CaptureImage.UI.Interop;
@@ -15,21 +18,26 @@ namespace CaptureImage.UI.Windows;
/// <summary>
/// Covers one monitor with the frozen picture taken when the hotkey was pressed; the user
/// drags a rectangle (a plain click takes the whole monitor). The window is placed in physical
/// pixels and the picture is shown at the monitor's DPI, so one image pixel is one screen pixel.
/// drags a rectangle (a plain click takes the whole monitor) or uses the keys of
/// <see cref="RegionKeyboard"/>. The window is placed in physical pixels and the picture is
/// shown at the monitor's DPI, so one image pixel is one screen pixel. The selection is kept
/// in physical pixels relative to the monitor.
/// </summary>
public partial class RegionOverlayWindow : Window
{
private const int MinimumSize = 4;
private readonly MonitorSnapshot _snapshot;
private Point? _start;
private Rect? _selection;
private (int X, int Y)? _start;
private PixelRect? _selection;
public RegionOverlayWindow(MonitorSnapshot snapshot)
{
_snapshot = snapshot;
InitializeComponent();
Frozen.Source = FrameBitmap.ToBitmapSource(snapshot.DisplayFrame, snapshot.Monitor.Dpi);
if (SystemParameters.HighContrast)
{
UseContrastColors();
}
var bounds = snapshot.Monitor.Bounds;
var scale = snapshot.Monitor.Scale;
@@ -51,10 +59,22 @@ public partial class RegionOverlayWindow : Window
public event EventHandler? Cancelled;
/// <summary>A drag started here; the other overlays clear theirs.</summary>
/// <summary>A selection started here; the other overlays clear theirs.</summary>
public event EventHandler? SelectionStarted;
public bool HasSelection => _selection is { Width: > 0, Height: > 0 };
/// <summary>
/// A key of <see cref="RegionKeyboard"/> reached this window (it wasn't registered as a
/// temporary hotkey); the selector handles it like the registered ones.
/// </summary>
public event EventHandler<HotkeyBinding>? KeyPressed;
/// <summary>The monitor this overlay covers, in virtual-desktop pixels.</summary>
public PixelRect MonitorBounds => _snapshot.Monitor.Bounds;
/// <summary>A normal keyboard step on this monitor, in physical pixels.</summary>
public int KeyboardStep => RegionKeyboard.StepFor(_snapshot.Monitor.Scale);
public bool HasSelection => _selection is { IsEmpty: false };
public void ClearSelection()
{
@@ -63,13 +83,32 @@ public partial class RegionOverlayWindow : Window
UpdateVisuals();
}
/// <summary>The dragged rectangle, or the whole monitor when nothing is selected.</summary>
public RegionSelection CurrentOrFullSelection()
{
var area = _selection is { } rect ? ToPixels(rect) : default;
return area.Width >= MinimumSize && area.Height >= MinimumSize
/// <summary>The selected rectangle, or the whole monitor when nothing (or too little) is selected.</summary>
public RegionSelection CurrentOrFullSelection() =>
_selection is { Width: >= RegionKeyboard.MinimumSize, Height: >= RegionKeyboard.MinimumSize } area
? new RegionSelection(_snapshot.Monitor, area)
: FullMonitor();
/// <summary>Move or resize the selection from the keyboard (creating one first if there is none).</summary>
public void ApplyKeyboard(RegionKeyCommand command)
{
var bounds = _snapshot.Monitor.Bounds;
var next = RegionKeyboard.Apply(_selection, command, bounds.Width, bounds.Height);
if (next == _selection)
{
return;
}
if (!HasSelection)
{
SelectionStarted?.Invoke(this, EventArgs.Empty);
}
_start = null;
_selection = next;
Hint.Visibility = Visibility.Collapsed;
UpdateVisuals();
LiveRegion.Announce(SizeText);
}
protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)
@@ -82,8 +121,9 @@ public partial class RegionOverlayWindow : Window
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
_start = e.GetPosition(Root);
_selection = new Rect(_start.Value, _start.Value);
var start = ToPixels(e.GetPosition(Root));
_start = start;
_selection = new PixelRect(start.X, start.Y, 0, 0);
Hint.Visibility = Visibility.Collapsed;
CaptureMouse();
SelectionStarted?.Invoke(this, EventArgs.Empty);
@@ -95,7 +135,8 @@ public partial class RegionOverlayWindow : Window
base.OnMouseMove(e);
if (_start is { } start && IsMouseCaptured)
{
_selection = new Rect(start, Clamp(e.GetPosition(Root)));
var (x, y) = ToPixels(e.GetPosition(Root));
_selection = new PixelRect(Math.Min(start.X, x), Math.Min(start.Y, y), Math.Abs(x - start.X), Math.Abs(y - start.Y));
UpdateVisuals();
}
}
@@ -121,14 +162,10 @@ public partial class RegionOverlayWindow : Window
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if (e.Key == Key.Escape)
var key = KeyInput.Binding(e);
if (RegionKeyboard.Map(key, KeyboardStep) is not null)
{
Cancelled?.Invoke(this, EventArgs.Empty);
e.Handled = true;
}
else if (e.Key == Key.Enter)
{
Completed?.Invoke(this, CurrentOrFullSelection());
KeyPressed?.Invoke(this, key);
e.Handled = true;
}
}
@@ -136,25 +173,42 @@ public partial class RegionOverlayWindow : Window
private RegionSelection FullMonitor() =>
new(_snapshot.Monitor, new PixelRect(0, 0, _snapshot.Monitor.Bounds.Width, _snapshot.Monitor.Bounds.Height));
private Point Clamp(Point point) =>
new(Math.Clamp(point.X, 0, Root.ActualWidth), Math.Clamp(point.Y, 0, Root.ActualHeight));
/// <summary>DIP rectangle → physical pixels relative to the monitor, clamped to it.</summary>
private PixelRect ToPixels(Rect rect)
/// <summary>DIP position → physical pixel relative to the monitor, clamped to it.</summary>
private (int X, int Y) ToPixels(Point point)
{
var dpi = VisualTreeHelper.GetDpi(this);
var bounds = _snapshot.Monitor.Bounds;
var x = (int)Math.Round(rect.X * dpi.DpiScaleX);
var y = (int)Math.Round(rect.Y * dpi.DpiScaleY);
var right = (int)Math.Round(rect.Right * dpi.DpiScaleX);
var bottom = (int)Math.Round(rect.Bottom * dpi.DpiScaleY);
return new PixelRect(x, y, right - x, bottom - y).Intersect(new PixelRect(0, 0, bounds.Width, bounds.Height));
return (
Math.Clamp((int)Math.Round(point.X * dpi.DpiScaleX), 0, bounds.Width),
Math.Clamp((int)Math.Round(point.Y * dpi.DpiScaleY), 0, bounds.Height));
}
/// <summary>Physical pixels relative to the monitor → DIP rectangle for drawing.</summary>
private Rect ToDips(PixelRect rect)
{
var dpi = VisualTreeHelper.GetDpi(this);
return new Rect(rect.X / dpi.DpiScaleX, rect.Y / dpi.DpiScaleY, rect.Width / dpi.DpiScaleX, rect.Height / dpi.DpiScaleY);
}
/// <summary>Windows contrast theme: draw the selection and labels with the theme's colours.</summary>
private void UseContrastColors()
{
SelectionBorder.Stroke = SystemColors.HighlightBrush;
SelectionBorder.StrokeThickness = 2;
foreach (var label in new[] { SizeLabel, Hint })
{
label.Background = SystemColors.WindowBrush;
label.BorderBrush = SystemColors.WindowTextBrush;
label.BorderThickness = new Thickness(1);
}
SizeText.Foreground = SystemColors.WindowTextBrush;
HintText.Foreground = SystemColors.WindowTextBrush;
}
private void UpdateVisuals()
{
var full = new Rect(0, 0, Root.ActualWidth, Root.ActualHeight);
if (_selection is not { } rect || rect.Width <= 0 || rect.Height <= 0)
if (_selection is not { IsEmpty: false } selection)
{
Shade.Data = new RectangleGeometry(full);
SelectionBorder.Visibility = Visibility.Collapsed;
@@ -162,6 +216,7 @@ public partial class RegionOverlayWindow : Window
return;
}
var rect = ToDips(selection);
Shade.Data = new CombinedGeometry(GeometryCombineMode.Exclude, new RectangleGeometry(full), new RectangleGeometry(rect));
SelectionBorder.Visibility = Visibility.Visible;
Canvas.SetLeft(SelectionBorder, rect.X);
@@ -169,8 +224,7 @@ public partial class RegionOverlayWindow : Window
SelectionBorder.Width = rect.Width;
SelectionBorder.Height = rect.Height;
var pixels = ToPixels(rect);
SizeText.Text = string.Create(CultureInfo.InvariantCulture, $"{pixels.Width} × {pixels.Height}");
SizeText.Text = string.Create(CultureInfo.InvariantCulture, $"{selection.Width} × {selection.Height}");
SizeLabel.Visibility = Visibility.Visible;
SizeLabel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
var labelTop = rect.Y - SizeLabel.DesiredSize.Height - 6;
@@ -47,7 +47,6 @@
<TextBlock
x:Name="MessageText"
Margin="0,2,0,0"
AutomationProperties.LiveSetting="Polite"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
TextWrapping="Wrap" />
</StackPanel>
@@ -3,11 +3,11 @@
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using CaptureImage.Core.Models;
using CaptureImage.UI.Accessibility;
using CaptureImage.UI.Interop;
using CaptureImage.UI.Localization;
using Wpf.Ui.Controls;
@@ -16,7 +16,8 @@ namespace CaptureImage.UI.Windows;
/// <summary>
/// A notification pop-up for when the main window isn't in front: never activated (a click
/// doesn't steal focus from a game) and excluded from screen capture.
/// doesn't steal focus from a game) and excluded from screen capture. Screen readers get the
/// text as a UI Automation notification when it appears.
/// </summary>
public partial class ToastWindow : Window
{
@@ -40,7 +41,8 @@ public partial class ToastWindow : Window
{
KindIcon.Foreground = accent;
}
AutomationProperties.SetName(this, string.IsNullOrEmpty(message) ? title : $"{title}. {message}");
var announcement = Announcer.Compose(title, message);
AutomationProperties.SetName(this, announcement);
_timer = new DispatcherTimer { Interval = timeout };
_timer.Tick += (_, _) => Close();
@@ -52,7 +54,7 @@ public partial class ToastWindow : Window
Loaded += (_, _) =>
{
_timer.Start();
UIElementAutomationPeer.FromElement(MessageText)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
Announcer.Announce(this, announcement, important: kind == ToastKind.Error);
};
Closed += (_, _) => _timer.Stop();
}
+1 -1
View File
@@ -97,7 +97,7 @@
"captureimage.viewmodels": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.3, )",
"CaptureImage.Core": "[2.1.0, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"
@@ -54,6 +54,11 @@ public sealed partial class CaptureItemViewModel(CaptureRecord record, ICaptureL
}
}
/// <summary>Accessible name: file name, game, date and the HDR badge.</summary>
public string AutomationName => string.Join(
", ",
new[] { FileName, Game, CapturedAtText, HasHdr ? "HDR" : null }.Where(part => !string.IsNullOrEmpty(part)));
public override string ToString() => FileName;
private async Task LoadThumbnailAsync()
@@ -15,10 +15,12 @@ using CommunityToolkit.Mvvm.Messaging;
namespace CaptureImage.ViewModels.Profiles;
/// <summary>One game profile in the list.</summary>
public sealed partial class ProfileItemViewModel(GameProfile profile) : ViewModelBase
public sealed partial class ProfileItemViewModel(GameProfile profile, ILocalizationService localization) : ViewModelBase
{
private readonly ILocalizationService _localization = localization;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(Name), nameof(MatchSummary), nameof(Enabled), nameof(AutoArm))]
[NotifyPropertyChangedFor(nameof(Name), nameof(MatchSummary), nameof(Enabled), nameof(AutoArm), nameof(AutomationName))]
public partial GameProfile Profile { get; set; } = profile;
public string Id => Profile.Id;
@@ -38,7 +40,21 @@ public sealed partial class ProfileItemViewModel(GameProfile profile) : ViewMode
public bool AutoArm => Profile.AutoArm;
/// <summary>Accessible name: the name, what it matches and the badges shown next to it.</summary>
public string AutomationName => string.Join(
", ",
new[]
{
Name,
MatchSummary,
AutoArm ? _localization["Profiles_AutoArmBadge"] : null,
Enabled ? null : _localization["Profiles_DisabledBadge"],
}.Where(part => !string.IsNullOrEmpty(part)));
public override string ToString() => Name;
/// <summary>Refresh localized text after a language switch.</summary>
public void RefreshText() => OnPropertyChanged(nameof(AutomationName));
}
/// <summary>
@@ -283,7 +299,7 @@ public sealed partial class ProfilesViewModel : ViewModelBase, IRecipient<Create
private void AddProfile(GameProfile profile)
{
var item = new ProfileItemViewModel(profile);
var item = new ProfileItemViewModel(profile, Localization);
Profiles.Add(item);
Persist();
SelectedProfile = item;
@@ -316,7 +332,7 @@ public sealed partial class ProfilesViewModel : ViewModelBase, IRecipient<Create
Profiles.Clear();
foreach (var profile in profiles)
{
Profiles.Add(new ProfileItemViewModel(profile));
Profiles.Add(new ProfileItemViewModel(profile, Localization));
}
SelectedProfile = Profiles.FirstOrDefault(p => p.Id == selectedId) ?? Profiles.FirstOrDefault();
OnPropertyChanged(nameof(HasProfiles));
@@ -336,6 +352,10 @@ public sealed partial class ProfilesViewModel : ViewModelBase, IRecipient<Create
{
LocalizedOption.RefreshAll(FormatOptions);
LocalizedOption.RefreshAll(HdrOptions);
foreach (var item in Profiles)
{
item.RefreshText();
}
}
}
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>النافذة مصغّرة. استعِدها ثم حاول مجددًا.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>حدث خطأ ما. التفاصيل في السجل.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}، {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>غير معيّن</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>اضغط المفاتيح…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>يستخدم تطبيق آخر أحد مفاتيح اختصار الالتقاط، أو أن المجموعة غير صالحة. اختر مجموعة أخرى في الإعدادات.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>استخدام الإعداد العام</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>استخدام العام</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>اسحب لتحديد منطقة · انقر لالتقاط الشاشة كاملة · Esc للإلغاء</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>اسحب أو استخدم مفاتيح الأسهم لتحديد منطقة · Shift+الأسهم لتغيير الحجم · Ctrl: خطوات بمقدار بكسل واحد · Tab: الشاشة التالية · Enter للالتقاط · انقر، أو اضغط Enter دون تحديد، لالتقاط الشاشة كاملة · Esc للإلغاء</value></data>
<data name="Region_Title" xml:space="preserve"><value>حدد منطقة</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>متقدم</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>المظهر</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>متوقف (SDR دائمًا)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>مسح</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>مسح مفتاح اختصار {0}</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>انقر على مفتاح اختصار ثم اضغط المجموعة الجديدة. Esc للإلغاء، وBackspace للمسح. تعمل مفاتيح الاختصار فقط أثناء التفعيل.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>يلتقط الشاشة الموجودة أسفل مؤشر الماوس.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>تسجيل…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>يجمّد كل الشاشات ويتيح لك سحب منطقة.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>إعادة تعيين</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>إعادة مفتاح اختصار {0} إلى الافتراضي</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>مفاتيح الاختصار</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>يلتقط النافذة المثبّتة، أو النافذة الموجودة في المقدمة.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>استيراد…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>Das Fenster ist minimiert. Wiederherstellen und erneut versuchen.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>Etwas ist schiefgelaufen. Details stehen im Protokoll.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}, {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>Nicht festgelegt</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>Tasten drücken…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>Eine andere App verwendet eine der Aufnahme-Tastenkombinationen, oder die Kombination ist ungültig. In den Einstellungen eine andere wählen.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>Globale Einstellung verwenden</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>Global verwenden</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Ziehen, um einen Bereich auszuwählen · Klicken für den ganzen Bildschirm · Esc zum Abbrechen</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Ziehen oder mit den Pfeiltasten einen Bereich auswählen · Shift+Pfeiltasten ändern die Größe · Ctrl: Schritte von 1 Pixel · Tab: nächster Bildschirm · Enter zum Aufnehmen · Klicken oder Enter ohne Auswahl für den ganzen Bildschirm · Esc zum Abbrechen</value></data>
<data name="Region_Title" xml:space="preserve"><value>Bereich auswählen</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>Erweitert</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>Darstellung</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>Aus (immer SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>Entfernen</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>Tastenkombination für {0} entfernen</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>Auf eine Tastenkombination klicken und die neue Kombination drücken. Esc bricht ab, Rücktaste löscht. Tastenkombinationen funktionieren nur im scharfgeschalteten Zustand.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>Nimmt den Bildschirm unter dem Mauszeiger auf.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>Aufzeichnen…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>Friert alle Bildschirme ein und lässt Sie einen Bereich aufziehen.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>Zurücksetzen</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>Tastenkombination für {0} auf Standard zurücksetzen</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>Tastenkombinationen</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>Nimmt das festgelegte Fenster oder das Fenster im Vordergrund auf.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>Importieren…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>La ventana está minimizada. Restáurala e inténtalo de nuevo.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>Algo salió mal. Consulta el registro para ver los detalles.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}, {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>Sin asignar</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>Pulsa las teclas…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>Otra aplicación usa una de las teclas rápidas de captura, o la combinación no es válida. Elige otra en Configuración.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>Usar la configuración general</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>Usar general</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Arrastra para seleccionar un área · Haz clic para toda la pantalla · Esc para cancelar</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Arrastra o usa las teclas de flecha para seleccionar un área · Shift+flechas cambian el tamaño · Ctrl: pasos de 1 píxel · Tab: siguiente pantalla · Enter para capturar · Haz clic, o pulsa Enter sin selección, para toda la pantalla · Esc para cancelar</value></data>
<data name="Region_Title" xml:space="preserve"><value>Selecciona un área</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>Avanzado</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>Apariencia</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>Desactivado (siempre SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>Borrar</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>Borrar la tecla rápida de {0}</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>Haz clic en una tecla rápida y pulsa la nueva combinación. Esc cancela y Retroceso la borra. Las teclas rápidas solo funcionan mientras están activadas.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>Captura la pantalla donde está el puntero del ratón.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>Grabar…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>Congela todas las pantallas y te deja arrastrar un área.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>Restablecer</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>Restablecer la tecla rápida de {0} al valor predeterminado</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>Teclas rápidas</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>Captura la ventana fijada o la que está en primer plano.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>Importar…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>La fenêtre est réduite. Restaurez-la et réessayez.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>Une erreur s'est produite. Le journal contient les détails.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}, {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>Non défini</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>Appuyez sur les touches…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>Une autre application utilise l'un des raccourcis de capture, ou la combinaison n'est pas valide. Choisissez-en une autre dans les paramètres.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>Utiliser le paramètre global</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>Utiliser le global</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Faites glisser pour sélectionner une zone · Cliquez pour tout l'écran · Échap pour annuler</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Faites glisser ou utilisez les flèches pour sélectionner une zone · Maj+flèches pour redimensionner · Ctrl : pas de 1 pixel · Tab : écran suivant · Entrée pour capturer · Cliquez, ou appuyez sur Entrée sans sélection, pour tout l'écran · Échap pour annuler</value></data>
<data name="Region_Title" xml:space="preserve"><value>Sélectionnez une zone</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>Avancé</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>Apparence</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>Désactivé (toujours SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>Effacer</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>Effacer le raccourci « {0} »</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>Cliquez sur un raccourci, puis appuyez sur la nouvelle combinaison. Échap annule, Retour arrière efface. Les raccourcis ne fonctionnent que lorsqu'ils sont armés.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>Capture l'écran sous le pointeur de la souris.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>Enregistrer…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>Fige tous les écrans et vous laisse faire glisser une zone.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>Réinitialiser</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>Rétablir le raccourci « {0} » par défaut</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>Raccourcis</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>Capture la fenêtre verrouillée ou celle au premier plan.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>Importer…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>ウィンドウが最小化されています。元に戻してからもう一度お試しください。</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>問題が発生しました。詳細はログを確認してください。</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}、{1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>未設定</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>キーを押してください…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>別のアプリがキャプチャ用ホットキーを使用しているか、組み合わせが無効です。設定で別の組み合わせを選んでください。</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>全体の設定を使用</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>全体設定に戻す</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>ドラッグで範囲を選択 · クリックで画面全体 · Esc でキャンセル</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>ドラッグまたは矢印キーで範囲を選択 · Shift+矢印でサイズ変更 · Ctrl で 1 ピクセルずつ · Tab で次の画面 · Enter でキャプチャ · クリック、または未選択で Enter を押すと画面全体 · Esc でキャンセル</value></data>
<data name="Region_Title" xml:space="preserve"><value>範囲を選択</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>詳細設定</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>外観</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>オフ(常に SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>解除</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>{0} のホットキーを解除</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>ホットキーをクリックして、新しい組み合わせを押します。Esc でキャンセル、Backspace で解除します。ホットキーは起動中のみ機能します。</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>マウスポインターがある画面をキャプチャします。</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>録音…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>すべての画面を静止させ、範囲をドラッグして選択できます。</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>リセット</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>{0} のホットキーを既定に戻す</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>ホットキー</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>固定したウィンドウ、または前面のウィンドウをキャプチャします。</value></data>
<data name="Settings_Import" xml:space="preserve"><value>インポート…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>창이 최소화되어 있습니다. 창을 복원한 후 다시 시도하세요.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>문제가 발생했습니다. 자세한 내용은 로그를 확인하세요.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}, {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>설정 안 됨</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>키를 누르세요…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>다른 앱이 캡처 단축키를 사용 중이거나 키 조합이 올바르지 않습니다. 설정에서 다른 조합을 선택하세요.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>전체 설정 사용</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>전체 설정으로</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>드래그하여 영역 선택 · 클릭하면 전체 화면 · Esc로 취소</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>드래그하거나 화살표 키로 영역 선택 · Shift+화살표로 크기 조정 · Ctrl: 1픽셀씩 · Tab: 다음 화면 · Enter로 캡처 · 클릭하거나 선택 없이 Enter를 누르면 전체 화면 · Esc로 취소</value></data>
<data name="Region_Title" xml:space="preserve"><value>영역 선택</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>고급</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>모양</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>끔(항상 SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>지우기</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>{0} 단축키 지우기</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>단축키를 클릭한 다음 새 조합을 누르세요. Esc는 취소, Backspace는 지우기입니다. 단축키는 활성화된 동안에만 작동합니다.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>마우스 포인터가 있는 화면을 캡처합니다.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>녹화…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>모든 화면을 정지시키고 영역을 드래그해 선택할 수 있습니다.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>재설정</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>{0} 단축키를 기본값으로 재설정</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>단축키</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>고정한 창 또는 맨 앞의 창을 캡처합니다.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>가져오기…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>A janela está minimizada. Restaure-a e tente novamente.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>Algo deu errado. Os detalhes estão no log.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}, {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>Não definido</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>Pressione as teclas…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>Outro aplicativo está usando um dos atalhos de captura, ou a combinação é inválida. Escolha outra em Configurações.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>Usar a configuração geral</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>Usar geral</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Arraste para selecionar uma área · Clique para a tela inteira · Esc para cancelar</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Arraste ou use as setas para selecionar uma área · Shift+setas redimensionam · Ctrl: passos de 1 pixel · Tab: próxima tela · Enter para capturar · Clique, ou pressione Enter sem seleção, para a tela inteira · Esc para cancelar</value></data>
<data name="Region_Title" xml:space="preserve"><value>Selecione uma área</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>Avançado</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>Aparência</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>Desligado (sempre SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>Limpar</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>Limpar o atalho de {0}</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>Clique em um atalho e pressione a nova combinação. Esc cancela e Backspace apaga. Os atalhos só funcionam enquanto estiverem armados.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>Captura a tela onde está o ponteiro do mouse.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>Gravar…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>Congela todas as telas e permite arrastar uma área.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>Redefinir</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>Restaurar o atalho de {0} para o padrão</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>Atalhos</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>Captura a janela fixada ou a que está na frente.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>Importar…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>The window is minimized. Restore it and try again.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>Something went wrong. The log has the details.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}, {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>Not set</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>Press keys…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>Another app is using one of the capture hotkeys, or a combination is invalid. Pick a different one in Settings.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>Use the global setting</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>Use global</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Drag to select an area · Click for the whole screen · Esc to cancel</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Drag or use the arrow keys to select an area · Shift+arrows resize · Ctrl: 1-pixel steps · Tab: next screen · Enter to capture · Click, or Enter with nothing selected, for the whole screen · Esc to cancel</value></data>
<data name="Region_Title" xml:space="preserve"><value>Select an area</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>Advanced</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>Appearance</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>Off (always SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>Clear</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>Clear the {0} hotkey</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>Click a hotkey, then press the new combination. Esc cancels, Backspace clears. Hotkeys only work while armed.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>Captures the screen under the mouse pointer.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>Record…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>Freezes every screen and lets you drag an area.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>Reset</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>Reset the {0} hotkey to its default</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>Hotkeys</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>Captures the locked window, or the window in front.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>Import…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>Окно свёрнуто. Разверните его и повторите попытку.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>Что-то пошло не так. Подробности в журнале.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}, {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>Не задано</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>Нажмите клавиши…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>Другое приложение использует одну из горячих клавиш снимков, или сочетание недопустимо. Выберите другое в настройках.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>Использовать общую настройку</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>Общая</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Выделите область · Щелчок — весь экран · Esc — отмена</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Выделите область мышью или клавишами со стрелками · Shift+стрелки — размер · Ctrl — шаг 1 пиксель · Tab — следующий экран · Enter — снимок · Щелчок или Enter без выделения — весь экран · Esc — отмена</value></data>
<data name="Region_Title" xml:space="preserve"><value>Выделите область</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>Дополнительно</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>Оформление</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>Выкл. (всегда SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>Очистить</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>Очистить горячую клавишу режима «{0}»</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>Нажмите на горячую клавишу, затем введите новое сочетание. Esc — отмена, Backspace — очистить. Горячие клавиши работают только после активации.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>Снимает экран, на котором находится указатель мыши.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>Записать…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>Замораживает все экраны и позволяет выделить область.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>Сброс</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>Вернуть горячую клавишу режима «{0}» по умолчанию</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>Горячие клавиши</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>Снимает закреплённое окно или окно на переднем плане.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>Импорт…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>Cửa sổ đang thu nhỏ. Hãy mở lại cửa sổ rồi thử lại.</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>Đã xảy ra lỗi. Xem chi tiết trong nhật ký.</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0}, {1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>Chưa đặt</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>Nhấn phím…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>Một ứng dụng khác đang dùng hotkey chụp, hoặc tổ hợp phím không hợp lệ. Hãy chọn tổ hợp khác trong Cài đặt.</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>Dùng cài đặt chung</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>Dùng chung</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Kéo để chọn vùng · Nhấp để chụp toàn màn hình · Esc để huỷ</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>Kéo hoặc dùng phím mũi tên để chọn vùng · Shift+mũi tên để đổi kích thước · Ctrl: bước 1 điểm ảnh · Tab: màn hình kế tiếp · Enter để chụp · Nhấp, hoặc Enter khi chưa chọn, để chụp toàn màn hình · Esc để huỷ</value></data>
<data name="Region_Title" xml:space="preserve"><value>Chọn vùng</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>Nâng cao</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>Hiển thị</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>Tắt (luôn SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>Xoá</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>Xoá hotkey {0}</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>Nhấn vào một hotkey rồi nhấn tổ hợp phím mới. Esc để huỷ, Backspace để xoá. Hotkey chỉ hoạt động khi đang sẵn sàng.</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>Chụp màn hình đang có con trỏ chuột.</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>Ghi…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>Đóng băng mọi màn hình để bạn kéo chọn một vùng.</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>Đặt lại</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>Đặt hotkey {0} về mặc định</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>Hotkey</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>Chụp cửa sổ đã khoá, hoặc cửa sổ đang ở phía trước.</value></data>
<data name="Settings_Import" xml:space="preserve"><value>Nhập…</value></data>
@@ -109,6 +109,7 @@
<data name="Error_TargetMinimized" xml:space="preserve"><value>窗口已最小化。请还原后重试。</value></data>
<data name="Error_Unknown" xml:space="preserve"><value>出现问题。详情请查看日志。</value></data>
<data name="Hotkey_AccessibleName" xml:space="preserve"><value>{0},{1}</value></data>
<data name="Hotkey_None" xml:space="preserve"><value>未设置</value></data>
<data name="Hotkey_PressKeys" xml:space="preserve"><value>请按键…</value></data>
<data name="Hotkey_ProblemMessage" xml:space="preserve"><value>其他应用正在使用某个截图热键,或组合键无效。请在设置中选择其他组合键。</value></data>
@@ -211,7 +212,8 @@
<data name="Profiles_UseGlobal" xml:space="preserve"><value>使用全局设置</value></data>
<data name="Profiles_UseGlobalButton" xml:space="preserve"><value>使用全局</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>拖动选择区域 · 单击截取整个屏幕 · Esc 取消</value></data>
<data name="Region_DragHint" xml:space="preserve"><value>拖动或使用方向键选择区域 · Shift+方向键调整大小 · Ctrl:每次移动 1 像素 · Tab:下一个屏幕 · Enter 截取 · 单击,或未选择时按 Enter,截取整个屏幕 · Esc 取消</value></data>
<data name="Region_Title" xml:space="preserve"><value>选择区域</value></data>
<data name="Settings_AdvancedSection" xml:space="preserve"><value>高级</value></data>
<data name="Settings_AppearanceSection" xml:space="preserve"><value>外观</value></data>
@@ -248,11 +250,13 @@
<data name="Settings_HdrOff" xml:space="preserve"><value>关闭(始终 SDR)</value></data>
<data name="Settings_HdrSection" xml:space="preserve"><value>HDR</value></data>
<data name="Settings_HotkeyClear" xml:space="preserve"><value>清除</value></data>
<data name="Settings_HotkeyClearNamed" xml:space="preserve"><value>清除{0}热键</value></data>
<data name="Settings_HotkeyHint" xml:space="preserve"><value>单击某个热键,然后按下新的组合键。Esc 取消,Backspace 清除。热键仅在启动状态下生效。</value></data>
<data name="Settings_HotkeyMonitorDescription" xml:space="preserve"><value>截取鼠标指针所在的屏幕。</value></data>
<data name="Settings_HotkeyRecord" xml:space="preserve"><value>录制…</value></data>
<data name="Settings_HotkeyRegionDescription" xml:space="preserve"><value>冻结所有屏幕,让你拖动选择一个区域。</value></data>
<data name="Settings_HotkeyReset" xml:space="preserve"><value>重置</value></data>
<data name="Settings_HotkeyResetNamed" xml:space="preserve"><value>将{0}热键恢复默认</value></data>
<data name="Settings_HotkeysSection" xml:space="preserve"><value>热键</value></data>
<data name="Settings_HotkeyWindowDescription" xml:space="preserve"><value>截取已锁定的窗口,或前台窗口。</value></data>
<data name="Settings_Import" xml:space="preserve"><value>导入…</value></data>
@@ -22,6 +22,7 @@ public sealed partial class HotkeyBindingViewModel(
IHotkeyService hotkeys,
ILocalizationService localization) : ViewModelBase
{
private const uint VkTab = 0x09;
private readonly ISettingsStore _settings = settings;
private readonly CaptureCoordinator _coordinator = coordinator;
private readonly IHotkeyService _hotkeys = hotkeys;
@@ -36,11 +37,11 @@ public sealed partial class HotkeyBindingViewModel(
public string Description => Localization[$"Settings_Hotkey{Mode}Description"];
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(DisplayText), nameof(IsDefault))]
[NotifyPropertyChangedFor(nameof(DisplayText), nameof(AccessibleName), nameof(IsDefault))]
public partial HotkeyBinding Binding { get; set; } = settings.Current.Hotkeys.Get(mode);
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(DisplayText))]
[NotifyPropertyChangedFor(nameof(DisplayText), nameof(AccessibleName))]
public partial bool IsRecording { get; set; }
[ObservableProperty]
@@ -53,6 +54,15 @@ public sealed partial class HotkeyBindingViewModel(
? Localization["Hotkey_PressKeys"]
: Binding.IsUnbound ? Localization["Hotkey_None"] : Binding.ToString();
/// <summary>What a screen reader announces for the record button: the mode and its binding.</summary>
public string AccessibleName => Localization.Format("Hotkey_AccessibleName", ModeName, DisplayText);
/// <summary>Accessible name of this row's Clear button (one per mode, so they differ).</summary>
public string ClearName => Localization.Format("Settings_HotkeyClearNamed", ModeName);
/// <summary>Accessible name of this row's Reset button.</summary>
public string ResetName => Localization.Format("Settings_HotkeyResetNamed", ModeName);
public bool IsDefault => Binding == HotkeyBinding.DefaultFor(Mode);
[RelayCommand]
@@ -119,6 +129,22 @@ public sealed partial class HotkeyBindingViewModel(
return true;
}
/// <summary>
/// Tab and Shift+Tab move the keyboard focus instead of being recorded: recording is
/// cancelled and <c>true</c> tells the recorder to let the key through. Without this a
/// keyboard user would be stuck on the button, and Shift+Tab would become the hotkey.
/// </summary>
public bool ReleaseFocus(HotkeyModifiers modifiers, uint virtualKey)
{
if (!IsRecording || virtualKey != VkTab || (modifiers & ~HotkeyModifiers.Shift) != 0)
{
return false;
}
StopRecording();
return true;
}
/// <summary>Show the registration result while armed (conflicts appear after arming).</summary>
public void ApplyRegistration(HotkeyRegistration? registration)
{
@@ -159,6 +185,9 @@ public sealed partial class HotkeyBindingViewModel(
OnPropertyChanged(nameof(ModeName));
OnPropertyChanged(nameof(Description));
OnPropertyChanged(nameof(DisplayText));
OnPropertyChanged(nameof(AccessibleName));
OnPropertyChanged(nameof(ClearName));
OnPropertyChanged(nameof(ResetName));
}
private bool TryCommit(HotkeyBinding candidate)
@@ -4,6 +4,7 @@
using System.Diagnostics;
using AwesomeAssertions;
using FlaUI.Core.AutomationElements;
using FlaUI.Core.Definitions;
using FlaUI.Core.Input;
using FlaUI.Core.Tools;
using FlaUI.Core.WindowsAPI;
@@ -15,6 +16,7 @@ namespace CaptureImage.App.UiTests;
public sealed class AppTests
{
private static readonly string[] Pages = ["Dashboard", "Library", "Profiles", "Settings", "Logs", "Update", "About"];
private static readonly string[] CaptureModes = ["Window", "Region", "Monitor"];
[Fact]
public void Starts_WithTheMainWindowAndDashboard()
@@ -53,6 +55,56 @@ public sealed class AppTests
Retry.WhileTrue(() => status.Name == idle, TimeSpan.FromSeconds(5)).Success.Should().BeTrue();
}
[Fact]
public void Arm_AnnouncesTheNewStatusToScreenReaders()
{
using var session = AppSession.Start();
var window = session.MainWindow();
var status = AppSession.Find(window, "Dashboard_Status");
using var announced = new ManualResetEventSlim();
using var handler = window.RegisterAutomationEvent(
session.Automation.EventLibrary.Element.LiveRegionChangedEvent,
TreeScope.Subtree,
(element, _) =>
{
if (element.Properties.AutomationId.ValueOrDefault == "Dashboard_Status")
{
announced.Set();
}
});
AppSession.Find(window, "Dashboard_ToggleArm").AsButton().Invoke();
announced.Wait(TimeSpan.FromSeconds(5), TestContext.Current.CancellationToken).Should().BeTrue("the status text is a live region");
status.Name.Should().NotBeNullOrEmpty();
}
[Fact]
public void HotkeyButtons_HaveDistinctNames_AndTabLeavesTheRecorder()
{
using var session = AppSession.Start("""{ "version": 3, "culture": "en-US" }""");
var window = session.MainWindow();
AppSession.Find(window, "Nav_Settings").Click();
var record = AppSession.Find(window, "Hotkey_Window_Record").AsButton();
record.Name.Should().Contain("Ctrl+Shift+F12", "the name carries the current binding");
var names = new List<string>();
foreach (var mode in CaptureModes)
{
names.Add(AppSession.Find(window, $"Hotkey_{mode}_Clear").Name);
names.Add(AppSession.Find(window, $"Hotkey_{mode}_Reset").Name);
}
names.Should().OnlyHaveUniqueItems();
record.Click();
Keyboard.TypeSimultaneously(VirtualKeyShort.SHIFT, VirtualKeyShort.TAB);
Retry.WhileFalse(() => record.Name.Contains("Ctrl+Shift+F12", StringComparison.Ordinal), TimeSpan.FromSeconds(5))
.Success.Should().BeTrue("Shift+Tab ends recording without changing the hotkey");
record.Properties.HasKeyboardFocus.ValueOrDefault.Should().BeFalse("Shift+Tab moves the focus on");
ReadSettings(session).Should().NotMatchRegex("\"virtualKey\": 9\\b", "Shift+Tab is never saved as a hotkey");
}
[Fact]
public void Language_SwitchesTheWholeUi()
{
@@ -0,0 +1,226 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) CaptureImage Contributors
using AwesomeAssertions;
using CaptureImage.Core.Capture;
using CaptureImage.Core.Models;
using Xunit;
namespace CaptureImage.Core.Tests.Capture;
public class RegionKeyboardTests
{
private const uint Tab = 0x09;
private const uint Enter = 0x0D;
private const uint Escape = 0x1B;
private const uint Left = 0x25;
private const uint Up = 0x26;
private const uint Right = 0x27;
private const uint Down = 0x28;
private static readonly HotkeyModifiers CtrlShift = HotkeyModifiers.Control | HotkeyModifiers.Shift;
[Fact]
public void SingleKeys_AreEscEnterTabAndShiftTab()
{
RegionKeyboard.SingleKeys.Should().Equal(
new HotkeyBinding(HotkeyModifiers.None, Escape),
new HotkeyBinding(HotkeyModifiers.None, Enter),
new HotkeyBinding(HotkeyModifiers.None, Tab),
new HotkeyBinding(HotkeyModifiers.Shift, Tab));
}
[Fact]
public void RepeatingKeys_AreTheArrowsWithEveryModifierCombination()
{
RegionKeyboard.RepeatingKeys.Should().HaveCount(16).And.OnlyHaveUniqueItems();
RegionKeyboard.RepeatingKeys.Select(k => k.VirtualKey).Distinct().Should().BeEquivalentTo(new[] { Left, Up, Right, Down });
RegionKeyboard.RepeatingKeys.Select(k => k.Modifiers).Distinct().Should().BeEquivalentTo(
new[] { HotkeyModifiers.None, HotkeyModifiers.Shift, HotkeyModifiers.Control, CtrlShift });
}
[Fact]
public void EveryRegisteredKey_MapsToACommand()
{
RegionKeyboard.SingleKeys.Concat(RegionKeyboard.RepeatingKeys)
.Should().OnlyContain(key => RegionKeyboard.Map(key, 10) != null);
}
[Theory]
[InlineData(HotkeyModifiers.None, Escape, RegionKeyAction.Cancel)]
[InlineData(HotkeyModifiers.None, Enter, RegionKeyAction.Confirm)]
[InlineData(HotkeyModifiers.None, Tab, RegionKeyAction.NextMonitor)]
[InlineData(HotkeyModifiers.Shift, Tab, RegionKeyAction.PreviousMonitor)]
public void Map_SingleKeys(HotkeyModifiers modifiers, uint key, RegionKeyAction expected)
{
RegionKeyboard.Map(new HotkeyBinding(modifiers, key), 10).Should().Be(new RegionKeyCommand(expected));
}
[Theory]
[InlineData(HotkeyModifiers.None, Left, RegionKeyAction.Move, -10, 0)]
[InlineData(HotkeyModifiers.None, Right, RegionKeyAction.Move, 10, 0)]
[InlineData(HotkeyModifiers.None, Up, RegionKeyAction.Move, 0, -10)]
[InlineData(HotkeyModifiers.None, Down, RegionKeyAction.Move, 0, 10)]
[InlineData(HotkeyModifiers.Control, Left, RegionKeyAction.Move, -1, 0)]
[InlineData(HotkeyModifiers.Shift, Right, RegionKeyAction.Resize, 10, 0)]
[InlineData(HotkeyModifiers.Shift, Up, RegionKeyAction.Resize, 0, -10)]
[InlineData(HotkeyModifiers.Control | HotkeyModifiers.Shift, Down, RegionKeyAction.Resize, 0, 1)]
public void Map_Arrows(HotkeyModifiers modifiers, uint key, RegionKeyAction action, int dx, int dy)
{
RegionKeyboard.Map(new HotkeyBinding(modifiers, key), 10).Should().Be(new RegionKeyCommand(action, dx, dy));
}
[Fact]
public void Map_StepIsAtLeastOnePixel()
{
RegionKeyboard.Map(new HotkeyBinding(HotkeyModifiers.None, Right), 0).Should().Be(new RegionKeyCommand(RegionKeyAction.Move, 1, 0));
}
[Theory]
[InlineData(HotkeyModifiers.Alt, Left)]
[InlineData(HotkeyModifiers.Win, Up)]
[InlineData(HotkeyModifiers.Control, Tab)]
[InlineData(HotkeyModifiers.Shift, Escape)]
[InlineData(HotkeyModifiers.Control, Enter)]
[InlineData(HotkeyModifiers.None, 0x41u)] // A
public void Map_OtherKeys_AreIgnored(HotkeyModifiers modifiers, uint key)
{
RegionKeyboard.Map(new HotkeyBinding(modifiers, key), 10).Should().BeNull();
}
[Theory]
[InlineData(1.0, 10)]
[InlineData(1.5, 15)]
[InlineData(1.25, 13)]
[InlineData(0.01, 1)]
public void StepFor_ScalesWithTheMonitor(double scale, int expected)
{
RegionKeyboard.StepFor(scale).Should().Be(expected);
}
[Fact]
public void Initial_IsHalfTheMonitorCentred()
{
RegionKeyboard.Initial(1920, 1080).Should().Be(new PixelRect(480, 270, 960, 540));
RegionKeyboard.Initial(1, 1).Should().Be(new PixelRect(0, 0, 1, 1));
}
[Theory]
[InlineData(RegionKeyAction.Move)]
[InlineData(RegionKeyAction.Resize)]
public void Apply_WithoutASelection_CreatesTheInitialOne(RegionKeyAction action)
{
var command = new RegionKeyCommand(action, 10, 0);
RegionKeyboard.Apply(null, command, 1920, 1080).Should().Be(new PixelRect(480, 270, 960, 540));
RegionKeyboard.Apply(default(PixelRect), command, 1920, 1080).Should().Be(new PixelRect(480, 270, 960, 540));
}
[Theory]
[InlineData(RegionKeyAction.Cancel)]
[InlineData(RegionKeyAction.Confirm)]
[InlineData(RegionKeyAction.NextMonitor)]
[InlineData(RegionKeyAction.PreviousMonitor)]
public void Apply_OtherCommands_KeepTheSelection(RegionKeyAction action)
{
var rect = new PixelRect(10, 20, 30, 40);
RegionKeyboard.Apply(rect, new RegionKeyCommand(action), 100, 100).Should().Be(rect);
RegionKeyboard.Apply(null, new RegionKeyCommand(action), 100, 100).Should().BeNull();
}
[Fact]
public void Apply_Move_ShiftsTheSelection()
{
RegionKeyboard.Apply(new PixelRect(10, 20, 30, 40), new RegionKeyCommand(RegionKeyAction.Move, 5, -5), 100, 100)
.Should().Be(new PixelRect(15, 15, 30, 40));
}
[Theory]
[InlineData(-50, 0, 0, 20)]
[InlineData(100, 0, 70, 20)]
[InlineData(0, -50, 10, 0)]
[InlineData(0, 100, 10, 60)]
public void Apply_Move_StopsAtTheEdges(int dx, int dy, int x, int y)
{
RegionKeyboard.Apply(new PixelRect(10, 20, 30, 40), new RegionKeyCommand(RegionKeyAction.Move, dx, dy), 100, 100)
.Should().Be(new PixelRect(x, y, 30, 40));
}
[Fact]
public void Apply_Move_OfAFullWidthSelection_KeepsItInPlace()
{
RegionKeyboard.Apply(new PixelRect(0, 0, 100, 100), new RegionKeyCommand(RegionKeyAction.Move, 10, 10), 100, 100)
.Should().Be(new PixelRect(0, 0, 100, 100));
}
[Fact]
public void Apply_Resize_KeepsTheTopLeftCorner()
{
RegionKeyboard.Apply(new PixelRect(10, 20, 30, 40), new RegionKeyCommand(RegionKeyAction.Resize, 10, -10), 100, 100)
.Should().Be(new PixelRect(10, 20, 40, 30));
}
[Theory]
[InlineData(500, 500, 90, 80)]
[InlineData(-500, -500, RegionKeyboard.MinimumSize, RegionKeyboard.MinimumSize)]
public void Apply_Resize_StaysBetweenTheMinimumAndTheEdges(int dx, int dy, int width, int height)
{
RegionKeyboard.Apply(new PixelRect(10, 20, 30, 40), new RegionKeyCommand(RegionKeyAction.Resize, dx, dy), 100, 100)
.Should().Be(new PixelRect(10, 20, width, height));
}
[Fact]
public void Apply_Resize_NextToTheEdge_NeverExceedsTheMonitor()
{
RegionKeyboard.Apply(new PixelRect(98, 98, 2, 2), new RegionKeyCommand(RegionKeyAction.Resize, -1, 5), 100, 100)
.Should().Be(new PixelRect(98, 98, 2, 2));
}
[Fact]
public void Cycle_OrdersMonitorsLeftToRightThenTopToBottom()
{
// Enumeration order: centre, left, right-bottom, right-top.
PixelRect[] monitors =
[
new(0, 0, 1920, 1080),
new(-1920, 0, 1920, 1080),
new(1920, 1080, 1920, 1080),
new(1920, 0, 1920, 1080),
];
RegionKeyboard.Cycle(monitors, 1, backwards: false).Should().Be(0);
RegionKeyboard.Cycle(monitors, 0, backwards: false).Should().Be(3);
RegionKeyboard.Cycle(monitors, 3, backwards: false).Should().Be(2);
RegionKeyboard.Cycle(monitors, 2, backwards: false).Should().Be(1);
RegionKeyboard.Cycle(monitors, 1, backwards: true).Should().Be(2);
RegionKeyboard.Cycle(monitors, 0, backwards: true).Should().Be(1);
}
[Fact]
public void Cycle_WithOneMonitor_StaysThere()
{
RegionKeyboard.Cycle([new PixelRect(0, 0, 10, 10)], 0, backwards: false).Should().Be(0);
RegionKeyboard.Cycle([new PixelRect(0, 0, 10, 10)], 0, backwards: true).Should().Be(0);
}
[Fact]
public void Cycle_UnknownIndex_StartsAtTheFirstMonitor()
{
RegionKeyboard.Cycle([new PixelRect(100, 0, 10, 10), new PixelRect(0, 0, 10, 10)], 7, backwards: false).Should().Be(1);
}
[Fact]
public void Cycle_NoMonitors_ReturnsTheCurrentIndex()
{
RegionKeyboard.Cycle([], 2, backwards: false).Should().Be(2);
}
[Fact]
public void Cycle_Null_Throws()
{
var act = () => RegionKeyboard.Cycle(null!, 0, backwards: false);
act.Should().Throw<ArgumentNullException>();
}
}
@@ -325,6 +325,70 @@ public sealed class Win32HotkeyServiceTests
}
}
[Fact]
public void RegisterTemporary_WithRepeat_HoldsTheKeysUntilDisposed()
{
var free = FreeBindings(2);
var service = CreateService();
try
{
using (service.RegisterTemporary(free, _ => { }, repeat: true))
{
free.Should().OnlyContain(binding => !FreeHotkeys.IsFree(binding));
}
free.Should().OnlyContain(binding => FreeHotkeys.IsFree(binding));
}
finally
{
service.Dispose();
}
}
[Fact]
public async Task RegisterTemporary_Callbacks_RunOneAtATimeInTheOrderOfThePresses()
{
var free = FreeBindings(2);
var service = CreateService();
try
{
const int presses = 12;
var received = new List<HotkeyBinding>();
var running = 0;
var overlapped = false;
var done = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
using (service.RegisterTemporary(free, binding =>
{
overlapped |= Interlocked.Increment(ref running) > 1;
Thread.Sleep(received.Count == 0 ? 50 : 1); // the first press is slow; later ones must wait for it
lock (received)
{
received.Add(binding);
if (received.Count == presses)
{
done.TrySetResult();
}
}
Interlocked.Decrement(ref running);
}, repeat: true))
{
for (var i = 0; i < presses; i++)
{
SimulateKeyPress(service, FirstTemporaryHotkeyId + (i % 2));
}
await done.Task.WaitAsync(EventTimeout, Ct);
}
overlapped.Should().BeFalse();
received.Should().Equal(Enumerable.Range(0, presses).Select(i => free[i % 2]));
}
finally
{
service.Dispose();
}
}
[Fact]
public void Dispose_ReleasesTemporaryKeys_AndMakesTheServiceInert()
{
@@ -232,7 +232,7 @@
"captureimage.infrastructure": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.3, )",
"CaptureImage.Core": "[2.1.0, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )",
"Serilog": "[4.4.0, )",
"SkiaSharp": "[4.154.0, )",
@@ -157,6 +157,16 @@ public sealed class LibraryViewModelTests : IDisposable
item.SizeText.Should().Contain("5").And.Contain("MB");
}
[Fact]
public void Item_AutomationName_ListsFileGameDateAndHdr()
{
var hdr = new CaptureItemViewModel(Record(@"C:\Shots\elden.png", "Elden Ring", hdr: true), _library);
var plain = new CaptureItemViewModel(Record(@"C:\Shots\region.png", null), _library);
hdr.AutomationName.Should().Be($"elden.png, Elden Ring, {hdr.CapturedAtText}, HDR");
plain.AutomationName.Should().Be($"region.png, {plain.CapturedAtText}");
}
private static CaptureRecord Record(string path, string? game, bool hdr = false) =>
new(path, Now, 1920, 1080, ImageFormatExtensions.FromExtension(Path.GetExtension(path)) ?? ImageFormat.Png, 2048,
CaptureMode.Window, game, hdr ? Path.ChangeExtension(path, ".jxr") : null);
@@ -159,4 +159,37 @@ public sealed class ProfilesViewModelTests : IDisposable
_vm.Profiles.Should().HaveCount(2);
_vm.SelectedProfile!.Id.Should().Be(id);
}
[Fact]
public void Item_AutomationName_IncludesWhatItMatchesAndItsBadges()
{
_vm.AddCommand.Execute(null);
_vm.Name = "Elden Ring";
_vm.ExecutableName = "eldenring.exe";
var item = _vm.Profiles.Single();
var changed = new List<string?>();
item.PropertyChanged += (_, e) => changed.Add(e.PropertyName);
item.AutomationName.Should().Be("Elden Ring, eldenring.exe");
_vm.AutoArm = true;
_vm.Enabled = false;
item.AutomationName.Should().Be("Elden Ring, eldenring.exe, Profiles_AutoArmBadge, Profiles_DisabledBadge");
changed.Should().Contain(nameof(ProfileItemViewModel.AutomationName));
}
[Fact]
public void LanguageSwitch_RefreshesTheItemNames()
{
var localization = new KeyLocalization();
using var vm = new ProfilesViewModel(_store, _dialogs, new InlineDispatcher(), localization, _messenger);
vm.AddCommand.Execute(null);
var changed = new List<string?>();
vm.Profiles.Single().PropertyChanged += (_, e) => changed.Add(e.PropertyName);
localization.SetCulture(System.Globalization.CultureInfo.GetCultureInfo("vi-VN"));
changed.Should().Contain(nameof(ProfileItemViewModel.AutomationName));
}
}
@@ -16,6 +16,7 @@ public sealed class HotkeyBindingViewModelTests : IDisposable
private const uint VkF9 = 0x78;
private const uint VkG = 0x47;
private const uint VkShift = 0x10;
private const uint VkTab = 0x09;
private readonly FakeSettingsStore _store = new();
private readonly CoordinatorFixture _fixture;
@@ -136,4 +137,69 @@ public sealed class HotkeyBindingViewModelTests : IDisposable
_window.ApplyRegistration(new HotkeyRegistration(CaptureMode.Window, HotkeyBinding.Default, HotkeyRegistrationStatus.Registered));
_window.HasError.Should().BeFalse();
}
[Theory]
[InlineData(HotkeyModifiers.None)]
[InlineData(HotkeyModifiers.Shift)]
public void TabWhileRecording_CancelsAndLetsTheFocusMove(HotkeyModifiers modifiers)
{
_fixture.Coordinator.Arm();
_window.StartRecordingCommand.Execute(null);
_fixture.Hotkeys.ClearReceivedCalls();
_window.ReleaseFocus(modifiers, VkTab).Should().BeTrue();
_window.IsRecording.Should().BeFalse();
_window.HasError.Should().BeFalse();
_store.Current.Hotkeys.Window.Should().Be(HotkeyBinding.DefaultFor(CaptureMode.Window), "Shift+Tab must not become the hotkey");
_fixture.Hotkeys.Received(1).Activate(Arg.Any<HotkeySettings>());
}
[Theory]
[InlineData(HotkeyModifiers.Control, VkTab)]
[InlineData(HotkeyModifiers.Alt | HotkeyModifiers.Shift, VkTab)]
[InlineData(HotkeyModifiers.None, VkF9)]
public void OtherKeysWhileRecording_AreRecorded(HotkeyModifiers modifiers, uint key)
{
_window.StartRecordingCommand.Execute(null);
_window.ReleaseFocus(modifiers, key).Should().BeFalse();
_window.IsRecording.Should().BeTrue();
}
[Fact]
public void TabWhileNotRecording_IsLeftAlone()
{
_window.ReleaseFocus(HotkeyModifiers.None, VkTab).Should().BeFalse();
}
[Fact]
public void AccessibleNames_NameTheModeAndTheBinding()
{
var localization = Substitute.For<ILocalizationService>();
localization.CurrentCulture.Returns(System.Globalization.CultureInfo.InvariantCulture);
localization[Arg.Any<string>()].Returns(call => call.Arg<string>() switch
{
"Hotkey_AccessibleName" => "{0}, {1}",
"Settings_HotkeyClearNamed" => "Clear {0}",
"Settings_HotkeyResetNamed" => "Reset {0}",
var key => key,
});
var region = new HotkeyBindingViewModel(CaptureMode.Region, _store, _fixture.Coordinator, _fixture.Hotkeys, localization);
var changed = new List<string?>();
region.PropertyChanged += (_, e) => changed.Add(e.PropertyName);
region.AccessibleName.Should().Be("Mode_Region, " + HotkeyBinding.DefaultFor(CaptureMode.Region));
region.ClearName.Should().Be("Clear Mode_Region");
region.ResetName.Should().Be("Reset Mode_Region");
region.StartRecordingCommand.Execute(null);
region.AccessibleName.Should().Be("Mode_Region, Hotkey_PressKeys");
changed.Should().Contain(nameof(HotkeyBindingViewModel.AccessibleName));
changed.Clear();
region.RefreshText();
changed.Should().Contain([nameof(HotkeyBindingViewModel.AccessibleName), nameof(HotkeyBindingViewModel.ClearName), nameof(HotkeyBindingViewModel.ResetName)]);
}
}
@@ -193,7 +193,7 @@
"captureimage.viewmodels": {
"type": "Project",
"dependencies": {
"CaptureImage.Core": "[2.0.3, )",
"CaptureImage.Core": "[2.1.0, )",
"CommunityToolkit.Mvvm": "[8.4.2, )",
"Microsoft.Extensions.DependencyInjection.Abstractions": "[10.0.14, )",
"Microsoft.Extensions.Logging.Abstractions": "[10.0.14, )"