all settings and mouse utils

This commit is contained in:
kaitao-ms
2025-12-01 23:37:07 +08:00
parent 0fc3fbc40e
commit f91617f7f0
45 changed files with 1537 additions and 8 deletions

View File

@@ -83,6 +83,11 @@ namespace CommonSharedConstants
const wchar_t TERMINATE_MOUSE_JUMP_SHARED_EVENT[] = L"Local\\TerminateMouseJumpEvent-252fa337-317f-4c37-a61f-99464c3f9728"; const wchar_t TERMINATE_MOUSE_JUMP_SHARED_EVENT[] = L"Local\\TerminateMouseJumpEvent-252fa337-317f-4c37-a61f-99464c3f9728";
// Paths to the events used by other Mouse Utilities
const wchar_t FIND_MY_MOUSE_TRIGGER_EVENT[] = L"Local\\FindMyMouseTriggerEvent-5a9dc5f4-1c74-4f2f-a66f-1b9b6a2f9b23";
const wchar_t MOUSE_HIGHLIGHTER_TRIGGER_EVENT[] = L"Local\\MouseHighlighterTriggerEvent-1e3c9c3d-3fdf-4f9a-9a52-31c9b3c3a8f4";
const wchar_t MOUSE_CROSSHAIRS_TRIGGER_EVENT[] = L"Local\\MouseCrosshairsTriggerEvent-0d4c7f92-0a5c-4f5c-b64b-8a2a2f7e0b21";
// Path to the event used by RegistryPreview // Path to the event used by RegistryPreview
const wchar_t REGISTRY_PREVIEW_TRIGGER_EVENT[] = L"Local\\RegistryPreviewEvent-4C559468-F75A-4E7F-BC4F-9C9688316687"; const wchar_t REGISTRY_PREVIEW_TRIGGER_EVENT[] = L"Local\\RegistryPreviewEvent-4C559468-F75A-4E7F-BC4F-9C9688316687";

View File

@@ -3,6 +3,8 @@
#include <windows.h> #include <windows.h>
#include <shlwapi.h> #include <shlwapi.h>
#pragma comment(lib, "Shlwapi.lib")
#include <string> #include <string>
#include <thread> #include <thread>

View File

@@ -8,6 +8,8 @@
#include <common/utils/logger_helper.h> #include <common/utils/logger_helper.h>
#include <common/utils/color.h> #include <common/utils/color.h>
#include <common/utils/string_utils.h> #include <common/utils/string_utils.h>
#include <common/interop/shared_constants.h>
#include <atomic>
namespace namespace
{ {
@@ -69,6 +71,12 @@ private:
// Find My Mouse specific settings // Find My Mouse specific settings
FindMyMouseSettings m_findMyMouseSettings; FindMyMouseSettings m_findMyMouseSettings;
// Event-driven trigger support
HANDLE m_triggerEventHandle = nullptr;
HANDLE m_terminateEventHandle = nullptr;
std::thread m_eventThread;
std::atomic_bool m_listening{ false };
// Load initial settings from the persisted values. // Load initial settings from the persisted values.
void init_settings(); void init_settings();
@@ -150,6 +158,34 @@ public:
m_enabled = true; m_enabled = true;
Trace::EnableFindMyMouse(true); Trace::EnableFindMyMouse(true);
std::thread([=]() { FindMyMouseMain(m_hModule, m_findMyMouseSettings); }).detach(); std::thread([=]() { FindMyMouseMain(m_hModule, m_findMyMouseSettings); }).detach();
// Start listening for external trigger event so we can invoke the same logic as the hotkey.
m_triggerEventHandle = CreateEventW(nullptr, false, false, CommonSharedConstants::FIND_MY_MOUSE_TRIGGER_EVENT);
m_terminateEventHandle = CreateEventW(nullptr, false, false, nullptr);
if (m_triggerEventHandle && m_terminateEventHandle)
{
m_listening = true;
m_eventThread = std::thread([this]() {
HANDLE handles[2] = { m_triggerEventHandle, m_terminateEventHandle };
while (m_listening)
{
auto res = WaitForMultipleObjects(2, handles, false, INFINITE);
if (!m_listening)
{
break;
}
if (res == WAIT_OBJECT_0)
{
OnHotkeyEx();
}
else
{
break;
}
}
});
}
} }
// Disable the powertoy // Disable the powertoy
@@ -158,6 +194,26 @@ public:
m_enabled = false; m_enabled = false;
Trace::EnableFindMyMouse(false); Trace::EnableFindMyMouse(false);
FindMyMouseDisable(); FindMyMouseDisable();
m_listening = false;
if (m_terminateEventHandle)
{
SetEvent(m_terminateEventHandle);
}
if (m_eventThread.joinable())
{
m_eventThread.join();
}
if (m_triggerEventHandle)
{
CloseHandle(m_triggerEventHandle);
m_triggerEventHandle = nullptr;
}
if (m_terminateEventHandle)
{
CloseHandle(m_terminateEventHandle);
m_terminateEventHandle = nullptr;
}
} }
// Returns if the powertoys is enabled // Returns if the powertoys is enabled
@@ -216,7 +272,7 @@ inline static uint8_t LegacyOpacityToAlpha(int overlayOpacityPercent)
overlayOpacityPercent = 100; overlayOpacityPercent = 100;
} }
// Round to nearest integer (0<EFBFBD>255) // Round to nearest integer (0255)
return static_cast<uint8_t>((overlayOpacityPercent * 255 + 50) / 100); return static_cast<uint8_t>((overlayOpacityPercent * 255 + 50) / 100);
} }

