Compare commits

...

39 Commits

Author SHA1 Message Date
Jaime Bernardo
b1c1161d3b Merge branch 'main' into pr35429 2024-10-28 09:14:15 +00:00
Clint Rutkas
64845b7fd8 Updating navigation tree for settings with groupings (#35559)
* adjusting stuff from here to there

* No longer crashing!  a win!

* Resources now

* spelling

* adjusting comments for xaml formatting

* added in new top level icons

* Fixing

* adjusting the core container logic based on feedback.  this is actually simplier and just leverages the builti in stuff as well

* getting frame_nav functional again, thanks @davidegiacometti

* making a one time hit for union

* Update src/settings-ui/Settings.UI/ViewModels/ShellViewModel.cs

Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>

* expanding code that @davidegiacometti suggestedion.  🔥

* ensure parent is always expanded when page is changed

* don't use static

---------

Co-authored-by: Ethan Fang <ethanfang@microsoft.com>
Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>
Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
2024-10-27 15:21:27 -07:00
Stefan Markovic
83d3c85f3e [Settings]Fix crash caused by dangling thread (#35603)
* Fix crash caused by dangling thread

* Fix process access to be able to WaitForSingleObject it
2024-10-27 20:51:11 +00:00
Gokce Kantarci
4208e05826 [Runner] Open General page instead dashboard. 2024-10-25 18:33:35 +03:00
Jaime Bernardo
a0138cec5e [MouseJump]Bring back telemetry events (#35582) 2024-10-25 13:28:01 +01:00
Gokce Kantarci
207b5dae50 [Runner] Remove unnecessary code. 2024-10-14 14:58:00 +03:00
Gokce Kantarci
6828961262 [Runner] Remove unnecessary code. 2024-10-14 14:55:18 +03:00
Gokce Kantarci
265e52967a [Runner] Remove unnecessary code. 2024-10-14 14:53:58 +03:00
Gokce Kantarci
f1308fad5e [Runner] Remove unnecessary code. 2024-10-14 14:52:48 +03:00
Gokce Kantarci
235a299b73 [Runner] Remove unnecessary code. 2024-10-14 14:51:01 +03:00
Gokce Kantarci
f60b294dcb [Runner] Clicking update notification opens PT Settings. 2024-10-14 14:49:06 +03:00
Gokce Kantarci
5149ed4c00 Merge branch 'main' of https://github.com/gokcekantarci/PowerToys 2024-10-11 12:56:02 +03:00
Gokce Kantarci
b92db8134b Merge remote-tracking branch 'upstream/main' 2024-10-11 12:53:46 +03:00
Gokce Kantarci
b18652ad6c Merge branch 'main' of https://github.com/gokcekantarci/PowerToys 2024-10-04 12:26:15 +03:00
Gokce Kantarci
9bbda17811 Merge remote-tracking branch 'upstream/main' 2024-10-04 12:21:06 +03:00
Gokce Kantarci
ee4440f65f Merge remote-tracking branch 'upstream/main' 2024-09-24 14:11:01 +03:00
Gokce Kantarci
2234db6c6b Merge remote-tracking branch 'upstream/main' 2024-09-19 15:12:31 +03:00
Gokce Kantarci
cf5afc6c1c Merge remote-tracking branch 'upstream/main' 2024-09-17 15:42:03 +03:00
Gokce Kantarci
3de225c8fe Merge remote-tracking branch 'upstream/main' 2024-07-23 13:34:02 +03:00
Gokce Kantarci
9324162007 [BugReport] bug_report.yml is changed. 2024-07-09 15:55:01 +03:00
Gokce Kantarci
e21783473e iselevated 2024-06-10 14:31:17 +03:00
Gokce Kantarci
e1fa78c50f iselevated 2024-06-10 14:22:57 +03:00
Gokce Kantarci
8cb70648d3 Main test bug_report.yml 2024-06-07 15:44:41 +03:00
Gokce Kantarci
d45ae2c197 Revert "Test version"
This reverts commit 65a313fb4e.
2024-06-07 13:52:24 +03:00
Gokce Kantarci
5c0e14656e Revert "Github URL"
This reverts commit 96c09532fa.
2024-06-07 13:52:19 +03:00
Gokce Kantarci
f9b1588375 Revert "repro"
This reverts commit f2ed58f329.
2024-06-07 13:52:16 +03:00
Gokce Kantarci
5596a32e3d Revert "os version"
This reverts commit 9c0ef91fd9.
2024-06-07 13:52:13 +03:00
Gokce Kantarci
51a33afbdb Revert "isadmin"
This reverts commit e7cc3a04f7.
2024-06-07 13:52:10 +03:00
Gokce Kantarci
ce010f5f7a Revert "report"
This reverts commit f97cc86f67.
2024-06-07 13:52:05 +03:00
Gokce Kantarci
27b234e38e Revert "report"
This reverts commit c87a344007.
2024-06-07 13:52:02 +03:00
Gokce Kantarci
c716aa65ae Revert "report"
This reverts commit 3c6d882e91.
2024-06-07 13:51:58 +03:00
Gokce Kantarci
3c6d882e91 report 2024-06-06 15:58:52 +03:00
Gokce Kantarci
c87a344007 report 2024-06-06 15:56:55 +03:00
Gokce Kantarci
f97cc86f67 report 2024-06-06 15:55:47 +03:00
Gokce Kantarci
e7cc3a04f7 isadmin 2024-06-05 17:27:18 +03:00
Gokce Kantarci
9c0ef91fd9 os version 2024-06-05 16:58:31 +03:00
Gokce Kantarci
f2ed58f329 repro 2024-06-04 17:02:31 +03:00
Gokce Kantarci
96c09532fa Github URL 2024-06-03 15:09:23 +03:00
Gokce Kantarci
65a313fb4e Test version 2024-06-03 15:07:45 +03:00
22 changed files with 267 additions and 155 deletions

View File

@@ -91,6 +91,10 @@ namespace winrt::PowerToys::Interop::implementation
{
return CommonSharedConstants::MOUSE_JUMP_SHOW_PREVIEW_EVENT;
}
hstring Constants::TerminateMouseJumpSharedEvent()
{
return CommonSharedConstants::TERMINATE_MOUSE_JUMP_SHARED_EVENT;
}
hstring Constants::AwakeExitEvent()
{
return CommonSharedConstants::AWAKE_EXIT_EVENT;

View File

@@ -26,6 +26,7 @@ namespace winrt::PowerToys::Interop::implementation
static hstring ShowPowerOCRSharedEvent();
static hstring TerminatePowerOCRSharedEvent();
static hstring MouseJumpShowPreviewEvent();
static hstring TerminateMouseJumpSharedEvent();
static hstring AwakeExitEvent();
static hstring ShowPeekEvent();
static hstring TerminatePeekEvent();

View File

@@ -23,6 +23,7 @@ namespace PowerToys
static String ShowPowerOCRSharedEvent();
static String TerminatePowerOCRSharedEvent();
static String MouseJumpShowPreviewEvent();
static String TerminateMouseJumpSharedEvent();
static String AwakeExitEvent();
static String ShowPeekEvent();
static String TerminatePeekEvent();

View File

@@ -81,6 +81,8 @@ namespace CommonSharedConstants
// Path to the events used by Mouse Jump
const wchar_t MOUSE_JUMP_SHOW_PREVIEW_EVENT[] = L"Local\\MouseJumpEvent-aa0be051-3396-4976-b7ba-1a9cc7d236a5";
const wchar_t TERMINATE_MOUSE_JUMP_SHARED_EVENT[] = L"Local\\TerminateMouseJumpEvent-252fa337-317f-4c37-a61f-99464c3f9728";
// Path to the event used by RegistryPreview
const wchar_t REGISTRY_PREVIEW_TRIGGER_EVENT[] = L"Local\\RegistryPreviewEvent-4C559468-F75A-4E7F-BC4F-9C9688316687";

View File

@@ -178,7 +178,8 @@ void notifications::show_toast_with_activations(std::wstring message,
std::wstring title,
std::wstring_view background_handler_id,
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
// 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.
// Windows instantiates the snoozed toast from scratch before showing it again, so all bindings that were set
// 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 += std::move(title);
toast_xml += LR"(</text>)";

View File

@@ -56,7 +56,7 @@ namespace notifications
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_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 remove_toasts_by_tag(std::wstring_view tag);
void remove_all_scheduled_toasts();

View File

@@ -62,9 +62,12 @@ private:
Hotkey m_hotkey;
// Handle to event used to invoke PowerOCR
// Handle to event used to invoke MouseJump
HANDLE m_hInvokeEvent;
// Handle to event used to terminate MouseJump
HANDLE m_hTerminateEvent;
void parse_hotkey(PowerToysSettings::PowerToyValues& settings)
{
auto settingsObject = settings.get_raw_json();
@@ -154,6 +157,7 @@ public:
{
LoggerHelpers::init_logger(MODULE_NAME, L"ModuleInterface", LogSettings::mouseJumpLoggerName);
m_hInvokeEvent = CreateDefaultEvent(CommonSharedConstants::MOUSE_JUMP_SHOW_PREVIEW_EVENT);
m_hTerminateEvent = CreateDefaultEvent(CommonSharedConstants::TERMINATE_MOUSE_JUMP_SHARED_EVENT);
init_settings();
};
@@ -245,6 +249,8 @@ public:
if (m_enabled)
{
ResetEvent(m_hInvokeEvent);
SetEvent(m_hTerminateEvent);
WaitForSingleObject(m_hProcess, 1500);
TerminateProcess(m_hProcess, 1);
}

View File

@@ -166,6 +166,7 @@ internal sealed partial class MainForm : Form
// move mouse pointer
Logger.LogInfo($"clicked location = {clickedLocation}");
Microsoft.PowerToys.Telemetry.PowerToysTelemetry.Log.WriteEvent(new Telemetry.MouseJumpTeleportCursorEvent());
MouseHelper.SetCursorPosition(clickedLocation);
}
@@ -202,6 +203,8 @@ internal sealed partial class MainForm : Form
stopwatch.Stop();
Microsoft.PowerToys.Telemetry.PowerToysTelemetry.Log.WriteEvent(new Telemetry.MouseJumpShowEvent());
// we have to activate the form to make sure the deactivate event fires
this.Activate();
}

View File

@@ -13,6 +13,7 @@ using System.Windows.Threading;
using Common.UI;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Telemetry;
using MouseJumpUI.Helpers;
using PowerToys.Interop;
@@ -20,6 +21,8 @@ namespace MouseJumpUI;
internal static class Program
{
private static CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
/// <summary>
/// The main entry point for the application.
/// </summary>
@@ -27,6 +30,7 @@ internal static class Program
private static void Main(string[] args)
{
Logger.InitializeLogger("\\MouseJump\\Logs");
ETWTrace etwTrace = new ETWTrace();
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
@@ -62,13 +66,10 @@ internal static class Program
Logger.LogInfo($"Mouse Jump started from the PowerToys Runner. Runner pid={runnerPid}");
var cancellationTokenSource = new CancellationTokenSource();
RunnerHelper.WaitForPowerToysRunner(runnerPid, () =>
{
Logger.LogInfo("PowerToys Runner exited. Exiting Mouse Jump");
cancellationTokenSource.Cancel();
Application.Exit();
Logger.LogInfo("PowerToys Runner exited.");
TerminateApp();
});
var settingsHelper = new SettingsHelper();
@@ -80,7 +81,21 @@ internal static class Program
Dispatcher.CurrentDispatcher,
cancellationTokenSource.Token);
NativeEventWaiter.WaitForEventLoop(
Constants.TerminateMouseJumpSharedEvent(),
TerminateApp,
Dispatcher.CurrentDispatcher,
cancellationTokenSource.Token);
Application.Run();
etwTrace?.Dispose();
}
private static void TerminateApp()
{
Logger.LogInfo("Exiting Mouse Jump.");
cancellationTokenSource.Cancel();
Application.Exit();
}
private static MouseJumpSettings ReadSettings()

View File

@@ -53,8 +53,9 @@ void ShowNewVersionAvailable(const new_version_download_info& info)
{ link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_NOW),
L"powertoys://update_now/" },
link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO),
L"powertoys://open_settings/" } },
std::move(toast_params));
L"powertoys://open_overview/" } },
std::move(toast_params),
L"powertoys://open_overview/");
}
void ShowOpenSettingsForUpdate()
@@ -65,13 +66,14 @@ void ShowOpenSettingsForUpdate()
std::vector<action_t> actions = {
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),
GET_RESOURCE_STRING(IDS_TOAST_TITLE),
{},
std::move(actions),
std::move(toast_params));
std::move(toast_params),
L"powertoys://open_overview/");
}
SHELLEXECUTEINFOW LaunchPowerToysUpdate(const wchar_t* cmdline)

