2019-09-04 18:26:26 +02:00
|
|
|
#include "pch.h"
|
|
|
|
#include <WinSafer.h>
|
|
|
|
#include <Sddl.h>
|
|
|
|
#include <sstream>
|
|
|
|
#include <aclapi.h>
|
2019-12-06 11:40:23 +03:00
|
|
|
|
2019-09-04 18:26:26 +02:00
|
|
|
#include "powertoy_module.h"
|
2020-12-15 15:16:09 +03:00
|
|
|
#include <common/interop/two_way_pipe_message_ipc.h>
|
2024-10-24 22:04:32 +02:00
|
|
|
#include <common/interop/shared_constants.h>
|
2019-09-04 18:26:26 +02:00
|
|
|
#include "tray_icon.h"
|
|
|
|
#include "general_settings.h"
|
2019-12-16 18:36:52 +01:00
|
|
|
#include "restart_elevated.h"
|
2021-06-14 12:55:59 +03:00
|
|
|
#include "UpdateUtils.h"
|
2020-09-21 12:44:16 +02:00
|
|
|
#include "centralized_kb_hook.h"
|
2023-01-31 00:00:11 +01:00
|
|
|
#include "Generated files/resource.h"
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2020-12-15 15:16:09 +03:00
|
|
|
#include <common/utils/json.h>
|
|
|
|
#include <common/SettingsAPI/settings_helpers.cpp>
|
|
|
|
#include <common/version/version.h>
|
|
|
|
#include <common/version/helper.h>
|
2020-11-30 16:16:49 +02:00
|
|
|
#include <common/logger/logger.h>
|
2023-01-31 00:00:11 +01:00
|
|
|
#include <common/utils/resources.h>
|
2020-12-15 15:16:09 +03:00
|
|
|
#include <common/utils/elevation.h>
|
2020-12-17 19:38:23 +03:00
|
|
|
#include <common/utils/process_path.h>
|
|
|
|
#include <common/utils/timeutil.h>
|
|
|
|
#include <common/utils/winapi_error.h>
|
2021-05-21 13:32:34 +03:00
|
|
|
#include <common/updating/updateState.h>
|
|
|
|
#include <common/themes/windows_colors.h>
|
2021-09-29 12:54:05 +02:00
|
|
|
#include "settings_window.h"
|
2023-09-15 08:34:17 +02:00
|
|
|
#include "bug_report.h"
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2019-12-06 11:40:23 +03:00
|
|
|
#define BUFSIZE 1024
|
2019-09-04 18:26:26 +02:00
|
|
|
|
|
|
|
TwoWayPipeMessageIPC* current_settings_ipc = NULL;
|
2022-11-22 16:58:49 +00:00
|
|
|
std::mutex ipc_mutex;
|
2020-05-14 09:12:40 -07:00
|
|
|
std::atomic_bool g_isLaunchInProgress = false;
|
2023-06-05 13:42:06 +03:00
|
|
|
std::atomic_bool isUpdateCheckThreadRunning = false;
|
2024-10-24 22:04:32 +02:00
|
|
|
HANDLE g_terminateSettingsEvent = CreateEventW(nullptr, false, false, CommonSharedConstants::TERMINATE_SETTINGS_SHARED_EVENT);
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
json::JsonObject get_power_toys_settings()
|
|
|
|
{
|
|
|
|
json::JsonObject result;
|
|
|
|
for (const auto& [name, powertoy] : modules())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
result.SetNamedValue(name, powertoy.json_config());
|
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
2021-05-20 15:07:34 +03:00
|
|
|
Logger::error(L"get_power_toys_settings(): got malformed json for {} module", name);
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
return result;
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
json::JsonObject get_all_settings()
|
|
|
|
{
|
|
|
|
json::JsonObject result;
|
2019-12-06 11:40:23 +03:00
|
|
|
|
2020-04-21 10:30:12 +03:00
|
|
|
result.SetNamedValue(L"general", get_general_settings().to_json());
|
2019-12-11 15:39:05 +01:00
|
|
|
result.SetNamedValue(L"powertoys", get_power_toys_settings());
|
|
|
|
return result;
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
|
|
|
|
2020-09-04 11:56:52 +03:00
|
|
|
std::optional<std::wstring> dispatch_json_action_to_module(const json::JsonObject& powertoys_configs)
|
2019-12-11 15:39:05 +01:00
|
|
|
{
|
2020-09-04 11:56:52 +03:00
|
|
|
std::optional<std::wstring> result;
|
2019-12-11 15:39:05 +01:00
|
|
|
for (const auto& powertoy_element : powertoys_configs)
|
|
|
|
{
|
|
|
|
const std::wstring name{ powertoy_element.Key().c_str() };
|
2019-12-16 18:36:52 +01:00
|
|
|
// Currently, there is only one custom action in the general settings screen,
|
|
|
|
// so it has to be the "restart as (non-)elevated" button.
|
|
|
|
if (name == L"general")
|
|
|
|
{
|
2020-06-23 15:53:02 +03:00
|
|
|
try
|
2019-12-16 18:36:52 +01:00
|
|
|
{
|
2020-06-23 15:53:02 +03:00
|
|
|
const auto value = powertoy_element.Value().GetObjectW();
|
|
|
|
const auto action = value.GetNamedString(L"action_name");
|
|
|
|
if (action == L"restart_elevation")
|
|
|
|
{
|
|
|
|
if (is_process_elevated())
|
|
|
|
{
|
|
|
|
schedule_restart_as_non_elevated();
|
|
|
|
PostQuitMessage(0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-02-10 14:48:43 +01:00
|
|
|
schedule_restart_as_elevated(true);
|
2020-06-23 15:53:02 +03:00
|
|
|
PostQuitMessage(0);
|
|
|
|
}
|
|
|
|
}
|
2022-10-13 03:41:21 -04:00
|
|
|
else if (action == L"restart_maintain_elevation")
|
|
|
|
{
|
|
|
|
// this was added to restart and maintain elevation, which is needed after settings are change from outside the normal process.
|
2024-12-06 06:33:08 -10:00
|
|
|
// since a normal PostQuitMessage(0) would usually cause this process to save its in memory settings to disk, we need to
|
2022-10-13 03:41:21 -04:00
|
|
|
// send a PostQuitMessage(1) and check for that on exit, and skip the settings-flush.
|
|
|
|
auto loaded = PTSettingsHelper::load_general_settings();
|
|
|
|
|
|
|
|
if (is_process_elevated())
|
|
|
|
{
|
|
|
|
schedule_restart_as_elevated(true);
|
|
|
|
PostQuitMessage(1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
schedule_restart_as_non_elevated(true);
|
|
|
|
PostQuitMessage(1);
|
|
|
|
}
|
|
|
|
}
|
2020-06-23 15:53:02 +03:00
|
|
|
else if (action == L"check_for_updates")
|
|
|
|
{
|
2023-06-05 13:42:06 +03:00
|
|
|
bool expected_isUpdateCheckThreadRunning = false;
|
2023-09-15 08:34:17 +02:00
|
|
|
if (isUpdateCheckThreadRunning.compare_exchange_strong(expected_isUpdateCheckThreadRunning, true))
|
2023-06-05 13:42:06 +03:00
|
|
|
{
|
|
|
|
std::thread([]() {
|
|
|
|
CheckForUpdatesCallback();
|
|
|
|
isUpdateCheckThreadRunning.store(false);
|
|
|
|
}).detach();
|
|
|
|
}
|
2020-12-17 19:38:23 +03:00
|
|
|
}
|
|
|
|
else if (action == L"request_update_state_date")
|
|
|
|
{
|
|
|
|
json::JsonObject json;
|
|
|
|
|
|
|
|
auto update_state = UpdateState::read();
|
2021-05-21 13:32:34 +03:00
|
|
|
if (update_state.githubUpdateLastCheckedDate)
|
2020-12-17 19:38:23 +03:00
|
|
|
{
|
2021-05-21 13:32:34 +03:00
|
|
|
const time_t date = *update_state.githubUpdateLastCheckedDate;
|
2021-01-12 18:34:02 +03:00
|
|
|
json.SetNamedValue(L"updateStateDate", json::value(std::to_wstring(date)));
|
2020-12-17 19:38:23 +03:00
|
|
|
}
|
|
|
|
|
2020-09-04 11:56:52 +03:00
|
|
|
result.emplace(json.Stringify());
|
2020-06-23 15:53:02 +03:00
|
|
|
}
|
2019-12-16 18:36:52 +01:00
|
|
|
}
|
2020-06-23 15:53:02 +03:00
|
|
|
catch (...)
|
2019-12-16 18:36:52 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (modules().find(name) != modules().end())
|
2019-12-11 15:39:05 +01:00
|
|
|
{
|
|
|
|
const auto element = powertoy_element.Value().Stringify();
|
2020-03-13 12:55:15 +03:00
|
|
|
modules().at(name)->call_custom_action(element.c_str());
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
2020-10-12 11:57:50 +03:00
|
|
|
|
|
|
|
return result;
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
void send_json_config_to_module(const std::wstring& module_key, const std::wstring& settings)
|
|
|
|
{
|
2020-09-21 12:44:16 +02:00
|
|
|
auto moduleIt = modules().find(module_key);
|
|
|
|
if (moduleIt != modules().end())
|
2019-12-11 15:39:05 +01:00
|
|
|
{
|
2020-09-21 12:44:16 +02:00
|
|
|
moduleIt->second->set_config(settings.c_str());
|
|
|
|
moduleIt->second.update_hotkeys();
|
2021-05-20 15:07:34 +03:00
|
|
|
moduleIt->second.UpdateHotkeyEx();
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
void dispatch_json_config_to_modules(const json::JsonObject& powertoys_configs)
|
|
|
|
{
|
|
|
|
for (const auto& powertoy_element : powertoys_configs)
|
|
|
|
{
|
|
|
|
const auto element = powertoy_element.Value().Stringify();
|
|
|
|
send_json_config_to_module(powertoy_element.Key().c_str(), element.c_str());
|
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
};
|
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
void dispatch_received_json(const std::wstring& json_to_parse)
|
|
|
|
{
|
2021-01-12 20:42:16 +03:00
|
|
|
json::JsonObject j;
|
|
|
|
const bool ok = json::JsonObject::TryParse(json_to_parse, j);
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
Logger::error(L"dispatch_received_json: got malformed json: {}", json_to_parse);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
for (const auto& base_element : j)
|
|
|
|
{
|
|
|
|
const auto name = base_element.Key();
|
|
|
|
const auto value = base_element.Value();
|
|
|
|
|
|
|
|
if (name == L"general")
|
|
|
|
{
|
|
|
|
apply_general_settings(value.GetObjectW());
|
2020-12-29 13:56:10 +03:00
|
|
|
const std::wstring settings_string{ get_all_settings().Stringify().c_str() };
|
2022-11-22 16:58:49 +00:00
|
|
|
{
|
|
|
|
std::unique_lock lock{ ipc_mutex };
|
2023-01-31 00:00:11 +01:00
|
|
|
if (current_settings_ipc)
|
2022-11-22 16:58:49 +00:00
|
|
|
current_settings_ipc->send(settings_string);
|
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
|
|
|
else if (name == L"powertoys")
|
|
|
|
{
|
|
|
|
dispatch_json_config_to_modules(value.GetObjectW());
|
2020-12-29 13:56:10 +03:00
|
|
|
const std::wstring settings_string{ get_all_settings().Stringify().c_str() };
|
2022-11-22 16:58:49 +00:00
|
|
|
{
|
|
|
|
std::unique_lock lock{ ipc_mutex };
|
2023-01-31 00:00:11 +01:00
|
|
|
if (current_settings_ipc)
|
2022-11-22 16:58:49 +00:00
|
|
|
current_settings_ipc->send(settings_string);
|
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
|
|
|
else if (name == L"refresh")
|
|
|
|
{
|
2020-12-29 13:56:10 +03:00
|
|
|
const std::wstring settings_string{ get_all_settings().Stringify().c_str() };
|
2022-11-22 16:58:49 +00:00
|
|
|
{
|
|
|
|
std::unique_lock lock{ ipc_mutex };
|
2023-01-31 00:00:11 +01:00
|
|
|
if (current_settings_ipc)
|
2022-11-22 16:58:49 +00:00
|
|
|
current_settings_ipc->send(settings_string);
|
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
|
|
|
else if (name == L"action")
|
|
|
|
{
|
2020-09-04 11:56:52 +03:00
|
|
|
auto result = dispatch_json_action_to_module(value.GetObjectW());
|
|
|
|
if (result.has_value())
|
|
|
|
{
|
2022-11-22 16:58:49 +00:00
|
|
|
{
|
|
|
|
std::unique_lock lock{ ipc_mutex };
|
2023-01-31 00:00:11 +01:00
|
|
|
if (current_settings_ipc)
|
2022-11-22 16:58:49 +00:00
|
|
|
current_settings_ipc->send(result.value());
|
|
|
|
}
|
2020-09-04 11:56:52 +03:00
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
2023-01-31 00:00:11 +01:00
|
|
|
else if (name == L"bugreport")
|
|
|
|
{
|
2023-09-15 08:34:17 +02:00
|
|
|
launch_bug_report();
|
2023-01-31 00:00:11 +01:00
|
|
|
}
|
2025-06-17 14:49:54 +08:00
|
|
|
else if (name == L"bug_report_status")
|
|
|
|
{
|
|
|
|
json::JsonObject result;
|
|
|
|
result.SetNamedValue(L"bug_report_running", winrt::Windows::Data::Json::JsonValue::CreateBooleanValue(is_bug_report_running()));
|
|
|
|
std::unique_lock lock{ ipc_mutex };
|
|
|
|
if (current_settings_ipc)
|
|
|
|
current_settings_ipc->send(result.Stringify().c_str());
|
|
|
|
}
|
2023-01-31 00:00:11 +01:00
|
|
|
else if (name == L"killrunner")
|
|
|
|
{
|
|
|
|
const auto pt_main_window = FindWindowW(pt_tray_icon_window_class, nullptr);
|
|
|
|
if (pt_main_window != nullptr)
|
|
|
|
{
|
|
|
|
SendMessageW(pt_main_window, WM_CLOSE, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 22:20:15 +02:00
|
|
|
else if (name == L"language")
|
|
|
|
{
|
|
|
|
constexpr const wchar_t* language_filename = L"\\language.json";
|
|
|
|
const std::wstring save_file_location = PTSettingsHelper::get_root_save_folder_location() + language_filename;
|
|
|
|
json::to_file(save_file_location, j);
|
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
return;
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
void dispatch_received_json_callback(PVOID data)
|
|
|
|
{
|
2023-02-08 11:17:33 +00:00
|
|
|
std::wstring* msg = static_cast<std::wstring*>(data);
|
2019-12-11 15:39:05 +01:00
|
|
|
dispatch_received_json(*msg);
|
|
|
|
delete msg;
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
void receive_json_send_to_main_thread(const std::wstring& msg)
|
|
|
|
{
|
|
|
|
std::wstring* copy = new std::wstring(msg);
|
|
|
|
dispatch_run_on_main_ui_thread(dispatch_received_json_callback, copy);
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
|
|
|
|
2022-06-05 00:30:34 +02:00
|
|
|
// Try to run the Settings process with non-elevated privileges.
|
|
|
|
BOOL run_settings_non_elevated(LPCWSTR executable_path, LPWSTR executable_args, PROCESS_INFORMATION* process_info)
|
|
|
|
{
|
|
|
|
HWND hwnd = GetShellWindow();
|
|
|
|
if (!hwnd)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD pid;
|
|
|
|
GetWindowThreadProcessId(hwnd, &pid);
|
|
|
|
|
|
|
|
winrt::handle process{ OpenProcess(PROCESS_CREATE_PROCESS, FALSE, pid) };
|
|
|
|
if (!process)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
SIZE_T size = 0;
|
|
|
|
InitializeProcThreadAttributeList(nullptr, 1, 0, &size);
|
|
|
|
auto pproc_buffer = std::unique_ptr<char[]>{ new (std::nothrow) char[size] };
|
|
|
|
auto pptal = reinterpret_cast<PPROC_THREAD_ATTRIBUTE_LIST>(pproc_buffer.get());
|
|
|
|
if (!pptal)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!InitializeProcThreadAttributeList(pptal, 1, 0, &size))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!UpdateProcThreadAttribute(pptal,
|
|
|
|
0,
|
|
|
|
PROC_THREAD_ATTRIBUTE_PARENT_PROCESS,
|
|
|
|
&process,
|
|
|
|
sizeof(process),
|
|
|
|
nullptr,
|
|
|
|
nullptr))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
STARTUPINFOEX siex = { 0 };
|
|
|
|
siex.lpAttributeList = pptal;
|
|
|
|
siex.StartupInfo.cb = sizeof(siex);
|
|
|
|
|
|
|
|
BOOL process_created = CreateProcessW(executable_path,
|
|
|
|
executable_args,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
FALSE,
|
|
|
|
EXTENDED_STARTUPINFO_PRESENT,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
&siex.StartupInfo,
|
|
|
|
process_info);
|
|
|
|
g_isLaunchInProgress = false;
|
|
|
|
return process_created;
|
|
|
|
}
|
|
|
|
|
2019-12-11 16:32:40 +01:00
|
|
|
DWORD g_settings_process_id = 0;
|
|
|
|
|
2023-02-03 15:10:14 +00:00
|
|
|
void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::optional<std::wstring> settings_window, bool show_flyout = false, const std::optional<POINT>& flyout_position = std::nullopt)
|
2019-12-11 16:32:40 +01:00
|
|
|
{
|
2020-05-14 09:12:40 -07:00
|
|
|
g_isLaunchInProgress = true;
|
|
|
|
|
2019-12-11 16:32:40 +01:00
|
|
|
PROCESS_INFORMATION process_info = { 0 };
|
|
|
|
HANDLE hToken = nullptr;
|
|
|
|
|
|
|
|
// Arguments for calling the settings executable:
|
|
|
|
// "C:\powertoys_path\PowerToysSettings.exe" powertoys_pipe settings_pipe powertoys_pid settings_theme
|
|
|
|
// powertoys_pipe: PowerToys pipe server.
|
|
|
|
// settings_pipe : Settings pipe server.
|
|
|
|
// powertoys_pid : PowerToys process pid.
|
|
|
|
// settings_theme: pass "dark" to start the settings window in dark mode
|
|
|
|
|
|
|
|
// Arg 1: executable path.
|
|
|
|
std::wstring executable_path = get_module_folderpath();
|
2020-05-05 15:53:30 -07:00
|
|
|
|
2023-07-20 00:12:46 +01:00
|
|
|
executable_path.append(L"\\WinUI3Apps\\PowerToys.Settings.exe");
|
2019-12-11 16:32:40 +01:00
|
|
|
|
2021-03-02 20:56:37 +03:00
|
|
|
// Args 2,3: pipe server. Generate unique names for the pipes, if getting a UUID is possible.
|
2019-12-11 16:32:40 +01:00
|
|
|
std::wstring powertoys_pipe_name(L"\\\\.\\pipe\\powertoys_runner_");
|
|
|
|
std::wstring settings_pipe_name(L"\\\\.\\pipe\\powertoys_settings_");
|
|
|
|
UUID temp_uuid;
|
2020-11-30 16:16:49 +02:00
|
|
|
wchar_t* uuid_chars = nullptr;
|
|
|
|
if (UuidCreate(&temp_uuid) == RPC_S_UUID_NO_ADDRESS)
|
|
|
|
{
|
|
|
|
auto val = get_last_error_message(GetLastError());
|
2024-12-06 06:33:08 -10:00
|
|
|
Logger::warn(L"UuidCreate cannot create guid. {}", val.has_value() ? val.value() : L"");
|
2020-11-30 16:16:49 +02:00
|
|
|
}
|
2023-02-08 11:17:33 +00:00
|
|
|
else if (UuidToString(&temp_uuid, reinterpret_cast<RPC_WSTR*>(&uuid_chars)) != RPC_S_OK)
|
2020-11-30 16:16:49 +02:00
|
|
|
{
|
|
|
|
auto val = get_last_error_message(GetLastError());
|
2024-12-06 06:33:08 -10:00
|
|
|
Logger::warn(L"UuidToString cannot convert to string. {}", val.has_value() ? val.value() : L"");
|
2020-11-30 16:16:49 +02:00
|
|
|
}
|
|
|
|
|
2019-12-11 16:32:40 +01:00
|
|
|
if (uuid_chars != nullptr)
|
2019-12-11 15:39:05 +01:00
|
|
|
{
|
2019-12-11 16:32:40 +01:00
|
|
|
powertoys_pipe_name += std::wstring(uuid_chars);
|
|
|
|
settings_pipe_name += std::wstring(uuid_chars);
|
2023-02-08 11:17:33 +00:00
|
|
|
RpcStringFree(reinterpret_cast<RPC_WSTR*>(&uuid_chars));
|
2019-12-11 16:32:40 +01:00
|
|
|
uuid_chars = nullptr;
|
|
|
|
}
|
|
|
|
|
2021-03-02 20:56:37 +03:00
|
|
|
// Arg 4: process pid.
|
2019-12-11 16:32:40 +01:00
|
|
|
DWORD powertoys_pid = GetCurrentProcessId();
|
|
|
|
|
2023-05-03 10:37:10 +01:00
|
|
|
GeneralSettings save_settings = get_general_settings();
|
|
|
|
|
2021-03-02 20:56:37 +03:00
|
|
|
// Arg 5: settings theme.
|
2023-05-03 10:37:10 +01:00
|
|
|
const std::wstring settings_theme_setting{ save_settings.theme };
|
2020-05-05 21:17:43 -07:00
|
|
|
std::wstring settings_theme = L"system";
|
2019-12-11 16:32:40 +01:00
|
|
|
if (settings_theme_setting == L"dark" || (settings_theme_setting == L"system" && WindowsColors::is_dark_mode()))
|
|
|
|
{
|
|
|
|
settings_theme = L"dark";
|
|
|
|
}
|
|
|
|
|
2021-03-02 20:56:37 +03:00
|
|
|
// Arg 6: elevated status
|
2023-05-03 10:37:10 +01:00
|
|
|
bool isElevated{ save_settings.isElevated };
|
2021-03-02 20:56:37 +03:00
|
|
|
std::wstring settings_elevatedStatus = isElevated ? L"true" : L"false";
|
2021-05-21 13:32:34 +03:00
|
|
|
|
2021-03-02 20:56:37 +03:00
|
|
|
// Arg 7: is user an admin
|
2023-05-03 10:37:10 +01:00
|
|
|
bool isAdmin{ save_settings.isAdmin };
|
2021-03-02 20:56:37 +03:00
|
|
|
std::wstring settings_isUserAnAdmin = isAdmin ? L"true" : L"false";
|
2020-05-14 12:36:27 +03:00
|
|
|
|
2021-03-02 20:56:37 +03:00
|
|
|
// Arg 8: should oobe window be shown
|
2021-09-29 12:54:05 +02:00
|
|
|
std::wstring settings_showOobe = show_oobe_window ? L"true" : L"false";
|
2020-05-14 12:36:27 +03:00
|
|
|
|
2022-02-22 11:02:08 +00:00
|
|
|
// Arg 9: should scoobe window be shown
|
|
|
|
std::wstring settings_showScoobe = show_scoobe_window ? L"true" : L"false";
|
|
|
|
|
2023-01-31 00:00:11 +01:00
|
|
|
// Arg 10: should flyout be shown
|
|
|
|
std::wstring settings_showFlyout = show_flyout ? L"true" : L"false";
|
|
|
|
|
2023-02-03 15:10:14 +00:00
|
|
|
// Arg 11: contains if there's a settings window argument. If true, will add one extra argument with the value to the call.
|
|
|
|
std::wstring settings_containsSettingsWindow = settings_window.has_value() ? L"true" : L"false";
|
|
|
|
|
|
|
|
// Arg 12: contains if there's flyout coordinates. If true, will add two extra arguments to the call containing the x and y coordinates.
|
|
|
|
std::wstring settings_containsFlyoutPosition = flyout_position.has_value() ? L"true" : L"false";
|
|
|
|
|
|
|
|
// Args 13, .... : Optional arguments depending on the options presented before. All by the same value.
|
|
|
|
|
2023-05-03 10:37:10 +01:00
|
|
|
// create general settings file to initialize the settings file with installation configurations like :
|
|
|
|
// 1. Run on start up.
|
|
|
|
PTSettingsHelper::save_general_settings(save_settings.to_json());
|
|
|
|
|
2023-02-03 15:10:14 +00:00
|
|
|
std::wstring executable_args = fmt::format(L"\"{}\" {} {} {} {} {} {} {} {} {} {} {}",
|
2023-09-15 08:34:17 +02:00
|
|
|
executable_path,
|
|
|
|
powertoys_pipe_name,
|
|
|
|
settings_pipe_name,
|
|
|
|
std::to_wstring(powertoys_pid),
|
|
|
|
settings_theme,
|
|
|
|
settings_elevatedStatus,
|
|
|
|
settings_isUserAnAdmin,
|
|
|
|
settings_showOobe,
|
|
|
|
settings_showScoobe,
|
|
|
|
settings_showFlyout,
|
|
|
|
settings_containsSettingsWindow,
|
|
|
|
settings_containsFlyoutPosition);
|
2021-05-21 13:32:34 +03:00
|
|
|
|
2021-09-29 12:54:05 +02:00
|
|
|
if (settings_window.has_value())
|
|
|
|
{
|
|
|
|
executable_args.append(L" ");
|
|
|
|
executable_args.append(settings_window.value());
|
|
|
|
}
|
|
|
|
|
2023-02-03 15:10:14 +00:00
|
|
|
if (flyout_position)
|
|
|
|
{
|
|
|
|
executable_args.append(L" ");
|
|
|
|
executable_args.append(std::to_wstring(flyout_position.value().x));
|
|
|
|
executable_args.append(L" ");
|
|
|
|
executable_args.append(std::to_wstring(flyout_position.value().y));
|
|
|
|
}
|
|
|
|
|
2019-12-11 16:32:40 +01:00
|
|
|
BOOL process_created = false;
|
2021-01-20 19:28:14 +01:00
|
|
|
|
2022-12-16 15:14:50 +01:00
|
|
|
// Commented out to fix #22659
|
|
|
|
// Running settings non-elevated and modules elevated when PowerToys is running elevated results
|
|
|
|
// in settings making changes in one file (non-elevated user dir) and modules are reading settings
|
|
|
|
// from different (elevated user) dir
|
|
|
|
//if (is_process_elevated())
|
|
|
|
//{
|
|
|
|
|
|
|
|
// auto res = RunNonElevatedFailsafe(executable_path, executable_args, get_module_folderpath());
|
|
|
|
// process_created = res.has_value();
|
|
|
|
// if (process_created)
|
|
|
|
// {
|
|
|
|
// process_info.dwProcessId = res->processID;
|
|
|
|
// process_info.hProcess = res->processHandle.release();
|
|
|
|
// g_isLaunchInProgress = false;
|
|
|
|
// }
|
|
|
|
//}
|
2019-12-11 16:32:40 +01:00
|
|
|
|
|
|
|
if (FALSE == process_created)
|
|
|
|
{
|
|
|
|
// The runner is not elevated or we failed to create the process using the
|
|
|
|
// attribute list from Windows Explorer (this happens when PowerToys is executed
|
|
|
|
// as Administrator from a non-Administrator user or an error occur trying).
|
|
|
|
// In the second case the Settings process will run elevated.
|
|
|
|
STARTUPINFO startup_info = { sizeof(startup_info) };
|
|
|
|
if (!CreateProcessW(executable_path.c_str(),
|
|
|
|
executable_args.data(),
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
FALSE,
|
|
|
|
0,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
&startup_info,
|
|
|
|
&process_info))
|
|
|
|
{
|
|
|
|
goto LExit;
|
|
|
|
}
|
2020-05-14 09:12:40 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
g_isLaunchInProgress = false;
|
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
|
|
|
|
{
|
|
|
|
goto LExit;
|
|
|
|
}
|
2019-12-11 16:32:40 +01:00
|
|
|
|
2022-11-22 16:58:49 +00:00
|
|
|
{
|
|
|
|
std::unique_lock lock{ ipc_mutex };
|
|
|
|
current_settings_ipc = new TwoWayPipeMessageIPC(powertoys_pipe_name, settings_pipe_name, receive_json_send_to_main_thread);
|
|
|
|
current_settings_ipc->start(hToken);
|
2025-06-17 14:49:54 +08:00
|
|
|
|
|
|
|
// Register callback for bug report status changes
|
|
|
|
BugReportManager::instance().register_callback([](bool isRunning) {
|
|
|
|
json::JsonObject result;
|
|
|
|
result.SetNamedValue(L"bug_report_running", winrt::Windows::Data::Json::JsonValue::CreateBooleanValue(isRunning));
|
|
|
|
|
|
|
|
std::unique_lock lock{ ipc_mutex };
|
|
|
|
if (current_settings_ipc)
|
|
|
|
current_settings_ipc->send(result.Stringify().c_str());
|
|
|
|
});
|
2022-11-22 16:58:49 +00:00
|
|
|
}
|
2025-06-17 14:49:54 +08:00
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
g_settings_process_id = process_info.dwProcessId;
|
|
|
|
|
2020-11-30 16:16:49 +02:00
|
|
|
if (process_info.hProcess)
|
|
|
|
{
|
|
|
|
WaitForSingleObject(process_info.hProcess, INFINITE);
|
|
|
|
if (WaitForSingleObject(process_info.hProcess, INFINITE) != WAIT_OBJECT_0)
|
|
|
|
{
|
|
|
|
show_last_error_message(L"Couldn't wait on the Settings Window to close.", GetLastError(), L"PowerToys - runner");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2019-12-11 15:39:05 +01:00
|
|
|
{
|
2020-11-30 16:16:49 +02:00
|
|
|
auto val = get_last_error_message(GetLastError());
|
|
|
|
Logger::error(L"Process handle is empty. {}", val.has_value() ? val.value() : L"");
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
LExit:
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
if (process_info.hProcess)
|
|
|
|
{
|
|
|
|
CloseHandle(process_info.hProcess);
|
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
if (process_info.hThread)
|
|
|
|
{
|
|
|
|
CloseHandle(process_info.hThread);
|
|
|
|
}
|
|
|
|
{
|
2022-11-22 16:58:49 +00:00
|
|
|
std::unique_lock lock{ ipc_mutex };
|
|
|
|
if (current_settings_ipc)
|
|
|
|
{
|
|
|
|
current_settings_ipc->end();
|
|
|
|
delete current_settings_ipc;
|
|
|
|
current_settings_ipc = nullptr;
|
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2019-12-11 15:39:05 +01:00
|
|
|
if (hToken)
|
|
|
|
{
|
|
|
|
CloseHandle(hToken);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_settings_process_id = 0;
|
|
|
|
}
|
|
|
|
|
2020-05-05 14:02:55 -07:00
|
|
|
#define MAX_TITLE_LENGTH 100
|
2019-12-11 15:39:05 +01:00
|
|
|
void bring_settings_to_front()
|
|
|
|
{
|
2022-11-09 14:41:14 +00:00
|
|
|
auto callback = [](HWND hwnd, LPARAM /*data*/) -> BOOL {
|
2019-12-11 15:39:05 +01:00
|
|
|
DWORD processId;
|
|
|
|
if (GetWindowThreadProcessId(hwnd, &processId) && processId == g_settings_process_id)
|
|
|
|
{
|
2020-05-05 14:02:55 -07:00
|
|
|
std::wstring windowTitle = L"PowerToys Settings";
|
|
|
|
|
|
|
|
WCHAR title[MAX_TITLE_LENGTH];
|
|
|
|
int len = GetWindowTextW(hwnd, title, MAX_TITLE_LENGTH);
|
|
|
|
if (len <= 0)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (wcsncmp(title, windowTitle.c_str(), len) == 0)
|
|
|
|
{
|
2021-11-18 12:38:16 +01:00
|
|
|
auto lStyles = GetWindowLong(hwnd, GWL_STYLE);
|
|
|
|
|
|
|
|
if (lStyles & WS_MAXIMIZE)
|
|
|
|
{
|
|
|
|
ShowWindow(hwnd, SW_MAXIMIZE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ShowWindow(hwnd, SW_RESTORE);
|
|
|
|
}
|
|
|
|
|
2020-05-05 14:02:55 -07:00
|
|
|
SetForegroundWindow(hwnd);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
};
|
|
|
|
|
|
|
|
EnumWindows(callback, 0);
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
|
|
|
|
2023-02-03 15:10:14 +00:00
|
|
|
void open_settings_window(std::optional<std::wstring> settings_window, bool show_flyout = false, const std::optional<POINT>& flyout_position)
|
2019-12-11 15:39:05 +01:00
|
|
|
{
|
|
|
|
if (g_settings_process_id != 0)
|
|
|
|
{
|
2023-01-31 00:00:11 +01:00
|
|
|
if (show_flyout)
|
|
|
|
{
|
|
|
|
if (current_settings_ipc)
|
|
|
|
{
|
2023-02-03 15:10:14 +00:00
|
|
|
if (!flyout_position.has_value())
|
|
|
|
{
|
|
|
|
current_settings_ipc->send(L"{\"ShowYourself\":\"flyout\"}");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
current_settings_ipc->send(fmt::format(L"{{\"ShowYourself\":\"flyout\", \"x_position\":{}, \"y_position\":{} }}", std::to_wstring(flyout_position.value().x), std::to_wstring(flyout_position.value().y)));
|
|
|
|
}
|
2023-01-31 00:00:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// nl instead of showing the window, send message to it (flyout might need to be hidden, main setting window activated)
|
|
|
|
// bring_settings_to_front();
|
|
|
|
if (current_settings_ipc)
|
|
|
|
{
|
2023-05-02 13:10:54 +02:00
|
|
|
if (settings_window.has_value())
|
|
|
|
{
|
|
|
|
std::wstring msg = L"{\"ShowYourself\":\"" + settings_window.value() + L"\"}";
|
|
|
|
current_settings_ipc->send(msg);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
|
|
|
current_settings_ipc->send(L"{\"ShowYourself\":\"Dashboard\"}");
|
2023-05-02 13:10:54 +02:00
|
|
|
}
|
2023-01-31 00:00:11 +01:00
|
|
|
}
|
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-14 09:12:40 -07:00
|
|
|
if (!g_isLaunchInProgress)
|
|
|
|
{
|
2023-02-03 15:10:14 +00:00
|
|
|
std::thread([settings_window, show_flyout, flyout_position]() {
|
|
|
|
run_settings_window(false, false, settings_window, show_flyout, flyout_position);
|
2021-03-02 20:56:37 +03:00
|
|
|
}).detach();
|
2020-05-14 09:12:40 -07:00
|
|
|
}
|
2019-12-11 15:39:05 +01:00
|
|
|
}
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
2020-05-05 14:13:52 -07:00
|
|
|
|
|
|
|
void close_settings_window()
|
|
|
|
{
|
|
|
|
if (g_settings_process_id != 0)
|
|
|
|
{
|
2024-10-24 22:04:32 +02:00
|
|
|
SetEvent(g_terminateSettingsEvent);
|
2024-10-27 21:51:11 +01:00
|
|
|
wil::unique_handle proc{ OpenProcess(PROCESS_ALL_ACCESS, false, g_settings_process_id) };
|
2023-11-15 17:38:44 +01:00
|
|
|
if (proc)
|
2020-05-05 14:13:52 -07:00
|
|
|
{
|
2024-10-24 22:04:32 +02:00
|
|
|
WaitForSingleObject(proc.get(), 1500);
|
2023-11-15 17:38:44 +01:00
|
|
|
TerminateProcess(proc.get(), 0);
|
2020-05-05 14:13:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-02 20:56:37 +03:00
|
|
|
|
|
|
|
void open_oobe_window()
|
|
|
|
{
|
|
|
|
std::thread([]() {
|
2022-02-22 11:02:08 +00:00
|
|
|
run_settings_window(true, false, std::nullopt);
|
|
|
|
}).detach();
|
|
|
|
}
|
|
|
|
|
|
|
|
void open_scoobe_window()
|
|
|
|
{
|
|
|
|
std::thread([]() {
|
|
|
|
run_settings_window(false, true, std::nullopt);
|
2021-03-02 20:56:37 +03:00
|
|
|
}).detach();
|
|
|
|
}
|
2021-09-29 12:54:05 +02:00
|
|
|
|
|
|
|
std::string ESettingsWindowNames_to_string(ESettingsWindowNames value)
|
|
|
|
{
|
|
|
|
switch (value)
|
|
|
|
{
|
|
|
|
case ESettingsWindowNames::Overview:
|
|
|
|
return "Overview";
|
|
|
|
case ESettingsWindowNames::Awake:
|
|
|
|
return "Awake";
|
|
|
|
case ESettingsWindowNames::ColorPicker:
|
|
|
|
return "ColorPicker";
|
|
|
|
case ESettingsWindowNames::FancyZones:
|
|
|
|
return "FancyZones";
|
|
|
|
case ESettingsWindowNames::Run:
|
|
|
|
return "Run";
|
|
|
|
case ESettingsWindowNames::ImageResizer:
|
|
|
|
return "ImageResizer";
|
|
|
|
case ESettingsWindowNames::KBM:
|
|
|
|
return "KBM";
|
2021-10-22 13:30:18 +01:00
|
|
|
case ESettingsWindowNames::MouseUtils:
|
|
|
|
return "MouseUtils";
|
2021-09-29 12:54:05 +02:00
|
|
|
case ESettingsWindowNames::PowerRename:
|
|
|
|
return "PowerRename";
|
|
|
|
case ESettingsWindowNames::FileExplorer:
|
|
|
|
return "FileExplorer";
|
|
|
|
case ESettingsWindowNames::ShortcutGuide:
|
|
|
|
return "ShortcutGuide";
|
2022-10-13 13:05:43 +02:00
|
|
|
case ESettingsWindowNames::Hosts:
|
|
|
|
return "Hosts";
|
2023-05-02 13:10:54 +02:00
|
|
|
case ESettingsWindowNames::MeasureTool:
|
|
|
|
return "MeasureTool";
|
|
|
|
case ESettingsWindowNames::PowerOCR:
|
2024-04-09 19:46:17 +01:00
|
|
|
return "PowerOcr";
|
[New Module] Workspaces (#34324)
* spell checker
* Adding OOBE Projects page
* changed the default hotkey
* module interface
* rename projects editor
* bug report tool
* installer
* gpo
* exit event constant
* extend search for projects by search over the containing apps' names
* [Projects] fix grammatical issue #43 (1 app - many apps)
* [Projects] Editor: Main page: fix layout if there are many apps, launch button not disappearing on the right side
* dsc
* github
* pipeline
* guid prefix
* [Projects] fixing general settings gpo handling in runner + minor changes
* arm build fix
* Do not allow saving project if name or applist is empty. Also minor UI changes
* version
* editor version
* spellcheck
* editor dll signing
* update projects names to filter them out
* shortcut saving fix
* [Projects] Editor: brining the highlighted app's icon into the foreground. + minor UI fixes
* spell checker
* spellcheck
* [Projects] re-implementing icon size calculation to have similar sized icons for every app.
* [projects] Adding info message for cases: there are no projects or no results for the search
* [Projects] Adding Edit button to the popup. + minor changes
* [Projects] Making popup having rounded corners
* changed "no projects" text color and position
* remove opening the first proj
* fix placing windows of the same app in the project
* [Projects] bringing back the breadcrumb on the editor page. Make it clickable.
* [Projects] optimizing click handlers
* [Projects] Removing not selected apps on save
* moved on thread executor to common
* moved display utils
* added convert rect
* unsigned monitor number
* set awareness
* app placement
* [Projects] Re-implementing preview drawing - one common image
* [Projects] fix boundary calculation, use DPI aware values
* fix launching with command line args
* Fix ARM64 CI build
* launch packaged apps using names when possible
* spell-check
* update packaged apps path
* projects editor single instance
* [Projects] Add Select all checkbox, Delete selected button
* Add Checkbox for per monitor selection
* modifying highlight in preview
* spell checker
* logs
* exclude help windows
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/49
* Add intermediate step to project creation
* minor bugfix
* mutex fix
* modifying highlight for minimized apps
* Fixing bug: re-draw the preview on app deletion in the editor
* Adding helper class for getting the right bounds for screens
* spell checker
* spell checker
* Minor fixes in the capture dialog
* get dpi unaware screen bounds
* refactoring: added utils
* changed window filter
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/2
* clean up
* refactoring
* projects common lib
* localizable default project prefix
* launcher resources
* clean up
* change snapshot project saving
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* changed project data
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* changed project creation save-cancel handles
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* spell-check
* Remove checkboxes, delete feature
* remove unused from the project
* get command line args in the snapshot
* minimized settings snap fix
* set window property after launching
* FZ: ignore projects launched windows
* Implementing major new features: remove button, position manipulation, arguments, admin, minimized, maximized
* modifying colors
* launcher project filters
* clean up
* Hide Admin checkbox
* hide WIP
* spell-check
* Revert "Hide Admin checkbox"
This reverts commit 3036df9d7fe48de6418b0ebeff6422d535cb25e2.
* get app elevated property
* Implementing Launch and Edit feature
* fixing: update of listed projects on the main page after hitting save in editor
* Fix for packaged app's icons
* fixing scroll speed issue
* change scroll speed to 15
* launch elevated apps
* minor fixes
* minor fix
* enhancing shortcut handling
* can-launch-elevated check
* projects module interface telemetry
* Implementing store of setting "order by".
* minor string correction
* moved projects data parsing
* telemetry
* add move apps checkbox
* notification about elevated apps
* restart unelevated
* move existing windows
* keep opened windows at the same positions
* handle powertoys settings
* use common theme
* fix corrupted data: project id and monitor id
* project launch on "launch and edit"
* clean up
* show screen numbers instead of monitor names
* launcher error messages
* fix default shortcut
* Adding launch button to projects settings, dashboard and flyout
* Adding new app which is launched when launching a project. It shows the status of the launch process
* spell checker
* Renaming Projects to App Layouts. Replacing only string values, not the variable names
* Re-ordering modules after Renaming Projects + spell checker
* setting window size according to the screen (making it bigger)
* commenting out feature "move apps if exist"
* spell checker
* Add ProjectsLauncherUI to signing
* opening apps in minimized state which are placed on a monitor, which is not found at the moment of launching
* consistent file name
* removed unused sln
* telemetry: create event
* WindowPosition comparison
* telemetry: edit event
* fix muted Launch as admin checkbox
* telemetry: delete event
* updated Edit telemetry event
* added invoke point to launcher args
* added utils
* parse invoke point
* replaced tuple with struct
* telemetry: launch event
* MonitorRect comparison
* resources
* rename: folders
* remove outdated
* rename: window property
* rename: files and folders
* rename: common data structures
* rename: telemetry namespace
* rename: workspaces data
* rename ProjectsLib -> WorkspacesLib
* rename: gpo
* rename: settings
* rename: launcher UI
* rename: other
* rename: pt run
* rename: fz
* rename: module interface
* rename: icon
* rename: snapshot tool
* rename: editor
* rename: common files
* rename: launcher
* rename: editor resources
* fix empty file crash
* rename: json
* rename: module interface
* fix custom actions build
* added launch editor event constant
* xaml formatting
* Add missing method defition to interop::Constants idl
Remove Any CPU config
* more .sln cleanup
* [Run][PowerToys] Fix Workspaces utility (#34336)
polished workspaces utility
* build fix - align CppWinRT version
* address PR comment: fix isdigit
* indentation
* address PR comment: rename function
* address PR comment: changed version for workspaces and revision
* added supported version definition
* addressPR comment: use BringToForeground
* address PR comments: updated projects
* address PR comment: uncomment gpo in settings
* address PR comment: rename oobe view
* update OOBE image with current module name
* moved AppUtils
* launching with AppUserModel.ID
* fixed module order in settings
* fix xaml formatting
* [Workspaces] Close launcher if there are failed launches. Plus adding new spinner gif
* fix topmost LauncherUI
* clean up
* UI closing
* BugReportTool - omit cmd arg data
* Delete icon on workspace removal
* Adding cancellation to launcher UI.
* reordered launching
* fix terminating UI
* Removing old shortcut on workspace renaming
* Sentence case labels
* get process path without waiting
* comment out unused
* remove unused argument
* logs
* New icon
* fix launch and edit for the new project
* fix launch and edit: save new project
* Update exe icons
---------
Co-authored-by: donlaci <laszlo@janeasystems.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
Co-authored-by: Niels Laute <niels.laute@live.nl>
2024-08-23 09:28:13 +02:00
|
|
|
case ESettingsWindowNames::Workspaces:
|
|
|
|
return "Workspaces";
|
Registry Preview: complete feature with integration with Settings and the Launcher UX (#23709)
* Initial src for Registry Preview
Initial collection of files
* Update MainWindow.Utilities.cs
fixing a few spelling items
* Update expect.txt
* Update App.xaml.cs
* Update MainWindow.Events.cs
* Update MainWindow.Utilities.cs
* Update MainWindow.xaml.cs
* Update expect.txt
* Update MainWindow.Events.cs
* Rename AddPreviewtoRegfile.reg to AddPreviewToRegfile.reg
* Rename RemovePreviewtoRegfile.reg to RemovePreviewToRegfile.reg
* Update Resources.resw
* Update MainWindow.xaml
* Turns on self-contained mode
Updates the csproj file to compile the app as self-contained .
Includes fixes for code that expected the app to be in an ApplicationContainer.
Updates WindowsAppSDK from 1.1.5 to 1.2.230118.102.
* Updated to align with StyleCop errors
Multiple changes across the codebase that now aligns with StyleCop guidelines.
Tested again after the changes, to make sure no new bugs crept in.
* Added comments for spell-checker
Unclear if this side step should be done or not, but the kxz comes from a GUID and the other three names are constants.
* Adding code-custom.dic
Comments didn't work; trying a dic file
* Added four new terms to expects.txt file
Cleaning up attempt to update the spell-checker with dic file and moved it to expects.txt file
* Adding one more string
Adding one more string for Spell-Check
* Adding back egfile
Seems this is needed.
* Correcting a variable name
Seems one of the variable names that changed globally got missed in a XAML file.
* Update project to be more PowerToys friendly
Tweaking names and output file name to fit better with PowerToys.
* First pass at integration into Settings and Launcher
This PR is not as large as it seems:
- RegistryPreview's source moved around to a "better" directory that makes it look like the whole app changed. It didn't. In fact, I opened it in Beyond Compare and there's not much difference in the RegistryPreview app.
- Added RegistryPreviewExt that produces a DLL that the Launcher can run the EXE
- Changes to Runner calls the Ext DLL rather than the app
- Settings UI got a bunch of changes to enable the Settings page for enable/disable across ViewModels, Views, and string tables.
Still todo:
- Add "Preview" to .REG files, when the app is enable (and remove it when disabled)
- Update the thumbnail-screenshot in the Settings page
- Add support for OOBE
* Update expect.txt
Added REGISTRYPREVIEWEXT for recent changes and corrected an alphabetic sorting error.
* Updating project file for Release mode
Build failed due to a bad Includes path in Release mode.
* Adds REG registration but breaks settings
This update will update the HKCU branch of the Registry for REG files: if the app in PowerToys is enabled, it adds a Preview item to the context menu of REG files and disabling in PowerToys removes the menu item.
While working on this, I noticed that the application settings were broken, after moving to a self-contained EXE: there must have been old settings from past builds, when it was still using containers and family names.
Added TODO's to add a new way to save settings, likely as JSON.
* Re-enabled app settings
Moved from using ApplicationDataContainer for app settings and now use simple JSON.
Also cleaned up handling the scenario where the Launcher send in the PID from PowerToys' main thread.
Fixed past spelling errors as well.
* Update RegistryPreview.png
Captured new screenshot.
* Integration into OOBE
Integrates new page for Registry Preview into OOBE process.
* Removing old comment and unneeded calls
Two bits of source removed as they aren't needed any longer
Removing a chunk of old commented out code that doesn't make sense anymore.
* Merging file from upstream
Updating some files due to three merge conflicts from upstream changes and a couple of other changes to keep up.
* Update .gitignore
Adding two vcxproj files that have local updates for atls.lib locations.
* Update Resources.resw
Fixing a typo that involved a missing closing tag.
* Fix analyzer warnings
* Fix CI build
* Fix ARM64 build
Project file cleanup
* Add to installer
* expect.txt
* Remove unneeded dll
* Update MainWindow.xaml.cs
Added check for current Theme and adjust TextBox Foreground accordingly.
* Update expect.txt
Cleaning up merge cruft.
* Revert wrong .gitignore changes
* Fix ARM installer
* Update Brushes for textBox to use Theme based versions
Finally figured out how to use the built-in, Theme-aware Brushes for the font colors in the onscreen textBox. Also have it aligning the font color for the hover state.
* Align configuration in PowerToys.sln
* [installer] Add missing files
* Fix bad merge
* Fixes for stefansjfw's review
Includes:
- two new strings for UX localization
- adds compatibility section for Windows 10
- fix to only track successful activations
- Removes two REG files that were there for examples
* Fixes from review from htcfreek
Updates:
- Fixed an issue where TextBox_TextChanged was firing when you simply opened a file.
- Added clamp to prevent files larger than 10MB from being opened.
- Added support in the UX to show Keys and Values that are deleted via the file
- Added support to specially handle Keys that start with - and Values that have =- in them (delete scenario)
- Changed AppBarButton icon for Edit from Rename to NewWindow
* Create deleted-folder32.png
* Added Registry Preview to GPO
* Update expect.txt
Updating spellchecker works
* Updating Size/Move code for better results
- Moved the size/move to the MainWindow layer
- Cleaned up the JSON settings handling to avoid an access denied on first run
* Improving text handling
Changed how special characters are parse, which helps with live entry.
* Updates to parsing and other fixes
- Renamed the value PNG for parity
- Added new error image
- Added check that values have " at start and finish.
- Added support for a new "ERROR" type for Values
- Fixed support for @ versus "@" in values
- Fixed bug where Save wasn't activating in all scernarios
* Fix signing and versioning
* Update src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* Apply suggestions from code review
Adds Launch button to the settings page.
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* Update Resources.resw
Adding strings for new launch button
* Adding new version for GPO
Moving to 0.69.0
* More parsing bug fixes
- Changes to look for [- instead of -[ for syntax deleting keys (fix for developer's mental hiccup)
- Moved [- to top of the decision making stack, as it needs to come before [
- Added new StripEscapedCharacters function for both sides of a Value line
- Fixed crashing bug for scenario where no Keys are parsed before a Value
* Bug fixes from most recent review.
- Dictionary will now be case insensitive when searching for keys
- Added tool tips (and strings) to the images of the Keys and Values
- Updated delete handling for Keys, so that only the leaf-most node gets marked as deleted; also stops the top most roots from being marked deleted.
* Tweaking for @=-
Forces the UX to take @=- and treat it as @="" since that's what Registry Editor would do.
* Removing unused usings
* Updates app description
* Update src/gpo/assets/PowerToys.admx
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* cleanup proj file
launch process only if module is enabled
add process to bugreport process list
* Add context menu icon
* Update src/modules/registrypreview/RegistryPreviewUI/MainWindow.Utilities.cs
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* Use modulesRegistry.h to apply/unapply registry changes
* Tweaked window settings
Moved the loading of the settings a little later in the initialization code, which gives more time for things to initialize.
* Update registry.h
Moving the definition out of the detail namespace to the registry name space to fix a compilation issue in RegistryPreviewExt.
* Unapply on creation
If module is disabled in settings.json, on startup reg entries should be unnaplied.
TODO: read m_enabled from settings file on creation
* Removing size/move main window
Added a TODO comment that responds to the size/position settings that are being saved out in the JSON blob on close as it doesn't always work on every PC, as the MainWindow initializes at different times.
* Change to always keep Save As active
No reason for this to be disabled, honestly.
---------
Co-authored-by: Clint Rutkas <clint@rutkas.com>
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-03-27 06:21:46 -07:00
|
|
|
case ESettingsWindowNames::RegistryPreview:
|
|
|
|
return "RegistryPreview";
|
2023-08-24 14:53:33 +02:00
|
|
|
case ESettingsWindowNames::CropAndLock:
|
|
|
|
return "CropAndLock";
|
2023-10-20 16:28:07 +02:00
|
|
|
case ESettingsWindowNames::EnvironmentVariables:
|
|
|
|
return "EnvironmentVariables";
|
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
|
|
|
case ESettingsWindowNames::Dashboard:
|
|
|
|
return "Dashboard";
|
2024-05-09 10:32:03 -04:00
|
|
|
case ESettingsWindowNames::AdvancedPaste:
|
|
|
|
return "AdvancedPaste";
|
2024-09-19 09:12:24 -07:00
|
|
|
case ESettingsWindowNames::NewPlus:
|
|
|
|
return "NewPlus";
|
Add the Command Palette module (#37908)
Windows Command Palette ("CmdPal") is the next iteration of PowerToys Run. With extensibility at its core, the Command Palette is your one-stop launcher to start _anything_.
By default, CmdPal is bound to <kbd>Win+Alt+Space</kbd>.


----
This brings the current preview version of CmdPal into the upstream PowerToys repo. There are still lots of bugs to work out, but it's reached the state we're ready to start sharing it with the world. From here, we can further collaborate with the community on the features that are important, and ensuring that we've got a most robust API to enable developers to build whatever extensions they want.
Most of the built-in PT Run modules have already been ported to CmdPal's extension API. Those include:
* Installed apps
* Shell commands
* File search (powered by the indexer)
* Windows Registry search
* Web search
* Windows Terminal Profiles
* Windows Services
* Windows settings
There are a couple new extensions built-in
* You can now search for packages on `winget` and install them right from the palette. This also powers searching for extensions for the palette
* The calculator has an entirely new implementation. This is currently less feature complete than the original PT Run one - we're looking forward to updating it to be more complete for future ingestion in Windows
* "Bookmarks" allow you to save shortcuts to files, folders, and webpages as top-level commands in the palette.
We've got a bunch of other samples too, in this repo and elsewhere
### PowerToys specific notes
CmdPal will eventually graduate out of PowerToys to live as its own application, which is why it's implemented just a little differently than most other modules. Enabling CmdPal will install its `msix` package.
The CI was minorly changed to support CmdPal version numbers independent of PowerToys itself. It doesn't make sense for us to start CmdPal at v0.90, and in the future, we want to be able to rev CmdPal independently of PT itself.
Closes #3200, closes #3600, closes #7770, closes #34273, closes #36471, closes #20976, closes #14495
-----
TODOs et al
**Blocking:**
- [ ] Images and descriptions in Settings and OOBE need to be properly defined, as mentioned before
- [ ] Niels is on it
- [x] Doesn't start properly from PowerToys unless the fix PR is merged.
- https://github.com/zadjii-msft/PowerToys/pull/556 merged
- [x] I seem to lose focus a lot when I press on some limits, like between the search bar and the results.
- This is https://github.com/zadjii-msft/PowerToys/issues/427
- [x] Turned off an extension like Calculator and it was still working.
- Need to get rid of that toggle, it doesn't do anything currently
- [x] `ListViewModel.<FetchItems>` crash
- Pretty confident that was fixed in https://github.com/zadjii-msft/PowerToys/pull/553
**Not blocking / improvements:**
- Show the shortcut through settings, as mentioned before, or create a button that would open CmdPalette settings.
- When PowerToys starts, CmdPalette is always shown if enabled. That's weird when just starting PowerToys/ logging in to the computer with PowerToys auto-start activated. I think this should at least be a setting.
- Needing to double press a result for it to do the default action seems quirky. If one is already selected, I think just pressing should be enough for it to do the action.
- This is currently a setting, though we're thinking of changing the setting even more: https://github.com/zadjii-msft/PowerToys/issues/392
- There's no URI extension. Was surprised when typing a URL that it only proposed a web search.
- [x] There's no System commands extension. Was expecting to be able to quickly restart the computer by typing restart but it wasn't there.
- This is in PR https://github.com/zadjii-msft/PowerToys/pull/452
---------
Co-authored-by: joadoumie <98557455+joadoumie@users.noreply.github.com>
Co-authored-by: Jordi Adoumie <jordiadoumie@microsoft.com>
Co-authored-by: Mike Griese <zadjii@gmail.com>
Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Michael Hawker <24302614+michael-hawker@users.noreply.github.com>
Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
Co-authored-by: Seraphima <zykovas91@gmail.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Kristen Schau <47155823+krschau@users.noreply.github.com>
Co-authored-by: Eric Johnson <ericjohnson327@gmail.com>
Co-authored-by: Ethan Fang <ethanfang@microsoft.com>
Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
Co-authored-by: Clint Rutkas <clint@rutkas.com>
2025-03-19 03:39:57 -05:00
|
|
|
case ESettingsWindowNames::CmdPal:
|
|
|
|
return "CmdPal";
|
2025-01-16 20:52:24 +00:00
|
|
|
case ESettingsWindowNames::ZoomIt:
|
|
|
|
return "ZoomIt";
|
2021-09-29 12:54:05 +02:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
Logger::error(L"Can't convert ESettingsWindowNames value={} to string", static_cast<int>(value));
|
|
|
|
assert(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
ESettingsWindowNames ESettingsWindowNames_from_string(std::string value)
|
|
|
|
{
|
|
|
|
if (value == "Overview")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::Overview;
|
|
|
|
}
|
|
|
|
else if (value == "Awake")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::Awake;
|
|
|
|
}
|
|
|
|
else if (value == "ColorPicker")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::ColorPicker;
|
|
|
|
}
|
|
|
|
else if (value == "FancyZones")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::FancyZones;
|
|
|
|
}
|
|
|
|
else if (value == "Run")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::Run;
|
|
|
|
}
|
|
|
|
else if (value == "ImageResizer")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::ImageResizer;
|
|
|
|
}
|
|
|
|
else if (value == "KBM")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::KBM;
|
|
|
|
}
|
2021-10-22 13:30:18 +01:00
|
|
|
else if (value == "MouseUtils")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::MouseUtils;
|
|
|
|
}
|
2021-09-29 12:54:05 +02:00
|
|
|
else if (value == "PowerRename")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::PowerRename;
|
|
|
|
}
|
|
|
|
else if (value == "FileExplorer")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::FileExplorer;
|
|
|
|
}
|
|
|
|
else if (value == "ShortcutGuide")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::ShortcutGuide;
|
|
|
|
}
|
2022-10-13 13:05:43 +02:00
|
|
|
else if (value == "Hosts")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::Hosts;
|
|
|
|
}
|
2023-05-02 13:10:54 +02:00
|
|
|
else if (value == "MeasureTool")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::MeasureTool;
|
|
|
|
}
|
2024-04-09 19:46:17 +01:00
|
|
|
else if (value == "PowerOcr")
|
2023-05-02 13:10:54 +02:00
|
|
|
{
|
|
|
|
return ESettingsWindowNames::PowerOCR;
|
|
|
|
}
|
[New Module] Workspaces (#34324)
* spell checker
* Adding OOBE Projects page
* changed the default hotkey
* module interface
* rename projects editor
* bug report tool
* installer
* gpo
* exit event constant
* extend search for projects by search over the containing apps' names
* [Projects] fix grammatical issue #43 (1 app - many apps)
* [Projects] Editor: Main page: fix layout if there are many apps, launch button not disappearing on the right side
* dsc
* github
* pipeline
* guid prefix
* [Projects] fixing general settings gpo handling in runner + minor changes
* arm build fix
* Do not allow saving project if name or applist is empty. Also minor UI changes
* version
* editor version
* spellcheck
* editor dll signing
* update projects names to filter them out
* shortcut saving fix
* [Projects] Editor: brining the highlighted app's icon into the foreground. + minor UI fixes
* spell checker
* spellcheck
* [Projects] re-implementing icon size calculation to have similar sized icons for every app.
* [projects] Adding info message for cases: there are no projects or no results for the search
* [Projects] Adding Edit button to the popup. + minor changes
* [Projects] Making popup having rounded corners
* changed "no projects" text color and position
* remove opening the first proj
* fix placing windows of the same app in the project
* [Projects] bringing back the breadcrumb on the editor page. Make it clickable.
* [Projects] optimizing click handlers
* [Projects] Removing not selected apps on save
* moved on thread executor to common
* moved display utils
* added convert rect
* unsigned monitor number
* set awareness
* app placement
* [Projects] Re-implementing preview drawing - one common image
* [Projects] fix boundary calculation, use DPI aware values
* fix launching with command line args
* Fix ARM64 CI build
* launch packaged apps using names when possible
* spell-check
* update packaged apps path
* projects editor single instance
* [Projects] Add Select all checkbox, Delete selected button
* Add Checkbox for per monitor selection
* modifying highlight in preview
* spell checker
* logs
* exclude help windows
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/49
* Add intermediate step to project creation
* minor bugfix
* mutex fix
* modifying highlight for minimized apps
* Fixing bug: re-draw the preview on app deletion in the editor
* Adding helper class for getting the right bounds for screens
* spell checker
* spell checker
* Minor fixes in the capture dialog
* get dpi unaware screen bounds
* refactoring: added utils
* changed window filter
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/2
* clean up
* refactoring
* projects common lib
* localizable default project prefix
* launcher resources
* clean up
* change snapshot project saving
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* changed project data
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* changed project creation save-cancel handles
https://github.com/JaneaSystems/PowerToys-DevProjects/issues/14
* spell-check
* Remove checkboxes, delete feature
* remove unused from the project
* get command line args in the snapshot
* minimized settings snap fix
* set window property after launching
* FZ: ignore projects launched windows
* Implementing major new features: remove button, position manipulation, arguments, admin, minimized, maximized
* modifying colors
* launcher project filters
* clean up
* Hide Admin checkbox
* hide WIP
* spell-check
* Revert "Hide Admin checkbox"
This reverts commit 3036df9d7fe48de6418b0ebeff6422d535cb25e2.
* get app elevated property
* Implementing Launch and Edit feature
* fixing: update of listed projects on the main page after hitting save in editor
* Fix for packaged app's icons
* fixing scroll speed issue
* change scroll speed to 15
* launch elevated apps
* minor fixes
* minor fix
* enhancing shortcut handling
* can-launch-elevated check
* projects module interface telemetry
* Implementing store of setting "order by".
* minor string correction
* moved projects data parsing
* telemetry
* add move apps checkbox
* notification about elevated apps
* restart unelevated
* move existing windows
* keep opened windows at the same positions
* handle powertoys settings
* use common theme
* fix corrupted data: project id and monitor id
* project launch on "launch and edit"
* clean up
* show screen numbers instead of monitor names
* launcher error messages
* fix default shortcut
* Adding launch button to projects settings, dashboard and flyout
* Adding new app which is launched when launching a project. It shows the status of the launch process
* spell checker
* Renaming Projects to App Layouts. Replacing only string values, not the variable names
* Re-ordering modules after Renaming Projects + spell checker
* setting window size according to the screen (making it bigger)
* commenting out feature "move apps if exist"
* spell checker
* Add ProjectsLauncherUI to signing
* opening apps in minimized state which are placed on a monitor, which is not found at the moment of launching
* consistent file name
* removed unused sln
* telemetry: create event
* WindowPosition comparison
* telemetry: edit event
* fix muted Launch as admin checkbox
* telemetry: delete event
* updated Edit telemetry event
* added invoke point to launcher args
* added utils
* parse invoke point
* replaced tuple with struct
* telemetry: launch event
* MonitorRect comparison
* resources
* rename: folders
* remove outdated
* rename: window property
* rename: files and folders
* rename: common data structures
* rename: telemetry namespace
* rename: workspaces data
* rename ProjectsLib -> WorkspacesLib
* rename: gpo
* rename: settings
* rename: launcher UI
* rename: other
* rename: pt run
* rename: fz
* rename: module interface
* rename: icon
* rename: snapshot tool
* rename: editor
* rename: common files
* rename: launcher
* rename: editor resources
* fix empty file crash
* rename: json
* rename: module interface
* fix custom actions build
* added launch editor event constant
* xaml formatting
* Add missing method defition to interop::Constants idl
Remove Any CPU config
* more .sln cleanup
* [Run][PowerToys] Fix Workspaces utility (#34336)
polished workspaces utility
* build fix - align CppWinRT version
* address PR comment: fix isdigit
* indentation
* address PR comment: rename function
* address PR comment: changed version for workspaces and revision
* added supported version definition
* addressPR comment: use BringToForeground
* address PR comments: updated projects
* address PR comment: uncomment gpo in settings
* address PR comment: rename oobe view
* update OOBE image with current module name
* moved AppUtils
* launching with AppUserModel.ID
* fixed module order in settings
* fix xaml formatting
* [Workspaces] Close launcher if there are failed launches. Plus adding new spinner gif
* fix topmost LauncherUI
* clean up
* UI closing
* BugReportTool - omit cmd arg data
* Delete icon on workspace removal
* Adding cancellation to launcher UI.
* reordered launching
* fix terminating UI
* Removing old shortcut on workspace renaming
* Sentence case labels
* get process path without waiting
* comment out unused
* remove unused argument
* logs
* New icon
* fix launch and edit for the new project
* fix launch and edit: save new project
* Update exe icons
---------
Co-authored-by: donlaci <laszlo@janeasystems.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
Co-authored-by: Niels Laute <niels.laute@live.nl>
2024-08-23 09:28:13 +02:00
|
|
|
else if (value == "Workspaces")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::Workspaces;
|
|
|
|
}
|
Registry Preview: complete feature with integration with Settings and the Launcher UX (#23709)
* Initial src for Registry Preview
Initial collection of files
* Update MainWindow.Utilities.cs
fixing a few spelling items
* Update expect.txt
* Update App.xaml.cs
* Update MainWindow.Events.cs
* Update MainWindow.Utilities.cs
* Update MainWindow.xaml.cs
* Update expect.txt
* Update MainWindow.Events.cs
* Rename AddPreviewtoRegfile.reg to AddPreviewToRegfile.reg
* Rename RemovePreviewtoRegfile.reg to RemovePreviewToRegfile.reg
* Update Resources.resw
* Update MainWindow.xaml
* Turns on self-contained mode
Updates the csproj file to compile the app as self-contained .
Includes fixes for code that expected the app to be in an ApplicationContainer.
Updates WindowsAppSDK from 1.1.5 to 1.2.230118.102.
* Updated to align with StyleCop errors
Multiple changes across the codebase that now aligns with StyleCop guidelines.
Tested again after the changes, to make sure no new bugs crept in.
* Added comments for spell-checker
Unclear if this side step should be done or not, but the kxz comes from a GUID and the other three names are constants.
* Adding code-custom.dic
Comments didn't work; trying a dic file
* Added four new terms to expects.txt file
Cleaning up attempt to update the spell-checker with dic file and moved it to expects.txt file
* Adding one more string
Adding one more string for Spell-Check
* Adding back egfile
Seems this is needed.
* Correcting a variable name
Seems one of the variable names that changed globally got missed in a XAML file.
* Update project to be more PowerToys friendly
Tweaking names and output file name to fit better with PowerToys.
* First pass at integration into Settings and Launcher
This PR is not as large as it seems:
- RegistryPreview's source moved around to a "better" directory that makes it look like the whole app changed. It didn't. In fact, I opened it in Beyond Compare and there's not much difference in the RegistryPreview app.
- Added RegistryPreviewExt that produces a DLL that the Launcher can run the EXE
- Changes to Runner calls the Ext DLL rather than the app
- Settings UI got a bunch of changes to enable the Settings page for enable/disable across ViewModels, Views, and string tables.
Still todo:
- Add "Preview" to .REG files, when the app is enable (and remove it when disabled)
- Update the thumbnail-screenshot in the Settings page
- Add support for OOBE
* Update expect.txt
Added REGISTRYPREVIEWEXT for recent changes and corrected an alphabetic sorting error.
* Updating project file for Release mode
Build failed due to a bad Includes path in Release mode.
* Adds REG registration but breaks settings
This update will update the HKCU branch of the Registry for REG files: if the app in PowerToys is enabled, it adds a Preview item to the context menu of REG files and disabling in PowerToys removes the menu item.
While working on this, I noticed that the application settings were broken, after moving to a self-contained EXE: there must have been old settings from past builds, when it was still using containers and family names.
Added TODO's to add a new way to save settings, likely as JSON.
* Re-enabled app settings
Moved from using ApplicationDataContainer for app settings and now use simple JSON.
Also cleaned up handling the scenario where the Launcher send in the PID from PowerToys' main thread.
Fixed past spelling errors as well.
* Update RegistryPreview.png
Captured new screenshot.
* Integration into OOBE
Integrates new page for Registry Preview into OOBE process.
* Removing old comment and unneeded calls
Two bits of source removed as they aren't needed any longer
Removing a chunk of old commented out code that doesn't make sense anymore.
* Merging file from upstream
Updating some files due to three merge conflicts from upstream changes and a couple of other changes to keep up.
* Update .gitignore
Adding two vcxproj files that have local updates for atls.lib locations.
* Update Resources.resw
Fixing a typo that involved a missing closing tag.
* Fix analyzer warnings
* Fix CI build
* Fix ARM64 build
Project file cleanup
* Add to installer
* expect.txt
* Remove unneeded dll
* Update MainWindow.xaml.cs
Added check for current Theme and adjust TextBox Foreground accordingly.
* Update expect.txt
Cleaning up merge cruft.
* Revert wrong .gitignore changes
* Fix ARM installer
* Update Brushes for textBox to use Theme based versions
Finally figured out how to use the built-in, Theme-aware Brushes for the font colors in the onscreen textBox. Also have it aligning the font color for the hover state.
* Align configuration in PowerToys.sln
* [installer] Add missing files
* Fix bad merge
* Fixes for stefansjfw's review
Includes:
- two new strings for UX localization
- adds compatibility section for Windows 10
- fix to only track successful activations
- Removes two REG files that were there for examples
* Fixes from review from htcfreek
Updates:
- Fixed an issue where TextBox_TextChanged was firing when you simply opened a file.
- Added clamp to prevent files larger than 10MB from being opened.
- Added support in the UX to show Keys and Values that are deleted via the file
- Added support to specially handle Keys that start with - and Values that have =- in them (delete scenario)
- Changed AppBarButton icon for Edit from Rename to NewWindow
* Create deleted-folder32.png
* Added Registry Preview to GPO
* Update expect.txt
Updating spellchecker works
* Updating Size/Move code for better results
- Moved the size/move to the MainWindow layer
- Cleaned up the JSON settings handling to avoid an access denied on first run
* Improving text handling
Changed how special characters are parse, which helps with live entry.
* Updates to parsing and other fixes
- Renamed the value PNG for parity
- Added new error image
- Added check that values have " at start and finish.
- Added support for a new "ERROR" type for Values
- Fixed support for @ versus "@" in values
- Fixed bug where Save wasn't activating in all scernarios
* Fix signing and versioning
* Update src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* Apply suggestions from code review
Adds Launch button to the settings page.
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* Update Resources.resw
Adding strings for new launch button
* Adding new version for GPO
Moving to 0.69.0
* More parsing bug fixes
- Changes to look for [- instead of -[ for syntax deleting keys (fix for developer's mental hiccup)
- Moved [- to top of the decision making stack, as it needs to come before [
- Added new StripEscapedCharacters function for both sides of a Value line
- Fixed crashing bug for scenario where no Keys are parsed before a Value
* Bug fixes from most recent review.
- Dictionary will now be case insensitive when searching for keys
- Added tool tips (and strings) to the images of the Keys and Values
- Updated delete handling for Keys, so that only the leaf-most node gets marked as deleted; also stops the top most roots from being marked deleted.
* Tweaking for @=-
Forces the UX to take @=- and treat it as @="" since that's what Registry Editor would do.
* Removing unused usings
* Updates app description
* Update src/gpo/assets/PowerToys.admx
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* cleanup proj file
launch process only if module is enabled
add process to bugreport process list
* Add context menu icon
* Update src/modules/registrypreview/RegistryPreviewUI/MainWindow.Utilities.cs
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
* Use modulesRegistry.h to apply/unapply registry changes
* Tweaked window settings
Moved the loading of the settings a little later in the initialization code, which gives more time for things to initialize.
* Update registry.h
Moving the definition out of the detail namespace to the registry name space to fix a compilation issue in RegistryPreviewExt.
* Unapply on creation
If module is disabled in settings.json, on startup reg entries should be unnaplied.
TODO: read m_enabled from settings file on creation
* Removing size/move main window
Added a TODO comment that responds to the size/position settings that are being saved out in the JSON blob on close as it doesn't always work on every PC, as the MainWindow initializes at different times.
* Change to always keep Save As active
No reason for this to be disabled, honestly.
---------
Co-authored-by: Clint Rutkas <clint@rutkas.com>
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
2023-03-27 06:21:46 -07:00
|
|
|
else if (value == "RegistryPreview")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::RegistryPreview;
|
|
|
|
}
|
2023-08-24 14:53:33 +02:00
|
|
|
else if (value == "CropAndLock")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::CropAndLock;
|
|
|
|
}
|
2023-10-20 16:28:07 +02:00
|
|
|
else if (value == "EnvironmentVariables")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::EnvironmentVariables;
|
|
|
|
}
|
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
|
|
|
else if (value == "Dashboard")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::Dashboard;
|
|
|
|
}
|
2024-05-09 10:32:03 -04:00
|
|
|
else if (value == "AdvancedPaste")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::AdvancedPaste;
|
|
|
|
}
|
2024-09-19 09:12:24 -07:00
|
|
|
else if (value == "NewPlus")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::NewPlus;
|
|
|
|
}
|
Add the Command Palette module (#37908)
Windows Command Palette ("CmdPal") is the next iteration of PowerToys Run. With extensibility at its core, the Command Palette is your one-stop launcher to start _anything_.
By default, CmdPal is bound to <kbd>Win+Alt+Space</kbd>.


----
This brings the current preview version of CmdPal into the upstream PowerToys repo. There are still lots of bugs to work out, but it's reached the state we're ready to start sharing it with the world. From here, we can further collaborate with the community on the features that are important, and ensuring that we've got a most robust API to enable developers to build whatever extensions they want.
Most of the built-in PT Run modules have already been ported to CmdPal's extension API. Those include:
* Installed apps
* Shell commands
* File search (powered by the indexer)
* Windows Registry search
* Web search
* Windows Terminal Profiles
* Windows Services
* Windows settings
There are a couple new extensions built-in
* You can now search for packages on `winget` and install them right from the palette. This also powers searching for extensions for the palette
* The calculator has an entirely new implementation. This is currently less feature complete than the original PT Run one - we're looking forward to updating it to be more complete for future ingestion in Windows
* "Bookmarks" allow you to save shortcuts to files, folders, and webpages as top-level commands in the palette.
We've got a bunch of other samples too, in this repo and elsewhere
### PowerToys specific notes
CmdPal will eventually graduate out of PowerToys to live as its own application, which is why it's implemented just a little differently than most other modules. Enabling CmdPal will install its `msix` package.
The CI was minorly changed to support CmdPal version numbers independent of PowerToys itself. It doesn't make sense for us to start CmdPal at v0.90, and in the future, we want to be able to rev CmdPal independently of PT itself.
Closes #3200, closes #3600, closes #7770, closes #34273, closes #36471, closes #20976, closes #14495
-----
TODOs et al
**Blocking:**
- [ ] Images and descriptions in Settings and OOBE need to be properly defined, as mentioned before
- [ ] Niels is on it
- [x] Doesn't start properly from PowerToys unless the fix PR is merged.
- https://github.com/zadjii-msft/PowerToys/pull/556 merged
- [x] I seem to lose focus a lot when I press on some limits, like between the search bar and the results.
- This is https://github.com/zadjii-msft/PowerToys/issues/427
- [x] Turned off an extension like Calculator and it was still working.
- Need to get rid of that toggle, it doesn't do anything currently
- [x] `ListViewModel.<FetchItems>` crash
- Pretty confident that was fixed in https://github.com/zadjii-msft/PowerToys/pull/553
**Not blocking / improvements:**
- Show the shortcut through settings, as mentioned before, or create a button that would open CmdPalette settings.
- When PowerToys starts, CmdPalette is always shown if enabled. That's weird when just starting PowerToys/ logging in to the computer with PowerToys auto-start activated. I think this should at least be a setting.
- Needing to double press a result for it to do the default action seems quirky. If one is already selected, I think just pressing should be enough for it to do the action.
- This is currently a setting, though we're thinking of changing the setting even more: https://github.com/zadjii-msft/PowerToys/issues/392
- There's no URI extension. Was surprised when typing a URL that it only proposed a web search.
- [x] There's no System commands extension. Was expecting to be able to quickly restart the computer by typing restart but it wasn't there.
- This is in PR https://github.com/zadjii-msft/PowerToys/pull/452
---------
Co-authored-by: joadoumie <98557455+joadoumie@users.noreply.github.com>
Co-authored-by: Jordi Adoumie <jordiadoumie@microsoft.com>
Co-authored-by: Mike Griese <zadjii@gmail.com>
Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Michael Hawker <24302614+michael-hawker@users.noreply.github.com>
Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
Co-authored-by: Seraphima <zykovas91@gmail.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Kristen Schau <47155823+krschau@users.noreply.github.com>
Co-authored-by: Eric Johnson <ericjohnson327@gmail.com>
Co-authored-by: Ethan Fang <ethanfang@microsoft.com>
Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
Co-authored-by: Clint Rutkas <clint@rutkas.com>
2025-03-19 03:39:57 -05:00
|
|
|
else if (value == "CmdPal")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::CmdPal;
|
|
|
|
}
|
2025-01-16 20:52:24 +00:00
|
|
|
else if (value == "ZoomIt")
|
|
|
|
{
|
|
|
|
return ESettingsWindowNames::ZoomIt;
|
|
|
|
}
|
2021-09-29 12:54:05 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Logger::error(L"Can't convert string value={} to ESettingsWindowNames", winrt::to_hstring(value));
|
|
|
|
assert(false);
|
|
|
|
}
|
|
|
|
|
[Settings]Adding a Dashboard Panel (#29023)
* Dashboard: modifying page content + adding SW version button.
* Visual tweaks and minor viewmodel changes
* Updated spacing
* Adding Settings icon
* Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts.
* fixing csproj file
* Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules).
* Removing unneccessary binding
* Fix text wrapping
* Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description.
* Spell checker fix typo
* Adding GPO-blocked state, modifying buttons: adding description, icon.
* Modifying dashboard button layout
* Use SettingsCard instead of button
* Restructuring the dashboard panel
* Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM)
* Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts.
* Refactoring dashboard
* Making list always visible and fixing scrolling behavior
* Adding background gradient to cards
* Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled.
* Use ListView instead of ItemsRepeater
* Updates
* removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules.
* Separate lists
* Adding Flyout with key remappings for KBM module, adding IsLocked property, icons
* Visual tweaks
* Tweaks
* Fixing lock icon margin
* Minor fixes.
* Removing unused resources
* Make Dashboard default when coming from the OOBE General
* Removed the Previous, Next Layout buttons from FancyZones. Added activation information
---------
Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 14:23:25 +02:00
|
|
|
return ESettingsWindowNames::Dashboard;
|
2021-09-29 12:54:05 +02:00
|
|
|
}
|