View File

@@ -4,6 +4,8 @@
#include "trace.h" #include "trace.h"
#include "MouseHighlighter.h" #include "MouseHighlighter.h"
#include "common/utils/color.h" #include "common/utils/color.h"
#include <common/interop/shared_constants.h>
#include <atomic>
namespace namespace
{ {
@@ -61,6 +63,12 @@ private:
// Mouse Highlighter specific settings // Mouse Highlighter specific settings
MouseHighlighterSettings m_highlightSettings; MouseHighlighterSettings m_highlightSettings;
// Event-driven trigger support
HANDLE m_triggerEventHandle = nullptr;
HANDLE m_terminateEventHandle = nullptr;
std::thread m_eventThread;
std::atomic_bool m_listening{ false };
public: public:
// Constructor // Constructor
MouseHighlighter() MouseHighlighter()
@@ -132,6 +140,34 @@ public:
m_enabled = true; m_enabled = true;
Trace::EnableMouseHighlighter(true); Trace::EnableMouseHighlighter(true);
std::thread([=]() { MouseHighlighterMain(m_hModule, m_highlightSettings); }).detach(); std::thread([=]() { MouseHighlighterMain(m_hModule, m_highlightSettings); }).detach();
// Start listening for external trigger event so we can invoke the same logic as the hotkey.
m_triggerEventHandle = CreateEventW(nullptr, false, false, CommonSharedConstants::MOUSE_HIGHLIGHTER_TRIGGER_EVENT);
m_terminateEventHandle = CreateEventW(nullptr, false, false, nullptr);
if (m_triggerEventHandle && m_terminateEventHandle)
{
m_listening = true;
m_eventThread = std::thread([this]() {
HANDLE handles[2] = { m_triggerEventHandle, m_terminateEventHandle };
while (m_listening)
{
auto res = WaitForMultipleObjects(2, handles, false, INFINITE);
if (!m_listening)
{
break;
}
if (res == WAIT_OBJECT_0)
{
OnHotkeyEx();
}
else
{
break;
}
}
});
}
} }
// Disable the powertoy // Disable the powertoy
@@ -140,6 +176,26 @@ public:
m_enabled = false; m_enabled = false;
Trace::EnableMouseHighlighter(false); Trace::EnableMouseHighlighter(false);
MouseHighlighterDisable(); MouseHighlighterDisable();
m_listening = false;
if (m_terminateEventHandle)
{
SetEvent(m_terminateEventHandle);
}
if (m_eventThread.joinable())
{
m_eventThread.join();
}
if (m_triggerEventHandle)
{
CloseHandle(m_triggerEventHandle);
m_triggerEventHandle = nullptr;
}
if (m_terminateEventHandle)
{
CloseHandle(m_terminateEventHandle);
m_terminateEventHandle = nullptr;
}
} }
// Returns if the powertoys is enabled // Returns if the powertoys is enabled

View File

