mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-25 13:37:22 +01:00
Compare commits
2 Commits
shawn/AddT
...
copilot/su
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa4c13e9f6 | ||
|
|
a6e34ab34a |
7
.github/actions/spell-check/expect.txt
vendored
7
.github/actions/spell-check/expect.txt
vendored
@@ -103,6 +103,7 @@ ASYNCWINDOWPLACEMENT
|
||||
ASYNCWINDOWPOS
|
||||
atl
|
||||
ATRIOX
|
||||
ATX
|
||||
aumid
|
||||
authenticode
|
||||
AUTOBUDDY
|
||||
@@ -297,6 +298,7 @@ cpcontrols
|
||||
cph
|
||||
cplusplus
|
||||
CPower
|
||||
cppcoreguidelines
|
||||
cpptools
|
||||
cppvsdbg
|
||||
cppwinrt
|
||||
@@ -325,7 +327,7 @@ CURRENTDIR
|
||||
CURSORINFO
|
||||
cursorpos
|
||||
CURSORSHOWING
|
||||
cursorwrap
|
||||
CURSORWRAP
|
||||
customaction
|
||||
CUSTOMACTIONTEST
|
||||
CUSTOMFORMATPLACEHOLDER
|
||||
@@ -886,7 +888,6 @@ Ldr
|
||||
LEFTALIGN
|
||||
LEFTSCROLLBAR
|
||||
LEFTTEXT
|
||||
leftclick
|
||||
LError
|
||||
LEVELID
|
||||
LExit
|
||||
@@ -1012,7 +1013,6 @@ MENUITEMINFO
|
||||
MENUITEMINFOW
|
||||
MERGECOPY
|
||||
MERGEPAINT
|
||||
Metacharacter
|
||||
metadatamatters
|
||||
Metadatas
|
||||
metafile
|
||||
@@ -1760,6 +1760,7 @@ SUBMODULEUPDATE
|
||||
subresource
|
||||
Superbar
|
||||
sut
|
||||
swe
|
||||
svchost
|
||||
SVGIn
|
||||
SVGIO
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
|
||||
<RegistryValue Type="string" Name="Module_CmdPal" Value="" KeyPath="yes" />
|
||||
</RegistryKey>
|
||||
<RemoveFile Id="RemoveOldCmdPalMsix" Name="Microsoft.CmdPal.UI_*.msix" On="install" />
|
||||
<?if $(sys.BUILDARCH) = x64 ?>
|
||||
<File Id="Microsoft.CmdPal.UI___var.CmdPalVersion_._x64.msix" Source="$(var.CmdPalBuildDir)AppPackages\Microsoft.CmdPal.UI_$(var.CmdPalVersion)_Test\Microsoft.CmdPal.UI_$(var.CmdPalVersion)_x64.msix" />
|
||||
<?else?>
|
||||
|
||||
@@ -16,50 +16,13 @@ DWORD WINAPI _checkTheme(LPVOID lpParam)
|
||||
|
||||
void ThemeListener::AddChangedHandler(THEME_HANDLE handle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(handlesMutex);
|
||||
handles.push_back(handle);
|
||||
}
|
||||
|
||||
void ThemeListener::DelChangedHandler(THEME_HANDLE handle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(handlesMutex);
|
||||
auto it = std::find(handles.begin(), handles.end(), handle);
|
||||
if (it != handles.end())
|
||||
{
|
||||
handles.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void ThemeListener::AddAppThemeChangedHandler(THEME_HANDLE handle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(handlesMutex);
|
||||
appThemeHandles.push_back(handle);
|
||||
}
|
||||
|
||||
void ThemeListener::DelAppThemeChangedHandler(THEME_HANDLE handle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(handlesMutex);
|
||||
auto it = std::find(appThemeHandles.begin(), appThemeHandles.end(), handle);
|
||||
if (it != appThemeHandles.end())
|
||||
{
|
||||
appThemeHandles.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void ThemeListener::AddSystemThemeChangedHandler(THEME_HANDLE handle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(handlesMutex);
|
||||
systemThemeHandles.push_back(handle);
|
||||
}
|
||||
|
||||
void ThemeListener::DelSystemThemeChangedHandler(THEME_HANDLE handle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(handlesMutex);
|
||||
auto it = std::find(systemThemeHandles.begin(), systemThemeHandles.end(), handle);
|
||||
if (it != systemThemeHandles.end())
|
||||
{
|
||||
systemThemeHandles.erase(it);
|
||||
}
|
||||
handles.erase(it);
|
||||
}
|
||||
|
||||
void ThemeListener::CheckTheme()
|
||||
@@ -85,51 +48,13 @@ void ThemeListener::CheckTheme()
|
||||
|
||||
WaitForSingleObject(hEvent, INFINITE);
|
||||
|
||||
auto _appTheme = ThemeHelpers::GetAppTheme();
|
||||
auto _systemTheme = ThemeHelpers::GetSystemTheme();
|
||||
|
||||
bool appThemeChanged = (AppTheme != _appTheme);
|
||||
bool systemThemeChanged = (SystemTheme != _systemTheme);
|
||||
|
||||
if (appThemeChanged || systemThemeChanged)
|
||||
auto _theme = ThemeHelpers::GetAppTheme();
|
||||
if (AppTheme != _theme)
|
||||
{
|
||||
AppTheme = _appTheme;
|
||||
SystemTheme = _systemTheme;
|
||||
|
||||
// Copy handlers under lock, then invoke outside lock to avoid deadlock
|
||||
std::vector<THEME_HANDLE> handlesCopy;
|
||||
std::vector<THEME_HANDLE> appThemeHandlesCopy;
|
||||
std::vector<THEME_HANDLE> systemThemeHandlesCopy;
|
||||
|
||||
AppTheme = _theme;
|
||||
for (int i = 0; i < handles.size(); i++)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(handlesMutex);
|
||||
handlesCopy = handles;
|
||||
if (appThemeChanged)
|
||||
{
|
||||
appThemeHandlesCopy = appThemeHandles;
|
||||
}
|
||||
if (systemThemeChanged)
|
||||
{
|
||||
systemThemeHandlesCopy = systemThemeHandles;
|
||||
}
|
||||
}
|
||||
|
||||
// Call generic handlers (backward compatible)
|
||||
for (const auto& handler : handlesCopy)
|
||||
{
|
||||
handler();
|
||||
}
|
||||
|
||||
// Call app theme specific handlers
|
||||
for (const auto& handler : appThemeHandlesCopy)
|
||||
{
|
||||
handler();
|
||||
}
|
||||
|
||||
// Call system theme specific handlers
|
||||
for (const auto& handler : systemThemeHandlesCopy)
|
||||
{
|
||||
handler();
|
||||
handles[i]();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <windows.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
|
||||
typedef void (*THEME_HANDLE)();
|
||||
DWORD WINAPI _checkTheme(LPVOID lpParam);
|
||||
@@ -15,7 +14,6 @@ public:
|
||||
ThemeListener()
|
||||
{
|
||||
AppTheme = ThemeHelpers::GetAppTheme();
|
||||
SystemTheme = ThemeHelpers::GetSystemTheme();
|
||||
dwThreadHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)_checkTheme, this, 0, &dwThreadId);
|
||||
}
|
||||
~ThemeListener()
|
||||
@@ -25,20 +23,12 @@ public:
|
||||
}
|
||||
|
||||
Theme AppTheme;
|
||||
Theme SystemTheme;
|
||||
void ThemeListener::AddChangedHandler(THEME_HANDLE handle);
|
||||
void ThemeListener::DelChangedHandler(THEME_HANDLE handle);
|
||||
void ThemeListener::AddAppThemeChangedHandler(THEME_HANDLE handle);
|
||||
void ThemeListener::DelAppThemeChangedHandler(THEME_HANDLE handle);
|
||||
void ThemeListener::AddSystemThemeChangedHandler(THEME_HANDLE handle);
|
||||
void ThemeListener::DelSystemThemeChangedHandler(THEME_HANDLE handle);
|
||||
void CheckTheme();
|
||||
|
||||
private:
|
||||
HANDLE dwThreadHandle;
|
||||
DWORD dwThreadId;
|
||||
std::vector<THEME_HANDLE> handles;
|
||||
std::vector<THEME_HANDLE> appThemeHandles;
|
||||
std::vector<THEME_HANDLE> systemThemeHandles;
|
||||
mutable std::mutex handlesMutex;
|
||||
};
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <appxpackaging.h>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
@@ -338,30 +337,6 @@ namespace package
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by package version in descending order (newest first)
|
||||
std::sort(matchedFiles.begin(), matchedFiles.end(), [](const std::wstring& a, const std::wstring& b) {
|
||||
std::wstring nameA, nameB;
|
||||
PACKAGE_VERSION versionA{}, versionB{};
|
||||
|
||||
bool gotA = GetPackageNameAndVersionFromAppx(a, nameA, versionA);
|
||||
bool gotB = GetPackageNameAndVersionFromAppx(b, nameB, versionB);
|
||||
|
||||
// Files that failed to parse go to the end
|
||||
if (!gotA)
|
||||
return false;
|
||||
if (!gotB)
|
||||
return true;
|
||||
|
||||
// Compare versions: Major, Minor, Build, Revision (descending)
|
||||
if (versionA.Major != versionB.Major)
|
||||
return versionA.Major > versionB.Major;
|
||||
if (versionA.Minor != versionB.Minor)
|
||||
return versionA.Minor > versionB.Minor;
|
||||
if (versionA.Build != versionB.Build)
|
||||
return versionA.Build > versionB.Build;
|
||||
return versionA.Revision > versionB.Revision;
|
||||
});
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
|
||||
@@ -98,16 +98,18 @@ public sealed partial class AppListItem : ListItem
|
||||
}
|
||||
else
|
||||
{
|
||||
// do nothing if we fail to load an icon.
|
||||
// Logging it would be too NOISY, there's really no need.
|
||||
if (!string.IsNullOrEmpty(_app.IcoPath))
|
||||
try
|
||||
{
|
||||
heroImage = await TryLoadThumbnail(_app.IcoPath, jumbo: true, logOnFailure: false);
|
||||
var stream = await ThumbnailHelper.GetThumbnail(_app.ExePath, true);
|
||||
if (stream is not null)
|
||||
{
|
||||
heroImage = IconInfo.FromStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
if (heroImage == null && !string.IsNullOrEmpty(_app.ExePath))
|
||||
catch (Exception)
|
||||
{
|
||||
heroImage = await TryLoadThumbnail(_app.ExePath, jumbo: true, logOnFailure: false);
|
||||
// do nothing if we fail to load an icon.
|
||||
// Logging it would be too NOISY, there's really no need.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,18 +132,25 @@ public sealed partial class AppListItem : ListItem
|
||||
|
||||
if (useThumbnails)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_app.IcoPath))
|
||||
try
|
||||
{
|
||||
icon = await TryLoadThumbnail(_app.IcoPath, jumbo: false, logOnFailure: true);
|
||||
var stream = await ThumbnailHelper.GetThumbnail(_app.ExePath);
|
||||
if (stream is not null)
|
||||
{
|
||||
icon = IconInfo.FromStream(stream);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogDebug($"Failed to load icon for {AppIdentifier}:\n{ex}");
|
||||
}
|
||||
|
||||
if (icon == null && !string.IsNullOrEmpty(_app.ExePath))
|
||||
{
|
||||
icon = await TryLoadThumbnail(_app.ExePath, jumbo: false, logOnFailure: true);
|
||||
}
|
||||
icon = icon ?? new IconInfo(_app.IcoPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = new IconInfo(_app.IcoPath);
|
||||
}
|
||||
|
||||
icon ??= new IconInfo(_app.IcoPath);
|
||||
|
||||
return icon;
|
||||
}
|
||||
@@ -174,25 +183,4 @@ public sealed partial class AppListItem : ListItem
|
||||
|
||||
return newCommands.ToArray();
|
||||
}
|
||||
|
||||
private async Task<IconInfo?> TryLoadThumbnail(string path, bool jumbo, bool logOnFailure)
|
||||
{
|
||||
try
|
||||
{
|
||||
var stream = await ThumbnailHelper.GetThumbnail(path, jumbo);
|
||||
if (stream is not null)
|
||||
{
|
||||
return IconInfo.FromStream(stream);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (logOnFailure)
|
||||
{
|
||||
Logger.LogDebug($"Failed to load icon {path} for {AppIdentifier}:\n{ex}");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1052,6 +1052,9 @@ public class Win32Program : IProgram
|
||||
app.FullPath) :
|
||||
app.IcoPath;
|
||||
|
||||
icoPath = icoPath.EndsWith(".lnk", System.StringComparison.InvariantCultureIgnoreCase) ?
|
||||
app.FullPath :
|
||||
icoPath;
|
||||
return new AppItem()
|
||||
{
|
||||
Name = app.Name,
|
||||
|
||||
@@ -173,10 +173,6 @@
|
||||
<value>Settings\tDouble-click</value>
|
||||
<comment>Don't localize "\t" as that is what separates the click portion to be right aligned in the menu.</comment>
|
||||
</data>
|
||||
<data name="SETTINGS_MENU_TEXT_LEFTCLICK" xml:space="preserve">
|
||||
<value>Settings\tLeft-click</value>
|
||||
<comment>Don't localize "\t" as that is what separates the click portion to be right aligned in the menu. This is shown when Quick Access is disabled.</comment>
|
||||
</data>
|
||||
<data name="DOCUMENTATION_MENU_TEXT" xml:space="preserve">
|
||||
<value>Documentation</value>
|
||||
</data>
|
||||
|
||||
@@ -81,36 +81,3 @@ void Trace::UpdateDownloadCompleted(bool success, const std::wstring& version)
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::TrayIconLeftClick(bool quickAccessEnabled)
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"TrayIcon_LeftClick",
|
||||
TraceLoggingBoolean(quickAccessEnabled, "QuickAccessEnabled"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::TrayIconDoubleClick(bool quickAccessEnabled)
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"TrayIcon_DoubleClick",
|
||||
TraceLoggingBoolean(quickAccessEnabled, "QuickAccessEnabled"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
void Trace::TrayIconRightClick(bool quickAccessEnabled)
|
||||
{
|
||||
TraceLoggingWriteWrapper(
|
||||
g_hProvider,
|
||||
"TrayIcon_RightClick",
|
||||
TraceLoggingBoolean(quickAccessEnabled, "QuickAccessEnabled"),
|
||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||
}
|
||||
|
||||
@@ -13,9 +13,4 @@ public:
|
||||
// Auto-update telemetry
|
||||
static void UpdateCheckCompleted(bool success, bool updateAvailable, const std::wstring& fromVersion, const std::wstring& toVersion);
|
||||
static void UpdateDownloadCompleted(bool success, const std::wstring& version);
|
||||
|
||||
// Tray icon interaction telemetry
|
||||
static void TrayIconLeftClick(bool quickAccessEnabled);
|
||||
static void TrayIconDoubleClick(bool quickAccessEnabled);
|
||||
static void TrayIconRightClick(bool quickAccessEnabled);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "centralized_kb_hook.h"
|
||||
#include "quick_access_host.h"
|
||||
#include "hotkey_conflict_detector.h"
|
||||
#include "trace.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#include <common/utils/resources.h>
|
||||
@@ -15,7 +14,6 @@
|
||||
#include <common/logger/logger.h>
|
||||
#include <common/utils/elevation.h>
|
||||
#include <common/Themes/theme_listener.h>
|
||||
#include <common/Themes/theme_helpers.h>
|
||||
#include "bug_report.h"
|
||||
|
||||
namespace
|
||||
@@ -41,7 +39,6 @@ namespace
|
||||
bool double_click_timer_running = false;
|
||||
bool double_clicked = false;
|
||||
POINT tray_icon_click_point;
|
||||
std::optional<bool> last_quick_access_state; // Track the last known Quick Access state
|
||||
|
||||
static ThemeListener theme_listener;
|
||||
static bool theme_adaptive_enabled = false;
|
||||
@@ -132,9 +129,6 @@ void click_timer_elapsed()
|
||||
double_click_timer_running = false;
|
||||
if (!double_clicked)
|
||||
{
|
||||
// Log telemetry for single click (confirmed it's not a double click)
|
||||
Trace::TrayIconLeftClick(get_general_settings().enableQuickAccess);
|
||||
|
||||
if (get_general_settings().enableQuickAccess)
|
||||
{
|
||||
open_quick_access_flyout_window();
|
||||
@@ -200,21 +194,6 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam
|
||||
case WM_RBUTTONUP:
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
bool quick_access_enabled = get_general_settings().enableQuickAccess;
|
||||
|
||||
// Log telemetry
|
||||
Trace::TrayIconRightClick(quick_access_enabled);
|
||||
|
||||
// Reload menu if Quick Access state has changed or is first time
|
||||
if (h_menu && (!last_quick_access_state.has_value() || quick_access_enabled != last_quick_access_state.value()))
|
||||
{
|
||||
DestroyMenu(h_menu);
|
||||
h_menu = nullptr;
|
||||
h_sub_menu = nullptr;
|
||||
}
|
||||
|
||||
last_quick_access_state = quick_access_enabled;
|
||||
|
||||
if (!h_menu)
|
||||
{
|
||||
h_menu = LoadMenu(reinterpret_cast<HINSTANCE>(&__ImageBase), MAKEINTRESOURCE(ID_TRAY_MENU));
|
||||
@@ -222,39 +201,17 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam
|
||||
if (h_menu)
|
||||
{
|
||||
static std::wstring settings_menuitem_label = GET_RESOURCE_STRING(IDS_SETTINGS_MENU_TEXT);
|
||||
static std::wstring settings_menuitem_label_leftclick = GET_RESOURCE_STRING(IDS_SETTINGS_MENU_TEXT_LEFTCLICK);
|
||||
static std::wstring close_menuitem_label = GET_RESOURCE_STRING(IDS_CLOSE_MENU_TEXT);
|
||||
static std::wstring submit_bug_menuitem_label = GET_RESOURCE_STRING(IDS_SUBMIT_BUG_TEXT);
|
||||
static std::wstring documentation_menuitem_label = GET_RESOURCE_STRING(IDS_DOCUMENTATION_MENU_TEXT);
|
||||
static std::wstring quick_access_menuitem_label = GET_RESOURCE_STRING(IDS_QUICK_ACCESS_MENU_TEXT);
|
||||
|
||||
// Update Settings menu text based on Quick Access state
|
||||
if (quick_access_enabled)
|
||||
{
|
||||
change_menu_item_text(ID_SETTINGS_MENU_COMMAND, settings_menuitem_label.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
change_menu_item_text(ID_SETTINGS_MENU_COMMAND, settings_menuitem_label_leftclick.data());
|
||||
}
|
||||
|
||||
change_menu_item_text(ID_SETTINGS_MENU_COMMAND, settings_menuitem_label.data());
|
||||
change_menu_item_text(ID_CLOSE_MENU_COMMAND, close_menuitem_label.data());
|
||||
change_menu_item_text(ID_REPORT_BUG_COMMAND, submit_bug_menuitem_label.data());
|
||||
bool bug_report_disabled = is_bug_report_running();
|
||||
EnableMenuItem(h_sub_menu, ID_REPORT_BUG_COMMAND, MF_BYCOMMAND | (bug_report_disabled ? MF_GRAYED : MF_ENABLED));
|
||||
change_menu_item_text(ID_DOCUMENTATION_MENU_COMMAND, documentation_menuitem_label.data());
|
||||
change_menu_item_text(ID_QUICK_ACCESS_MENU_COMMAND, quick_access_menuitem_label.data());
|
||||
|
||||
// Hide or show Quick Access menu item based on setting
|
||||
if (!h_sub_menu)
|
||||
{
|
||||
h_sub_menu = GetSubMenu(h_menu, 0);
|
||||
}
|
||||
if (!quick_access_enabled)
|
||||
{
|
||||
// Remove Quick Access menu item when disabled
|
||||
DeleteMenu(h_sub_menu, ID_QUICK_ACCESS_MENU_COMMAND, MF_BYCOMMAND);
|
||||
}
|
||||
}
|
||||
if (!h_sub_menu)
|
||||
{
|
||||
@@ -285,9 +242,6 @@ LRESULT __stdcall tray_icon_window_proc(HWND window, UINT message, WPARAM wparam
|
||||
}
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
// Log telemetry
|
||||
Trace::TrayIconDoubleClick(get_general_settings().enableQuickAccess);
|
||||
|
||||
double_clicked = true;
|
||||
open_settings_window(std::nullopt);
|
||||
break;
|
||||
@@ -339,7 +293,7 @@ static void handle_theme_change()
|
||||
{
|
||||
if (theme_adaptive_enabled)
|
||||
{
|
||||
tray_icon_data.hIcon = get_icon(ThemeHelpers::GetSystemTheme());
|
||||
tray_icon_data.hIcon = get_icon(theme_listener.AppTheme);
|
||||
Shell_NotifyIcon(NIM_MODIFY, &tray_icon_data);
|
||||
}
|
||||
}
|
||||
@@ -356,7 +310,7 @@ void start_tray_icon(bool isProcessElevated, bool theme_adaptive)
|
||||
{
|
||||
theme_adaptive_enabled = theme_adaptive;
|
||||
auto h_instance = reinterpret_cast<HINSTANCE>(&__ImageBase);
|
||||
HICON const icon = theme_adaptive ? get_icon(ThemeHelpers::GetSystemTheme()) : LoadIcon(h_instance, MAKEINTRESOURCE(APPICON));
|
||||
HICON const icon = theme_adaptive ? get_icon(theme_listener.AppTheme) : LoadIcon(h_instance, MAKEINTRESOURCE(APPICON));
|
||||
if (icon)
|
||||
{
|
||||
UINT id_tray_icon = 1;
|
||||
@@ -403,7 +357,7 @@ void start_tray_icon(bool isProcessElevated, bool theme_adaptive)
|
||||
ChangeWindowMessageFilterEx(hwnd, WM_COMMAND, MSGFLT_ALLOW, nullptr);
|
||||
|
||||
tray_icon_created = Shell_NotifyIcon(NIM_ADD, &tray_icon_data) == TRUE;
|
||||
theme_listener.AddSystemThemeChangedHandler(&handle_theme_change);
|
||||
theme_listener.AddChangedHandler(&handle_theme_change);
|
||||
|
||||
// Register callback to update bug report menu item status
|
||||
BugReportManager::instance().register_callback([](bool isRunning) {
|
||||
@@ -435,7 +389,7 @@ void set_tray_icon_theme_adaptive(bool theme_adaptive)
|
||||
|
||||
if (theme_adaptive)
|
||||
{
|
||||
icon = get_icon(ThemeHelpers::GetSystemTheme());
|
||||
icon = get_icon(theme_listener.AppTheme);
|
||||
if (!icon)
|
||||
{
|
||||
Logger::warn(L"set_tray_icon_theme_adaptive: Failed to load theme adaptive icon, falling back to default");
|
||||
|
||||
Reference in New Issue
Block a user