Skip to content

armgit / WacOS

Public Imported from GitHub
0

A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.

Rust

Issue #368: Chrome uses the theme icon unless two profiles are in the Dock

Eternity070628b73603411004
diff --git a/src/shell/apps.cpp b/src/shell/apps.cpp
index ae6dd82..1a644cc 100644
--- a/src/shell/apps.cpp
+++ b/src/shell/apps.cpp
@@ -540,6 +540,15 @@ bool apps::Refresh() {
std::wstring after;
for (auto& a : list) after += a.id + L"|" + std::to_wstring(a.wins.size()) + (a.recent ? L"r" : L"") + L";";
for (auto& a : list) for (auto& w : a.wins) if (w.minimized) after += L"m" + std::to_wstring((ULONG_PTR)w.hwnd); // minimizar/restaurar também conta
+ // issue #368: entrou ou saiu um perfil do Chrome (um só <-> dois ou mais): os ícones do Chrome trocam de estilo
+ static int perfisAntes = -1;
+ int perfis = 0;
+ for (const auto& a : list) if (ChromeBrowser(a.id, a.exe)) perfis++;
+ if (perfisAntes >= 0 && (perfisAntes >= 2) != (perfis >= 2)) {
+ for (auto& a : list) if (ChromeBrowser(a.id, a.exe)) { a.icon.clear(); a.mac = false; }
+ chromeIconChanged = true;
+ }
+ perfisAntes = perfis;
if (saveProfiles) Save();
if (chromeIconChanged) dock::IconsChanged(false);
return chromeIconChanged || before != after;
@@ -875,8 +884,16 @@ std::wstring apps::PackIconByName(const std::wstring& name, const std::wstring&
return PackIconFor(a);
}
+// issue #368: o ícone do perfil do Chrome ("Google Profile.ico", o do Windows) só vale com dois perfis ou mais no Dock,
+// para dar para diferenciar. Com um só, o Chrome usa o ícone do tema, como os outros apps (build-61 trocava sempre).
+static int ChromePerfis() {
+ int n = 0;
+ for (const auto& x : apps::list) if (ChromeBrowser(x.id, x.exe)) n++;
+ return n;
+}
+
static std::wstring ChromeProfileIcon(const App& a) {
- if (!ChromeBrowser(a.id, a.exe)) return {};
+ if (!ChromeBrowser(a.id, a.exe) || ChromePerfis() < 2) return {};
if (!a.chromeIcon.empty()) return a.chromeIcon;
if (Lower(a.launch).ends_with(L".lnk")) {
std::wstring icon;