@@ -4,6 +4,7 @@
#include "trace.h" #include "trace.h"
#include "InclusiveCrosshairs.h" #include "InclusiveCrosshairs.h"
#include "common/utils/color.h" #include "common/utils/color.h"
#include <common/interop/shared_constants.h>
#include <atomic> #include <atomic>
#include <thread> #include <thread>
#include <chrono> #include <chrono>
@@ -124,6 +125,12 @@ private:
// Mouse Pointer Crosshairs specific settings // Mouse Pointer Crosshairs specific settings
InclusiveCrosshairsSettings m_inclusiveCrosshairsSettings; InclusiveCrosshairsSettings m_inclusiveCrosshairsSettings;
// Event-driven trigger support
HANDLE m_triggerEventHandle = nullptr;
HANDLE m_terminateEventHandle = nullptr;
std::thread m_eventThread;
std::atomic_bool m_listening{ false };
public: public:
// Constructor // Constructor
MousePointerCrosshairs() MousePointerCrosshairs()
@@ -203,6 +210,34 @@ public:
m_enabled = true; m_enabled = true;
Trace::EnableMousePointerCrosshairs(true); Trace::EnableMousePointerCrosshairs(true);
std::thread([=]() { InclusiveCrosshairsMain(m_hModule, m_inclusiveCrosshairsSettings); }).detach(); std::thread([=]() { InclusiveCrosshairsMain(m_hModule, m_inclusiveCrosshairsSettings); }).detach();
// Start listening for external trigger event so we can invoke the same logic as the activation hotkey.
m_triggerEventHandle = CreateEventW(nullptr, false, false, CommonSharedConstants::MOUSE_CROSSHAIRS_TRIGGER_EVENT);
m_terminateEventHandle = CreateEventW(nullptr, false, false, nullptr);
if (m_triggerEventHandle && m_terminateEventHandle)
{
m_listening = true;
m_eventThread = std::thread([this]() {
HANDLE handles[2] = { m_triggerEventHandle, m_terminateEventHandle };
while (m_listening)
{
auto res = WaitForMultipleObjects(2, handles, false, INFINITE);
if (!m_listening)
{
break;
}
if (res == WAIT_OBJECT_0)
{
on_hotkey(0); // activation hotkey
}
else
{
break;
}
}
});
}
} }
// Disable the powertoy // Disable the powertoy
@@ -215,6 +250,26 @@ public:
StopYTimer(); StopYTimer();
m_glideState = 0; m_glideState = 0;
InclusiveCrosshairsDisable(); InclusiveCrosshairsDisable();
m_listening = false;
if (m_terminateEventHandle)
{
SetEvent(m_terminateEventHandle);
}
if (m_eventThread.joinable())
{
m_eventThread.join();
}
if (m_triggerEventHandle)
{
CloseHandle(m_triggerEventHandle);
m_triggerEventHandle = nullptr;
}
if (m_terminateEventHandle)
{
CloseHandle(m_terminateEventHandle);
m_terminateEventHandle = nullptr;
}
} }
// Returns if the powertoys is enabled // Returns if the powertoys is enabled

View File

@@ -241,6 +241,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="GifRecordingSession.cpp" /> <ClCompile Include="GifRecordingSession.cpp" />
<ClCompile Include="ZoomItIpc.cpp" />
<ClCompile Include="pch.cpp" /> <ClCompile Include="pch.cpp" />
<ClCompile Include="SelectRectangle.cpp"> <ClCompile Include="SelectRectangle.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
@@ -296,6 +297,8 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\Eula\Eula.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\common\sysinternals\Eula\Eula.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\ZoomItModuleInterface\Trace.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)..\ZoomItModuleInterface\Trace.h" />
<ClInclude Include="GifRecordingSession.h" /> <ClInclude Include="GifRecordingSession.h" />
<ClInclude Include="ZoomItIpc.h" />
<ClInclude Include="zoomit_mode.h" />
<ClInclude Include="pch.h" /> <ClInclude Include="pch.h" />
<ClInclude Include="Registry.h" /> <ClInclude Include="Registry.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />

View File