View File

@@ -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 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_overview = L"open_overview/";
const std::wstring_view update_now = L"update_now/";
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);
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
{
return toast_notification_handler_result::exit_error;

View File

@@ -625,7 +625,7 @@ void close_settings_window()
if (g_settings_process_id != 0)
{
SetEvent(g_terminateSettingsEvent);
wil::unique_handle proc{ OpenProcess(PROCESS_TERMINATE, false, g_settings_process_id) };
wil::unique_handle proc{ OpenProcess(PROCESS_ALL_ACCESS, false, g_settings_process_id) };
if (proc)
{
WaitForSingleObject(proc.get(), 1500);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -4,7 +4,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.UI.Dispatching;
namespace Microsoft.PowerToys.Settings.UI.Helpers
@@ -14,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
public static void WaitForEventLoop(string eventName, Action callback)
{
var dispatcherQueue = DispatcherQueue.GetForCurrentThread();
new Thread(() =>
new Task(() =>
{
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName);
while (true)

View File

@@ -105,135 +105,159 @@
</NavigationViewItem>
<NavigationViewItemSeparator />
<!-- System Tools -->
<NavigationViewItem
x:Uid="Shell_AdvancedPaste"
helpers:NavHelper.NavigateTo="views:AdvancedPastePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AdvancedPaste.png}" />
x:Uid="Shell_TopLevelSystemTools"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/SystemTools.png}"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_AdvancedPaste"
helpers:NavHelper.NavigateTo="views:AdvancedPastePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AdvancedPaste.png}" />
<NavigationViewItem
x:Uid="Shell_Awake"
helpers:NavHelper.NavigateTo="views:AwakePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Awake.png}" />
<NavigationViewItem
x:Uid="Shell_ColorPicker"
helpers:NavHelper.NavigateTo="views:ColorPickerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ColorPicker.png}" />
<NavigationViewItem
x:Uid="Shell_PowerLauncher"
helpers:NavHelper.NavigateTo="views:PowerLauncherPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerToysRun.png}" />
<NavigationViewItem
x:Uid="Shell_MeasureTool"
helpers:NavHelper.NavigateTo="views:MeasureToolPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ScreenRuler.png}" />
<NavigationViewItem
x:Uid="Shell_ShortcutGuide"
helpers:NavHelper.NavigateTo="views:ShortcutGuidePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ShortcutGuide.png}" />
<NavigationViewItem
x:Uid="Shell_TextExtractor"
helpers:NavHelper.NavigateTo="views:PowerOcrPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/TextExtractor.png}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>
<!-- Windowing & Layouts -->
<NavigationViewItem
x:Uid="Shell_AlwaysOnTop"
helpers:NavHelper.NavigateTo="views:AlwaysOnTopPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AlwaysOnTop.png}" />
x:Uid="Shell_TopLevelWindowsAndLayouts "
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/WindowingAndLayouts.png}"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_AlwaysOnTop"
helpers:NavHelper.NavigateTo="views:AlwaysOnTopPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AlwaysOnTop.png}" />
<NavigationViewItem
x:Uid="Shell_CropAndLock"
helpers:NavHelper.NavigateTo="views:CropAndLockPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CropAndLock.png}" />
<NavigationViewItem
x:Uid="Shell_FancyZones"
helpers:NavHelper.NavigateTo="views:FancyZonesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FancyZones.png}" />
<NavigationViewItem
x:Uid="Shell_Workspaces"
helpers:NavHelper.NavigateTo="views:WorkspacesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Workspaces.png}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>
<!-- Input / Output -->
<NavigationViewItem
x:Uid="Shell_Awake"
helpers:NavHelper.NavigateTo="views:AwakePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Awake.png}" />
x:Uid="Shell_TopLevelInputOutput"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/InputOutput.png}"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_KeyboardManager"
helpers:NavHelper.NavigateTo="views:KeyboardManagerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/KeyboardManager.png}" />
<!-- Find my mouse -->
<!-- Mouse Highlighter -->
<NavigationViewItem
x:Uid="Shell_MouseUtilities"
helpers:NavHelper.NavigateTo="views:MouseUtilsPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseUtils.png}" />
<NavigationViewItem
x:Uid="Shell_MouseWithoutBorders"
helpers:NavHelper.NavigateTo="views:MouseWithoutBordersPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseWithoutBorders.png}" />
<NavigationViewItem
x:Uid="Shell_QuickAccent"
helpers:NavHelper.NavigateTo="views:PowerAccentPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/QuickAccent.png}" />
<!-- Mouse pointer cross hair -->
<NavigationViewItem
x:Uid="Shell_VideoConference"
helpers:NavHelper.NavigateTo="views:VideoConferencePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/VideoConferenceMute.png}"
IsEnabled="{x:Bind ViewModel.IsVideoConferenceBuild, Mode=OneWay}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>
<!-- File Management -->
<NavigationViewItem
x:Uid="Shell_ColorPicker"
helpers:NavHelper.NavigateTo="views:ColorPickerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ColorPicker.png}" />
x:Uid="Shell_TopLevelFileManagement"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileManagement.png}"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_PowerPreview"
helpers:NavHelper.NavigateTo="views:PowerPreviewPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileExplorerPreview.png}" />
<!-- File Explorer Thumbnails -->
<NavigationViewItem
x:Uid="Shell_FileLocksmith"
helpers:NavHelper.NavigateTo="views:FileLocksmithPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileLocksmith.png}" />
<NavigationViewItem
x:Uid="Shell_ImageResizer"
helpers:NavHelper.NavigateTo="views:ImageResizerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ImageResizer.png}" />
<NavigationViewItem
x:Uid="NewPlus_Product_Name"
helpers:NavHelper.NavigateTo="views:NewPlusPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/NewPlus.png}" />
<NavigationViewItem
x:Uid="Shell_Peek"
helpers:NavHelper.NavigateTo="views:PeekPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Peek.png}" />
<NavigationViewItem
x:Uid="Shell_PowerRename"
helpers:NavHelper.NavigateTo="views:PowerRenamePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerRename.png}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>
<!-- Advanced -->
<NavigationViewItem
x:Uid="Shell_CmdNotFound"
helpers:NavHelper.NavigateTo="views:CmdNotFoundPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CommandNotFound.png}" />
<NavigationViewItem
x:Uid="Shell_CropAndLock"
helpers:NavHelper.NavigateTo="views:CropAndLockPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CropAndLock.png}" />
<NavigationViewItem
x:Uid="Shell_EnvironmentVariables"
helpers:NavHelper.NavigateTo="views:EnvironmentVariablesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/EnvironmentVariables.png}" />
<NavigationViewItem
x:Uid="Shell_FancyZones"
helpers:NavHelper.NavigateTo="views:FancyZonesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FancyZones.png}" />
<NavigationViewItem
x:Uid="Shell_PowerPreview"
helpers:NavHelper.NavigateTo="views:PowerPreviewPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileExplorerPreview.png}" />
<NavigationViewItem
x:Uid="Shell_FileLocksmith"
helpers:NavHelper.NavigateTo="views:FileLocksmithPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileLocksmith.png}" />
<NavigationViewItem
x:Uid="Shell_Hosts"
helpers:NavHelper.NavigateTo="views:HostsPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Hosts.png}" />
<NavigationViewItem
x:Uid="Shell_ImageResizer"
helpers:NavHelper.NavigateTo="views:ImageResizerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ImageResizer.png}" />
<NavigationViewItem
x:Uid="Shell_KeyboardManager"
helpers:NavHelper.NavigateTo="views:KeyboardManagerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/KeyboardManager.png}" />
<NavigationViewItem
x:Uid="Shell_MouseUtilities"
helpers:NavHelper.NavigateTo="views:MouseUtilsPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseUtils.png}" />
<NavigationViewItem
x:Uid="Shell_MouseWithoutBorders"
helpers:NavHelper.NavigateTo="views:MouseWithoutBordersPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseWithoutBorders.png}" />
<NavigationViewItem
x:Uid="NewPlus_Product_Name"
helpers:NavHelper.NavigateTo="views:NewPlusPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/NewPlus.png}" />
<NavigationViewItem
x:Uid="Shell_Peek"
helpers:NavHelper.NavigateTo="views:PeekPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Peek.png}" />
<NavigationViewItem
x:Uid="Shell_PowerRename"
helpers:NavHelper.NavigateTo="views:PowerRenamePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerRename.png}" />
<NavigationViewItem
x:Uid="Shell_PowerLauncher"
helpers:NavHelper.NavigateTo="views:PowerLauncherPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerToysRun.png}" />
<NavigationViewItem
x:Uid="Shell_QuickAccent"
helpers:NavHelper.NavigateTo="views:PowerAccentPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/QuickAccent.png}" />
<NavigationViewItem
x:Uid="Shell_RegistryPreview"
helpers:NavHelper.NavigateTo="views:RegistryPreviewPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/RegistryPreview.png}" />
<NavigationViewItem
x:Uid="Shell_MeasureTool"
helpers:NavHelper.NavigateTo="views:MeasureToolPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ScreenRuler.png}" />
<NavigationViewItem
x:Uid="Shell_ShortcutGuide"
helpers:NavHelper.NavigateTo="views:ShortcutGuidePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ShortcutGuide.png}" />
<NavigationViewItem
x:Uid="Shell_TextExtractor"
helpers:NavHelper.NavigateTo="views:PowerOcrPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/TextExtractor.png}" />
<NavigationViewItem
x:Uid="Shell_VideoConference"
helpers:NavHelper.NavigateTo="views:VideoConferencePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/VideoConferenceMute.png}"
IsEnabled="{x:Bind ViewModel.IsVideoConferenceBuild, Mode=OneWay}" />
<NavigationViewItem
x:Uid="Shell_Workspaces"
helpers:NavHelper.NavigateTo="views:WorkspacesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Workspaces.png}" />
x:Uid="Shell_TopLevelAdvanced"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Advanced.png}"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_CmdNotFound"
helpers:NavHelper.NavigateTo="views:CmdNotFoundPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CommandNotFound.png}" />
<NavigationViewItem
x:Uid="Shell_EnvironmentVariables"
helpers:NavHelper.NavigateTo="views:EnvironmentVariablesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/EnvironmentVariables.png}" />
<NavigationViewItem
x:Uid="Shell_Hosts"
helpers:NavHelper.NavigateTo="views:HostsPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Hosts.png}" />
<NavigationViewItem
x:Uid="Shell_RegistryPreview"
helpers:NavHelper.NavigateTo="views:RegistryPreviewPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/RegistryPreview.png}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>
</NavigationView.MenuItems>
<NavigationView.PaneFooter>
<StackPanel Orientation="Vertical">

View File

@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Services;
@@ -122,6 +122,8 @@ namespace Microsoft.PowerToys.Settings.UI.Views
public static bool IsUserAnAdmin { get; set; }
private Dictionary<Type, NavigationViewItem> _navViewParentLookup = new Dictionary<Type, NavigationViewItem>();
/// <summary>
/// Initializes a new instance of the <see cref="ShellPage"/> class.
/// Shell page constructor.
@@ -138,6 +140,21 @@ namespace Microsoft.PowerToys.Settings.UI.Views
// shellFrame.Navigate(typeof(GeneralPage));
IPCResponseHandleList.Add(ReceiveMessage);
SetTitleBar();
if (_navViewParentLookup.Count > 0)
{
_navViewParentLookup.Clear();
}
var topLevelItems = navigationView.MenuItems.OfType<NavigationViewItem>().ToArray();
foreach (var parent in topLevelItems)
{
foreach (var child in parent.MenuItems.OfType<NavigationViewItem>())
{
_navViewParentLookup.TryAdd(child.GetValue(NavHelper.NavigateToProperty) as Type, parent);
}
}
}
public static int SendDefaultIPCMessage(string msg)
@@ -277,7 +294,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private bool navigationViewInitialStateProcessed; // avoid announcing initial state of the navigation pane.
private void NavigationView_PaneOpened(Microsoft.UI.Xaml.Controls.NavigationView sender, object args)
private void NavigationView_PaneOpened(NavigationView sender, object args)
{
if (!navigationViewInitialStateProcessed)
{
@@ -293,7 +310,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
if (AutomationPeer.ListenerExists(AutomationEvents.MenuOpened))
{
var loader = Helpers.ResourceLoaderInstance.ResourceLoader;
var loader = ResourceLoaderInstance.ResourceLoader;
peer.RaiseNotificationEvent(
AutomationNotificationKind.ActionCompleted,
AutomationNotificationProcessing.ImportantMostRecent,
@@ -302,7 +319,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
}
}
private void NavigationView_PaneClosed(Microsoft.UI.Xaml.Controls.NavigationView sender, object args)
private void NavigationView_PaneClosed(NavigationView sender, object args)
{
if (!navigationViewInitialStateProcessed)
{
@@ -318,7 +335,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
if (AutomationPeer.ListenerExists(AutomationEvents.MenuClosed))
{
var loader = Helpers.ResourceLoaderInstance.ResourceLoader;
var loader = ResourceLoaderInstance.ResourceLoader;
peer.RaiseNotificationEvent(
AutomationNotificationKind.ActionCompleted,
AutomationNotificationProcessing.ImportantMostRecent,
@@ -348,6 +365,12 @@ namespace Microsoft.PowerToys.Settings.UI.Views
if (selectedItem != null)
{
Type pageType = selectedItem.GetValue(NavHelper.NavigateToProperty) as Type;
if (_navViewParentLookup.TryGetValue(pageType, out var parentItem) && !parentItem.IsExpanded)
{
parentItem.IsExpanded = true;
}
NavigationService.Navigate(pageType);
}
}

View File

@@ -59,10 +59,7 @@
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root"
xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
@@ -4563,4 +4560,19 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="GeneralPage_ViewDiagnosticDataViewerInfoButton.Content" xml:space="preserve">
<value>Restart</value>
</data>
</root>
<data name="Shell_TopLevelAdvanced.Content" xml:space="preserve">
<value>Advanced</value>
</data>
<data name="Shell_TopLevelFileManagement.Content" xml:space="preserve">
<value>File Management</value>
</data>
<data name="Shell_TopLevelInputOutput.Content" xml:space="preserve">
<value>Input / Output</value>
</data>
<data name="Shell_TopLevelWindowsAndLayouts.Content" xml:space="preserve">
<value>Windowing &amp; Layouts</value>
</data>
<data name="Shell_TopLevelSystemTools.Content" xml:space="preserve">
<value>System Tools</value>
</data>
</root>

View File

@@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Abstractions;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
@@ -32,6 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private NavigationViewItem selected;
private ICommand loadedCommand;
private ICommand itemInvokedCommand;
private NavigationViewItem[] _fullListOfNavViewItems;
public bool IsBackEnabled
{
@@ -76,6 +76,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
NavigationService.NavigationFailed += Frame_NavigationFailed;
NavigationService.Navigated += Frame_Navigated;
this.navigationView.BackRequested += OnBackRequested;
var topLevelItems = navigationView.MenuItems.OfType<NavigationViewItem>();
_fullListOfNavViewItems = topLevelItems.Union(topLevelItems.SelectMany(menuItem => menuItem.MenuItems.OfType<NavigationViewItem>())).ToArray();
}
private static KeyboardAccelerator BuildKeyboardAccelerator(VirtualKey key, VirtualKeyModifiers? modifiers = null)
@@ -107,11 +109,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private void OnItemInvoked(NavigationViewItemInvokedEventArgs args)
{
var item = navigationView.MenuItems
.OfType<NavigationViewItem>()
.First(menuItem => (string)menuItem.Content == (string)args.InvokedItem);
var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type;
NavigationService.Navigate(pageType);
var pageType = args.InvokedItemContainer.GetValue(NavHelper.NavigateToProperty) as Type;
if (pageType != null)
{
NavigationService.Navigate(pageType);
}
}
private void OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
@@ -127,9 +130,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private void Frame_Navigated(object sender, NavigationEventArgs e)
{
IsBackEnabled = NavigationService.CanGoBack;
Selected = navigationView.MenuItems
.OfType<NavigationViewItem>()
.FirstOrDefault(menuItem => IsMenuItemForPageType(menuItem, e.SourcePageType));
Selected = _fullListOfNavViewItems.FirstOrDefault(menuItem => IsMenuItemForPageType(menuItem, e.SourcePageType));
}
private static bool IsMenuItemForPageType(NavigationViewItem menuItem, Type sourcePageType)