Skip to content

Commit 332a37b

Browse files
committed
Checking in new file
1 parent 82d3dcd commit 332a37b

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: Microsoft Copilot hardware key PressAndHoldAndRelease
3+
description: Learn how to register to be activated and receive notifications when the Microsoft Copilot hardware key or Windows + C is pressed.
4+
ms.topic: article
5+
ms.date: 10/25/2024
6+
ms.localizationpriority: medium
7+
---
8+
9+
10+
11+
# Microsoft Copilot hardware key PressAndHoldAndRelease
12+
13+
This article describes how apps can register to be activated and receive notifications when the Microsoft Copilot hardware key or Windows + C is pressed. This feature enables the following user scenario.
14+
15+
1. The user presses the Microsoft Copilot Hardware key or Windows + C and holds it for the system-defined 700 ms time window.
16+
1. The system launches the Copilot Key provider app, letting the app know that the user is pressing and holding the key.
17+
1. The app begins recording audio and shows a window indicating to the user that audio is being recorded.
18+
1. The user speaks and then releases the key.
19+
1. The app is notified that the key has been released, prompting it to process the recorded speech and taking additional actions based on the user's words.
20+
21+
This feature extends the features of a basic Microsoft Copilot hardware key provider, which simply registers to be launched when the hardware key is pressed. For more information, see [Microsoft Copilot hardware key providers](microsoft-copliot-key-provider.md).
22+
23+
## Register for URI activation
24+
25+
The system launches Microsoft Copilot hardware key providers that implement PressAndHoldAndRelease using URI activation. Register a launch protocol by adding the [uap:Protocol](/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol) element to your app manifest. For more information about how to register as the default handler for a URI scheme, see [Handle URI activation](/windows/apps/develop/launch/handle-uri-activation).
26+
27+
The following example shows the **uap:Extension** registering the URI scheme "myapp-copilothotkey".
28+
29+
```xml
30+
...
31+
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
32+
...
33+
34+
<Extensions>
35+
...
36+
<uap:Extension Category="windows.protocol">
37+
<uap:Protocol Name="myapp-copilothotkey"> <!-- app-defined protocol name -->
38+
<uap:DisplayName>SDK Sample URI Scheme</uap:DisplayName>
39+
</uap:Protocol>
40+
</uap:Extension>
41+
...
42+
```
43+
44+
## Microsoft Copilot hardware key app extension
45+
46+
An app must be packaged in order to register as a Microsoft Copilot hardware key provider. For information on app packaging, see [An overview of Package Identity in Windows app](/windows/apps/desktop/modernize/package-identity-overview). Microsoft Copilot hardware key providers declare their registration information within the [uap3:AppExtension](/uwp/schemas/appxpackage/uapmanifestschema/element-uap3-appextension-manual). The **Name** attribute of the extension must be set to "com.microsoft.windows.copilotkeyprovider". To support the PressAndHoldAndRelease feature, apps must provide some additional entries to their **uap3:AppExtension** declaration.
47+
48+
Inside of the **uap3:AppExtension** element, add a [uap3:Properties](/uwp/schemas/appxpackage/uapmanifestschema/element-uap3-properties-manual) element with child elements **PressAndHoldStart** and **PressAndHoldStart**. The contents of these elements should be the URI of the protocol scheme registered in the manifest in the previous step. The query string arguments specify whether the URI is being launched because the user pressed and held the hot key or because the user released the hot key. The app uses these query string values during app activation to determine the correct action to take.
49+
50+
The following example shows a Copilot hot key provider registration with support for PressAndHoldAndRelease.
51+
52+
```xml
53+
<Extensions>
54+
...
55+
<uap3:Extension Category="windows.appExtension">
56+
<uap3:AppExtension Name="com.microsoft.windows.copilotkeyprovider"
57+
Id="MyAppId"
58+
DisplayName="App display name"
59+
Description="App description"
60+
PublicFolder="Public">
61+
<uap3:Properties>
62+
<PressAndHoldStart>myapp-copilothotkey:?state=Down</PressAndHoldStart>
63+
<PressAndHoldStop>myapp-copilothotkey:?state=Up</PressAndHoldStop>
64+
</uap3:Properties>
65+
</ uap3:AppExtension>
66+
</uap3:Extension>
67+
...
68+
```
69+
70+
## Handle app activation
71+

0 commit comments

Comments
 (0)