@@ -0,0 +1,160 @@
#include "pch.h"
#include "ZoomItIpc.h"
#include <format>
#include <thread>
#include <atomic>
#include <cctype>
using namespace std::literals;
namespace ZoomItIpc
{
namespace
{
Command FromString(const std::string& action)
{
if (action == "zoom")
return Command::Zoom;
if (action == "draw")
return Command::Draw;
if (action == "break")
return Command::Break;
if (action == "livezoom")
return Command::LiveZoom;
if (action == "snip")
return Command::Snip;
if (action == "record")
return Command::Record;
return Command::Unknown;
}
Command ParseJson(const std::string& json)
{
// Very small parse: look for "action":"<value>"
auto pos = json.find("\"action\"");
if (pos == std::string::npos)
return Command::Unknown;
pos = json.find(':', pos);
if (pos == std::string::npos)
return Command::Unknown;
pos = json.find('"', pos);
if (pos == std::string::npos)
return Command::Unknown;
auto end = json.find('"', pos + 1);
if (end == std::string::npos || end <= pos + 1)
return Command::Unknown;
auto value = json.substr(pos + 1, end - pos - 1);
// normalize to lowercase
std::transform(value.begin(), value.end(), value.begin(), [](unsigned char c) { return static_cast<char>(std::tolower(static_cast<int>(c))); });
return FromString(value);
}
bool ReadPayload(HANDLE pipe, std::string& outPayload)
{
DWORD bytesRead = 0;
char buffer[512] = {};
if (!ReadFile(pipe, buffer, static_cast<DWORD>(sizeof(buffer) - 1), &bytesRead, nullptr) || bytesRead == 0)
{
return false;
}
buffer[bytesRead] = '\0';
outPayload.assign(buffer, bytesRead);
return true;
}
} // namespace
Command ParseCommand(const std::string& payloadUtf8)
{
return ParseJson(payloadUtf8);
}
// ZoomIt.exe will call this; needs to hook into action dispatcher externally.
bool RunServer()
{
std::thread([]() {
for (;;)
{
auto hPipe = CreateNamedPipeW(
PIPE_NAME,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
1,
1024,
1024,
0,
nullptr);
if (hPipe == INVALID_HANDLE_VALUE)
{
break;
}
if (!ConnectNamedPipe(hPipe, nullptr))
{
CloseHandle(hPipe);
continue;
}
std::string payload;
if (ReadPayload(hPipe, payload))
{
auto cmd = ParseCommand(payload);
// Dispatch hook implemented elsewhere in ZoomIt.exe
extern void ZoomIt_DispatchCommand(Command cmd);
ZoomIt_DispatchCommand(cmd);
}
DisconnectNamedPipe(hPipe);
CloseHandle(hPipe);
}
}).detach();
return true;
}
bool SendCommand(Command cmd)
{
auto hPipe = CreateFileW(PIPE_NAME, GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if (hPipe == INVALID_HANDLE_VALUE)
{
return false;
}
const char* action = "unknown";
switch (cmd)
{
case Command::Zoom:
action = "zoom";
break;
case Command::Draw:
action = "draw";
break;
case Command::Break:
action = "break";
break;
case Command::LiveZoom:
action = "livezoom";
break;
case Command::Snip:
action = "snip";
break;
case Command::Record:
action = "record";
break;
default:
break;
}
auto payload = std::format("{{\"action\":\"{}\"}}", action);
DWORD written = 0;
const bool ok = WriteFile(hPipe, payload.data(), static_cast<DWORD>(payload.size()), &written, nullptr);
CloseHandle(hPipe);
return ok && written == payload.size();
}
} // namespace ZoomItIpc

View File

@@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma once
#include <string>
namespace ZoomItIpc
{
inline constexpr wchar_t PIPE_NAME[] = L"\\\\.\\pipe\\powertoys_zoomit_cmd";
enum class Command
{
Unknown = 0,
Zoom,
Draw,
Break,
LiveZoom,
Snip,
Record,
};
// Simple UTF-8 JSON payload: { "action": "<name>" }
Command ParseCommand(const std::string& payloadUtf8);
bool RunServer();
bool SendCommand(Command cmd);
} // namespace ZoomItIpc

View File

@@ -16,6 +16,9 @@
#include "WindowsVersions.h" #include "WindowsVersions.h"
#include "ZoomItSettings.h" #include "ZoomItSettings.h"
#include "GifRecordingSession.h" #include "GifRecordingSession.h"
#include "ZoomItIpc.h"
#include "zoomit_mode.h"
#include "zoomit_mode.h"
#ifdef __ZOOMIT_POWERTOYS__ #ifdef __ZOOMIT_POWERTOYS__
#include <common/interop/shared_constants.h> #include <common/interop/shared_constants.h>
@@ -172,7 +175,6 @@ std::wstring g_RecordingSaveLocationGIF;
winrt::IDirect3DDevice g_RecordDevice{ nullptr }; winrt::IDirect3DDevice g_RecordDevice{ nullptr };
std::shared_ptr<VideoRecordingSession> g_RecordingSession = nullptr; std::shared_ptr<VideoRecordingSession> g_RecordingSession = nullptr;
std::shared_ptr<GifRecordingSession> g_GifRecordingSession = nullptr; std::shared_ptr<GifRecordingSession> g_GifRecordingSession = nullptr;
type_pGetMonitorInfo pGetMonitorInfo; type_pGetMonitorInfo pGetMonitorInfo;
type_MonitorFromPoint pMonitorFromPoint; type_MonitorFromPoint pMonitorFromPoint;
type_pSHAutoComplete pSHAutoComplete; type_pSHAutoComplete pSHAutoComplete;
@@ -7712,6 +7714,50 @@ HWND InitInstance( HINSTANCE hInstance, int nCmdShow )
} }
// Dispatch commands coming from the PowerToys IPC channel.
#ifdef __ZOOMIT_POWERTOYS__
void ZoomIt_DispatchCommand(ZoomItIpc::Command cmd)
{
auto post_hotkey = [](WPARAM id)
{
if (g_hWndMain != nullptr)
{
PostMessage(g_hWndMain, WM_HOTKEY, id, 0);
}
};
switch (cmd)
{
case ZoomItIpc::Command::Zoom:
post_hotkey(ZOOM_HOTKEY);
Trace::ZoomItActivateZoom();
break;
case ZoomItIpc::Command::Draw:
post_hotkey(DRAW_HOTKEY);
Trace::ZoomItActivateDraw();
break;
case ZoomItIpc::Command::Break:
post_hotkey(BREAK_HOTKEY);
Trace::ZoomItActivateBreak();
break;
case ZoomItIpc::Command::LiveZoom:
post_hotkey(LIVE_HOTKEY);
Trace::ZoomItActivateLiveZoom();
break;
case ZoomItIpc::Command::Snip:
post_hotkey(SNIP_HOTKEY);
Trace::ZoomItActivateSnip();
break;
case ZoomItIpc::Command::Record:
post_hotkey(RECORD_HOTKEY);
Trace::ZoomItActivateRecord();
break;
default:
break;
}
}
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// //
// WinMain // WinMain
@@ -7746,6 +7792,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
// Initialize logger // Initialize logger
LoggerHelpers::init_logger(L"ZoomIt", L"", LogSettings::zoomItLoggerName); LoggerHelpers::init_logger(L"ZoomIt", L"", LogSettings::zoomItLoggerName);
ZoomItIpc::RunServer();
ProcessWaiter::OnProcessTerminate(pid, [mainThreadId](int err) { ProcessWaiter::OnProcessTerminate(pid, [mainThreadId](int err) {
if (err != ERROR_SUCCESS) if (err != ERROR_SUCCESS)
@@ -7986,3 +8033,4 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
return retCode; return retCode;
} }
#include "zoomit_mode.h"

View File

@@ -0,0 +1,7 @@
// ZoomIt mode ids (map to WM_HOTKEY wParam values)
#define ZOOM_MODE_ID_ZOOM 0
#define ZOOM_MODE_ID_DRAW 1
#define ZOOM_MODE_ID_BREAK 2
#define ZOOM_MODE_ID_LIVEZOOM 3
#define ZOOM_MODE_ID_RECORD 5
#define ZOOM_MODE_ID_SNIP 8

View File

@@ -8,6 +8,7 @@
#include <common/utils/logger_helper.h> #include <common/utils/logger_helper.h>
#include <common/utils/resources.h> #include <common/utils/resources.h>
#include <common/utils/winapi_error.h> #include <common/utils/winapi_error.h>
#include <common/interop/shared_constants.h>
#include <shellapi.h> #include <shellapi.h>
#include <common/interop/shared_constants.h> #include <common/interop/shared_constants.h>

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Triggers Crop and Lock reparent mode via the shared event.
/// </summary>
internal sealed partial class CropAndLockReparentCommand : InvokableCommand
{
public CropAndLockReparentCommand()
{
Name = "Crop and Lock (Reparent)";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.CropAndLockReparent);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to start Crop and Lock (Reparent): {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Triggers Crop and Lock thumbnail mode via the shared event.
/// </summary>
internal sealed partial class CropAndLockThumbnailCommand : InvokableCommand
{
public CropAndLockThumbnailCommand()
{
Name = "Crop and Lock (Thumbnail)";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.CropAndLockThumbnail);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to start Crop and Lock (Thumbnail): {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Launches Environment Variables (admin) via the shared event.
/// </summary>
internal sealed partial class OpenEnvironmentVariablesAdminCommand : InvokableCommand
{
public OpenEnvironmentVariablesAdminCommand()
{
Name = "Open Environment Variables (Admin)";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.EnvironmentVariablesShowAdmin);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to open Environment Variables (Admin): {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Launches Environment Variables (user) via the shared event.
/// </summary>
internal sealed partial class OpenEnvironmentVariablesCommand : InvokableCommand
{
public OpenEnvironmentVariablesCommand()
{
Name = "Open Environment Variables";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.EnvironmentVariablesShow);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to open Environment Variables: {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Launches the FancyZones layout editor via the shared event.
/// </summary>
internal sealed partial class OpenFancyZonesEditorCommand : InvokableCommand
{
public OpenFancyZonesEditorCommand()
{
Name = "Open FancyZones Editor";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.FancyZonesToggleEditor);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to open FancyZones editor: {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Launches Hosts File Editor (Admin) via the shared event.
/// </summary>
internal sealed partial class OpenHostsEditorAdminCommand : InvokableCommand
{
public OpenHostsEditorAdminCommand()
{
Name = "Open Hosts File Editor (Admin)";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.HostsShowAdmin);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to open Hosts File Editor (Admin): {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Launches Hosts File Editor via the shared event.
/// </summary>
internal sealed partial class OpenHostsEditorCommand : InvokableCommand
{
public OpenHostsEditorCommand()
{
Name = "Open Hosts File Editor";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.HostsShow);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to open Hosts File Editor: {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Shows Mouse Jump preview via the shared event.
/// </summary>
internal sealed partial class ShowMouseJumpPreviewCommand : InvokableCommand
{
public ShowMouseJumpPreviewCommand()
{
Name = "Show Mouse Jump Preview";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.MouseJumpShowPreview);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to show Mouse Jump preview: {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Triggers Find My Mouse via the shared event.
/// </summary>
internal sealed partial class ToggleFindMyMouseCommand : InvokableCommand
{
public ToggleFindMyMouseCommand()
{
Name = "Trigger Find My Mouse";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.FindMyMouseTrigger);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to trigger Find My Mouse: {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Toggles Mouse Pointer Crosshairs via the shared event.
/// </summary>
internal sealed partial class ToggleMouseCrosshairsCommand : InvokableCommand
{
public ToggleMouseCrosshairsCommand()
{
Name = "Toggle Mouse Crosshairs";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.MouseCrosshairsTrigger);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to toggle Mouse Crosshairs: {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Toggles Mouse Highlighter via the shared event.
/// </summary>
internal sealed partial class ToggleMouseHighlighterCommand : InvokableCommand
{
public ToggleMouseHighlighterCommand()
{
Name = "Toggle Mouse Highlighter";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.MouseHighlighterTrigger);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to toggle Mouse Highlighter: {ex.Message}");
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Helpers;
namespace PowerToysExtension.Commands;
/// <summary>
/// Launches Registry Preview via the shared event.
/// </summary>
internal sealed partial class OpenRegistryPreviewCommand : InvokableCommand
{
public OpenRegistryPreviewCommand()
{
Name = "Open Registry Preview";
}
public override CommandResult Invoke()
{
try
{
using var evt = new EventWaitHandle(false, EventResetMode.AutoReset, PowerToysEventNames.RegistryPreviewTrigger);
evt.Set();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to open Registry Preview: {ex.Message}");
}
}
}

View File

@@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO.Pipes;
using System.Text;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace PowerToysExtension.Commands;
internal sealed partial class ZoomItActionCommand : InvokableCommand
{
private readonly string _action;
private readonly string _title;
private const string PipeName = "powertoys_zoomit_cmd";
public ZoomItActionCommand(string action, string title)
{
_action = action;
_title = title;
Name = title;
}
public override CommandResult Invoke()
{
try
{
var payload = $"{{\"action\":\"{_action}\"}}";
using var client = new NamedPipeClientStream(
".",
PipeName,
PipeDirection.Out,
PipeOptions.Asynchronous);
client.Connect(200);
var bytes = Encoding.UTF8.GetBytes(payload);
client.Write(bytes, 0, bytes.Length);
client.Flush();
return CommandResult.Dismiss();
}
catch (Exception ex)
{
return CommandResult.ShowToast($"Failed to invoke ZoomIt ({_title}): {ex.Message}");
}
}
}

View File

@@ -27,7 +27,25 @@ internal static class ModuleCommandCatalog
new ScreenRulerModuleCommandProvider(), new ScreenRulerModuleCommandProvider(),
new ShortcutGuideModuleCommandProvider(), new ShortcutGuideModuleCommandProvider(),
new TextExtractorModuleCommandProvider(), new TextExtractorModuleCommandProvider(),
new ZoomItModuleCommandProvider(),
new ColorPickerModuleCommandProvider(), new ColorPickerModuleCommandProvider(),
new AlwaysOnTopModuleCommandProvider(),
new CropAndLockModuleCommandProvider(),
new FancyZonesModuleCommandProvider(),
new KeyboardManagerModuleCommandProvider(),
new MouseUtilsModuleCommandProvider(),
new MouseWithoutBordersModuleCommandProvider(),
new QuickAccentModuleCommandProvider(),
new FileExplorerAddonsModuleCommandProvider(),
new FileLocksmithModuleCommandProvider(),
new ImageResizerModuleCommandProvider(),
new NewPlusModuleCommandProvider(),
new PeekModuleCommandProvider(),
new PowerRenameModuleCommandProvider(),
new CommandNotFoundModuleCommandProvider(),
new EnvironmentVariablesModuleCommandProvider(),
new HostsModuleCommandProvider(),
new RegistryPreviewModuleCommandProvider(),
]; ];
public static IListItem[] FilteredItems(string query) public static IListItem[] FilteredItems(string query)

View File

@@ -30,4 +30,8 @@ internal static class PowerToysEventNames
internal const string WorkspacesHotkey = "Local\\PowerToys-Workspaces-HotkeyEvent-2625C3C8-BAC9-4DB3-BCD6-3B4391A26FD0"; internal const string WorkspacesHotkey = "Local\\PowerToys-Workspaces-HotkeyEvent-2625C3C8-BAC9-4DB3-BCD6-3B4391A26FD0";
internal const string CropAndLockThumbnail = "Local\\PowerToysCropAndLockThumbnailEvent-1637be50-da72-46b2-9220-b32b206b2434"; internal const string CropAndLockThumbnail = "Local\\PowerToysCropAndLockThumbnailEvent-1637be50-da72-46b2-9220-b32b206b2434";
internal const string CropAndLockReparent = "Local\\PowerToysCropAndLockReparentEvent-6060860a-76a1-44e8-8d0e-6355785e9c36"; internal const string CropAndLockReparent = "Local\\PowerToysCropAndLockReparentEvent-6060860a-76a1-44e8-8d0e-6355785e9c36";
internal const string FindMyMouseTrigger = "Local\\FindMyMouseTriggerEvent-5a9dc5f4-1c74-4f2f-a66f-1b9b6a2f9b23";
internal const string MouseHighlighterTrigger = "Local\\MouseHighlighterTriggerEvent-1e3c9c3d-3fdf-4f9a-9a52-31c9b3c3a8f4";
internal const string MouseCrosshairsTrigger = "Local\\MouseCrosshairsTriggerEvent-0d4c7f92-0a5c-4f5c-b64b-8a2a2f7e0b21";
internal const string MouseJumpShowPreview = "Local\\MouseJumpEvent-aa0be051-3396-4976-b7ba-1a9cc7d236a5";
} }

View File

@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Collections.Generic; using System.Collections.Generic;
using Common.UI;
using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands; using PowerToysExtension.Commands;
using PowerToysExtension.Helpers; using PowerToysExtension.Helpers;
@@ -13,15 +14,21 @@ internal sealed class AdvancedPasteModuleCommandProvider : ModuleCommandProvider
{ {
public override IEnumerable<ListItem> BuildCommands() public override IEnumerable<ListItem> BuildCommands()
{ {
var icon = IconHelpers.FromRelativePath("Assets\\AdvancedPaste.png"); var title = SettingsDeepLink.SettingsWindow.AdvancedPaste.ModuleDisplayName();
var icon = SettingsDeepLink.SettingsWindow.AdvancedPaste.ModuleIcon();
var item = new ListItem(new OpenAdvancedPasteCommand()) yield return new ListItem(new OpenAdvancedPasteCommand())
{ {
Title = "Open Advanced Paste", Title = "Open Advanced Paste",
Subtitle = "Launch the Advanced Paste UI", Subtitle = "Launch the Advanced Paste UI",
Icon = icon, Icon = icon,
}; };
return [item]; yield return new ListItem(new OpenInSettingsCommand(SettingsDeepLink.SettingsWindow.AdvancedPaste, title))
{
Title = title,
Subtitle = "Open Advanced Paste settings",
Icon = icon,
};
} }
} }

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class AlwaysOnTopModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.AlwaysOnTop.ModuleDisplayName();
var icon = SettingsWindow.AlwaysOnTop.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.AlwaysOnTop, title))
{
Title = title,
Subtitle = "Open Always On Top settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class CommandNotFoundModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.CmdNotFound.ModuleDisplayName();
var icon = SettingsWindow.CmdNotFound.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.CmdNotFound, title))
{
Title = title,
Subtitle = "Open Command Not Found settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class CropAndLockModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.CropAndLock.ModuleDisplayName();
var icon = SettingsWindow.CropAndLock.ModuleIcon();
yield return new ListItem(new CropAndLockReparentCommand())
{
Title = "Crop and Lock (Reparent)",
Subtitle = "Create a cropped reparented window",
Icon = icon,
};
yield return new ListItem(new CropAndLockThumbnailCommand())
{
Title = "Crop and Lock (Thumbnail)",
Subtitle = "Create a cropped thumbnail window",
Icon = icon,
};
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.CropAndLock, title))
{
Title = title,
Subtitle = "Open Crop and Lock settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class EnvironmentVariablesModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.EnvironmentVariables.ModuleDisplayName();
var icon = SettingsWindow.EnvironmentVariables.ModuleIcon();
yield return new ListItem(new OpenEnvironmentVariablesCommand())
{
Title = "Open Environment Variables",
Subtitle = "Launch Environment Variables editor",
Icon = icon,
};
yield return new ListItem(new OpenEnvironmentVariablesAdminCommand())
{
Title = "Open Environment Variables (Admin)",
Subtitle = "Launch Environment Variables editor as admin",
Icon = icon,
};
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.EnvironmentVariables, title))
{
Title = title,
Subtitle = "Open Environment Variables settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class FancyZonesModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.FancyZones.ModuleDisplayName();
var icon = SettingsWindow.FancyZones.ModuleIcon();
yield return new ListItem(new OpenFancyZonesEditorCommand())
{
Title = "Open FancyZones Editor",
Subtitle = "Launch layout editor",
Icon = icon,
};
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.FancyZones, title))
{
Title = title,
Subtitle = "Open FancyZones settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class FileExplorerAddonsModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.FileExplorer.ModuleDisplayName();
var icon = SettingsWindow.FileExplorer.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.FileExplorer, title))
{
Title = title,
Subtitle = "Open File Explorer add-ons settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class FileLocksmithModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.FileLocksmith.ModuleDisplayName();
var icon = SettingsWindow.FileLocksmith.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.FileLocksmith, title))
{
Title = title,
Subtitle = "Open File Locksmith settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class HostsModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.Hosts.ModuleDisplayName();
var icon = SettingsWindow.Hosts.ModuleIcon();
yield return new ListItem(new OpenHostsEditorCommand())
{
Title = "Open Hosts File Editor",
Subtitle = "Launch Hosts File Editor",
Icon = icon,
};
yield return new ListItem(new OpenHostsEditorAdminCommand())
{
Title = "Open Hosts File Editor (Admin)",
Subtitle = "Launch Hosts File Editor as admin",
Icon = icon,
};
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.Hosts, title))
{
Title = title,
Subtitle = "Open Hosts File Editor settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class ImageResizerModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.ImageResizer.ModuleDisplayName();
var icon = SettingsWindow.ImageResizer.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.ImageResizer, title))
{
Title = title,
Subtitle = "Open Image Resizer settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class KeyboardManagerModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.KBM.ModuleDisplayName();
var icon = SettingsWindow.KBM.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.KBM, title))
{
Title = title,
Subtitle = "Open Keyboard Manager settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,55 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class MouseUtilsModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.MouseUtils.ModuleDisplayName();
var icon = SettingsWindow.MouseUtils.ModuleIcon();
yield return new ListItem(new ToggleFindMyMouseCommand())
{
Title = "Trigger Find My Mouse",
Subtitle = "Focus the mouse pointer",
Icon = icon,
};
yield return new ListItem(new ToggleMouseHighlighterCommand())
{
Title = "Toggle Mouse Highlighter",
Subtitle = "Highlight mouse clicks",
Icon = icon,
};
yield return new ListItem(new ToggleMouseCrosshairsCommand())
{
Title = "Toggle Mouse Crosshairs",
Subtitle = "Enable or disable pointer crosshairs",
Icon = icon,
};
yield return new ListItem(new ShowMouseJumpPreviewCommand())
{
Title = "Show Mouse Jump Preview",
Subtitle = "Jump the pointer to a target",
Icon = icon,
};
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.MouseUtils, title))
{
Title = title,
Subtitle = "Open Mouse Utilities settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class MouseWithoutBordersModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.MouseWithoutBorders.ModuleDisplayName();
var icon = SettingsWindow.MouseWithoutBorders.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.MouseWithoutBorders, title))
{
Title = title,
Subtitle = "Open Mouse Without Borders settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class NewPlusModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.NewPlus.ModuleDisplayName();
var icon = SettingsWindow.NewPlus.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.NewPlus, title))
{
Title = title,
Subtitle = "Open New+ settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class PeekModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.Peek.ModuleDisplayName();
var icon = SettingsWindow.Peek.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.Peek, title))
{
Title = title,
Subtitle = "Open Peek settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class PowerRenameModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.PowerRename.ModuleDisplayName();
var icon = SettingsWindow.PowerRename.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.PowerRename, title))
{
Title = title,
Subtitle = "Open PowerRename settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class QuickAccentModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.PowerAccent.ModuleDisplayName();
var icon = SettingsWindow.PowerAccent.ModuleIcon();
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.PowerAccent, title))
{
Title = title,
Subtitle = "Open Quick Accent settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class RegistryPreviewModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.RegistryPreview.ModuleDisplayName();
var icon = SettingsWindow.RegistryPreview.ModuleIcon();
yield return new ListItem(new OpenRegistryPreviewCommand())
{
Title = "Open Registry Preview",
Subtitle = "Launch Registry Preview",
Icon = icon,
};
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.RegistryPreview, title))
{
Title = title,
Subtitle = "Open Registry Preview settings",
Icon = icon,
};
}
}

