mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-07-05 18:09:23 +02:00
Compare commits
36 Commits
shawn/Pyth
...
pr35429
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1c1161d3b | ||
|
|
4208e05826 | ||
|
|
207b5dae50 | ||
|
|
6828961262 | ||
|
|
265e52967a | ||
|
|
f1308fad5e | ||
|
|
235a299b73 | ||
|
|
f60b294dcb | ||
|
|
5149ed4c00 | ||
|
|
b92db8134b | ||
|
|
b18652ad6c | ||
|
|
9bbda17811 | ||
|
|
ee4440f65f | ||
|
|
2234db6c6b | ||
|
|
cf5afc6c1c | ||
|
|
3de225c8fe | ||
|
|
9324162007 | ||
|
|
e21783473e | ||
|
|
e1fa78c50f | ||
|
|
8cb70648d3 | ||
|
|
d45ae2c197 | ||
|
|
5c0e14656e | ||
|
|
f9b1588375 | ||
|
|
5596a32e3d | ||
|
|
51a33afbdb | ||
|
|
ce010f5f7a | ||
|
|
27b234e38e | ||
|
|
c716aa65ae | ||
|
|
3c6d882e91 | ||
|
|
c87a344007 | ||
|
|
f97cc86f67 | ||
|
|
e7cc3a04f7 | ||
|
|
9c0ef91fd9 | ||
|
|
f2ed58f329 | ||
|
|
96c09532fa | ||
|
|
65a313fb4e |
@@ -178,7 +178,8 @@ void notifications::show_toast_with_activations(std::wstring message,
|
|||||||
std::wstring title,
|
std::wstring title,
|
||||||
std::wstring_view background_handler_id,
|
std::wstring_view background_handler_id,
|
||||||
std::vector<action_t> actions,
|
std::vector<action_t> actions,
|
||||||
toast_params params)
|
toast_params params,
|
||||||
|
std::wstring launch_uri)
|
||||||
{
|
{
|
||||||
// DO NOT LOCALIZE any string in this function, because they're XML tags and a subject to
|
// DO NOT LOCALIZE any string in this function, because they're XML tags and a subject to
|
||||||
// https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
|
// https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
|
||||||
@@ -189,7 +190,18 @@ void notifications::show_toast_with_activations(std::wstring message,
|
|||||||
// We must set toast's title and contents immediately, because some of the toasts we send could be snoozed.
|
// We must set toast's title and contents immediately, because some of the toasts we send could be snoozed.
|
||||||
// Windows instantiates the snoozed toast from scratch before showing it again, so all bindings that were set
|
// Windows instantiates the snoozed toast from scratch before showing it again, so all bindings that were set
|
||||||
// using NotificationData would be empty.
|
// using NotificationData would be empty.
|
||||||
toast_xml += LR"(<?xml version="1.0"?><toast><visual><binding template="ToastGeneric">)";
|
// Add the launch attribute if launch_uri is provided, otherwise omit it
|
||||||
|
toast_xml += LR"(<?xml version="1.0"?>)";
|
||||||
|
if (!launch_uri.empty())
|
||||||
|
{
|
||||||
|
toast_xml += LR"(<toast launch=")" + launch_uri + LR"(" activationType="protocol">)"; // Use the launch URI if provided
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toast_xml += LR"(<toast>)"; // No launch attribute if empty
|
||||||
|
}
|
||||||
|
|
||||||
|
toast_xml += LR"(<visual><binding template="ToastGeneric">)";
|
||||||
toast_xml += LR"(<text id="1">)";
|
toast_xml += LR"(<text id="1">)";
|
||||||
toast_xml += std::move(title);
|
toast_xml += std::move(title);
|
||||||
toast_xml += LR"(</text>)";
|
toast_xml += LR"(</text>)";
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace notifications
|
|||||||
using action_t = std::variant<link_button, background_activated_button, snooze_button>;
|
using action_t = std::variant<link_button, background_activated_button, snooze_button>;
|
||||||
|
|
||||||
void show_toast(std::wstring plaintext_message, std::wstring title, toast_params params = {});
|
void show_toast(std::wstring plaintext_message, std::wstring title, toast_params params = {});
|
||||||
void show_toast_with_activations(std::wstring plaintext_message, std::wstring title, std::wstring_view background_handler_id, std::vector<action_t> actions, toast_params params = {});
|
void show_toast_with_activations(std::wstring plaintext_message, std::wstring title, std::wstring_view background_handler_id, std::vector<action_t> actions, toast_params params = {}, std::wstring launch_uri = L"");
|
||||||
void update_toast_progress_bar(std::wstring_view tag, progress_bar_params params);
|
void update_toast_progress_bar(std::wstring_view tag, progress_bar_params params);
|
||||||
void remove_toasts_by_tag(std::wstring_view tag);
|
void remove_toasts_by_tag(std::wstring_view tag);
|
||||||
void remove_all_scheduled_toasts();
|
void remove_all_scheduled_toasts();
|
||||||
|
|||||||
@@ -53,8 +53,9 @@ void ShowNewVersionAvailable(const new_version_download_info& info)
|
|||||||
{ link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_NOW),
|
{ link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_NOW),
|
||||||
L"powertoys://update_now/" },
|
L"powertoys://update_now/" },
|
||||||
link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO),
|
link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO),
|
||||||
L"powertoys://open_settings/" } },
|
L"powertoys://open_overview/" } },
|
||||||
std::move(toast_params));
|
std::move(toast_params),
|
||||||
|
L"powertoys://open_overview/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowOpenSettingsForUpdate()
|
void ShowOpenSettingsForUpdate()
|
||||||
@@ -65,13 +66,14 @@ void ShowOpenSettingsForUpdate()
|
|||||||
|
|
||||||
std::vector<action_t> actions = {
|
std::vector<action_t> actions = {
|
||||||
link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO),
|
link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO),
|
||||||
L"powertoys://open_settings/" },
|
L"powertoys://open_overview/" },
|
||||||
};
|
};
|
||||||
show_toast_with_activations(GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE),
|
show_toast_with_activations(GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE),
|
||||||
GET_RESOURCE_STRING(IDS_TOAST_TITLE),
|
GET_RESOURCE_STRING(IDS_TOAST_TITLE),
|
||||||
{},
|
{},
|
||||||
std::move(actions),
|
std::move(actions),
|
||||||
std::move(toast_params));
|
std::move(toast_params),
|
||||||
|
L"powertoys://open_overview/");
|
||||||
}
|
}
|
||||||
|
|
||||||
SHELLEXECUTEINFOW LaunchPowerToysUpdate(const wchar_t* cmdline)
|
SHELLEXECUTEINFOW LaunchPowerToysUpdate(const wchar_t* cmdline)
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_
|
|||||||
const std::wstring_view cant_drag_elevated_disable = L"cant_drag_elevated_disable/";
|
const std::wstring_view cant_drag_elevated_disable = L"cant_drag_elevated_disable/";
|
||||||
const std::wstring_view couldnt_toggle_powerpreview_modules_disable = L"couldnt_toggle_powerpreview_modules_disable/";
|
const std::wstring_view couldnt_toggle_powerpreview_modules_disable = L"couldnt_toggle_powerpreview_modules_disable/";
|
||||||
const std::wstring_view open_settings = L"open_settings/";
|
const std::wstring_view open_settings = L"open_settings/";
|
||||||
|
const std::wstring_view open_overview = L"open_overview/";
|
||||||
const std::wstring_view update_now = L"update_now/";
|
const std::wstring_view update_now = L"update_now/";
|
||||||
|
|
||||||
if (param == cant_drag_elevated_disable)
|
if (param == cant_drag_elevated_disable)
|
||||||
@@ -296,6 +297,11 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_
|
|||||||
open_menu_from_another_instance(std::nullopt);
|
open_menu_from_another_instance(std::nullopt);
|
||||||
return toast_notification_handler_result::exit_success;
|
return toast_notification_handler_result::exit_success;
|
||||||
}
|
}
|
||||||
|
else if (param == open_overview)
|
||||||
|
{
|
||||||
|
open_menu_from_another_instance("Overview");
|
||||||
|
return toast_notification_handler_result::exit_success;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return toast_notification_handler_result::exit_error;
|
return toast_notification_handler_result::exit_error;
|
||||||
|
|||||||
Reference in New Issue
Block a user