View File

@@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.CommandPalette.Extensions.Toolkit;
using PowerToysExtension.Commands;
using PowerToysExtension.Helpers;
using static Common.UI.SettingsDeepLink;
namespace PowerToysExtension.Modules;
internal sealed class ZoomItModuleCommandProvider : ModuleCommandProvider
{
public override IEnumerable<ListItem> BuildCommands()
{
var title = SettingsWindow.ZoomIt.ModuleDisplayName();
var icon = SettingsWindow.ZoomIt.ModuleIcon();
// Action commands via ZoomIt IPC
yield return new ListItem(new ZoomItActionCommand("zoom", "ZoomIt: Zoom"))
{
Title = "ZoomIt: Zoom",
Subtitle = "Enter zoom mode",
Icon = icon,
};
yield return new ListItem(new ZoomItActionCommand("draw", "ZoomIt: Draw"))
{
Title = "ZoomIt: Draw",
Subtitle = "Enter drawing mode",
Icon = icon,
};
yield return new ListItem(new ZoomItActionCommand("break", "ZoomIt: Break"))
{
Title = "ZoomIt: Break",
Subtitle = "Enter break timer",
Icon = icon,
};
yield return new ListItem(new ZoomItActionCommand("livezoom", "ZoomIt: Live Zoom"))
{
Title = "ZoomIt: Live Zoom",
Subtitle = "Toggle live zoom",
Icon = icon,
};
yield return new ListItem(new ZoomItActionCommand("snip", "ZoomIt: Snip"))
{
Title = "ZoomIt: Snip",
Subtitle = "Enter snip mode",
Icon = icon,
};
yield return new ListItem(new ZoomItActionCommand("record", "ZoomIt: Record"))
{
Title = "ZoomIt: Record",
Subtitle = "Start recording",
Icon = icon,
};
yield return new ListItem(new OpenInSettingsCommand(SettingsWindow.ZoomIt, title))
{
Title = title,
Subtitle = "Open ZoomIt settings",
Icon = icon,
};
}
}