A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Merge pull request #18 from cooblg: optional Liquid Glass menu bar and menus, plus real-glass performance fixes
Eternity070628632dfdf2a8bb
diff --cc src/ajustes/paginas.cppindex 6e0a07f,cea13a1..669054c--- a/src/ajustes/paginas.cpp+++ b/src/ajustes/paginas.cpp@@@ -1,2657 -1,2631 +1,2673 @@@-// As páginas do Ajustes do Sistema, na ordem e com os nomes do macOS Sequoia (pt-BR). Cada uma-// mostra e muda o equivalente do Windows; o que não tem como ser feito aqui abre a página do Windows.-#include "ajustes.h"-#include <set>-#include <mutex>-#include <thread>-#include <atomic>-#include <shlobj.h>-#include <shobjidl.h>-#include <shlwapi.h>-#include <shellapi.h>-#include <wincodec.h>-#include <mfapi.h>-#include <mfidl.h>-#include <mfreadwrite.h>-#include <mferror.h>-#include "../comum/simbolos.h" // símbolos SF da prévia do Liquid Glass (Golden Gate)-#pragma comment(lib, "mfplat.lib")-#pragma comment(lib, "mfreadwrite.lib")-#pragma comment(lib, "mfuuid.lib")--void AskText(const std::wstring& title, const std::wstring& message, const std::wstring& okLabel, bool password,- std::function<void(const std::wstring&)> ok);--using namespace aj;--Page Armazenamento();--namespace {--// cores dos quadradinhos (as do Ajustes do Mac)-const UINT32 C_BLUE = 0x0A84FF, C_GREEN = 0x34C759, C_GRAY = 0x8E8E93, C_DARK = 0x2C2C2E, C_RED = 0xFF3B30, C_PINK = 0xFF2D55,- C_INDIGO = 0x5856D6, C_PURPLE = 0xAF52DE, C_CYAN = 0x32ADE6, C_ORANGE = 0xFF9500, C_TEAL = 0x30B0C7;--std::wstring Fmt(const wchar_t* f, ...) {- wchar_t buf[512];- va_list a; va_start(a, f); vswprintf_s(buf, Tr(f), a); va_end(a); // o formato no idioma escolhido (mesmos %d/%ls)- return buf;-}--std::wstring Size(ULONGLONG b) {- double gb = b / 1e9;- return gb >= 1000 ? Fmt(L"%.2f TB", gb / 1000) : gb >= 10 ? Fmt(L"%.0f GB", gb) : Fmt(L"%.1f GB", gb);-}--Row Value(const std::wstring& label, std::function<std::wstring()> v) { Row r; r.kind = Kind::Value; r.label = label; r.value = v; return r; }-Row Value(const std::wstring& label, const std::wstring& v) { return Value(label, [v] { return v; }); }-Row Toggle(const std::wstring& label, std::function<bool()> get, std::function<void(bool)> set, const std::wstring& detail = L"") {- Row r; r.kind = Kind::Toggle; r.label = label; r.get = get; r.set = set; r.detail = detail; return r;-}-Row Popup(const std::wstring& label, std::vector<std::wstring> opts, std::function<int()> get, std::function<void(int)> set) {- Row r; r.kind = Kind::Popup; r.label = label; r.options = opts; r.getIdx = get; r.setIdx = set; return r;-}-Row Slider(const std::wstring& label, float mn, float mx, std::function<float()> get, std::function<void(float)> set,- const std::wstring& minG = L"", const std::wstring& maxG = L"") {- Row r; r.kind = Kind::Slider; r.label = label; r.min = mn; r.max = mx; r.getF = get; r.setF = set; r.minGlyph = minG; r.maxGlyph = maxG; return r;-}-Row Link(const std::wstring& label, std::function<void()> click, wchar_t icon = 0, UINT32 color = 0, std::function<std::wstring()> v = nullptr) {- Row r; r.kind = Kind::Link; r.label = label; r.click = click; r.icon = icon; r.iconColor = color; r.value = v; return r;-}-Row Uri(const std::wstring& label, const std::wstring& uri, wchar_t icon = 0, UINT32 color = 0) {- return Link(label, [uri] { OpenUri(uri); }, icon, color);-}-Row Button(const std::wstring& label, const std::wstring& button, std::function<void()> click, const std::wstring& detail = L"") {- Row r; r.kind = Kind::Button; r.label = label; r.button = button; r.click = click; r.detail = detail; return r;-}-Row Note(const std::wstring& text) { // linha só de texto cinza (explicação)- Row r; r.kind = Kind::Custom;- r.height = 0;- r.draw = [text](Ctx& c, D2D1_RECT_F rr) {- c.note->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);- Text(c, text, D2D1::RectF(rr.left + 10, rr.top + 9, rr.right - 10, rr.bottom), c.note, c.text2);- c.note->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);- };- r.height = 38;- return r;-}-Group G(std::vector<Row> rows, const std::wstring& title = L"", const std::wstring& sub = L"") { Group g; g.rows = std::move(rows); g.title = title; g.subtitle = sub; return g; }--// botões alinhados à direita, fora das caixas (ex.: "Avançado…", "Relatório do Sistema…")-Row Buttons(std::vector<std::pair<std::wstring, std::function<void()>>> bs) {- Row r; r.kind = Kind::Custom; r.height = 34;- r.draw = [bs](Ctx& c, D2D1_RECT_F rr) {- float right = rr.right;- for (int i = (int)bs.size() - 1; i >= 0; i--) {- float w = 0;- IDWriteTextLayout* tl = nullptr;- if (SUCCEEDED(gfx::dw->CreateTextLayout(bs[i].first.c_str(), (UINT32)bs[i].first.size(), c.center, 400, 30, &tl))) { DWRITE_TEXT_METRICS m{}; tl->GetMetrics(&m); w = m.width; tl->Release(); }- w = std::max(w + (tahoe::On() ? 28 : 22), 60.f);- D2D1_RECT_F b = tahoe::On() ? D2D1::RectF(right - w, rr.top + 4, right, rr.top + 30) : D2D1::RectF(right - w, rr.top + 6, right, rr.top + 28);- ButtonFace(c, b, bs[i].first);- right = b.left - 10;- }- };- r.clickAt = [bs](D2D1_POINT_2F p, D2D1_RECT_F rr) {- float right = rr.right;- for (int i = (int)bs.size() - 1; i >= 0; i--) {- float w = 0;- IDWriteTextLayout* tl = nullptr;- IDWriteTextFormat* tf = nullptr;- gfx::dw->CreateTextFormat(L"SF Pro Text", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 13, L"pt-br", &tf);- if (tf && SUCCEEDED(gfx::dw->CreateTextLayout(bs[i].first.c_str(), (UINT32)bs[i].first.size(), tf, 400, 30, &tl))) { DWRITE_TEXT_METRICS m{}; tl->GetMetrics(&m); w = m.width; tl->Release(); }- if (tf) tf->Release();- w = std::max(w + (tahoe::On() ? 28 : 22), 60.f);- if (p.x >= right - w && p.x <= right && p.y >= rr.top + 4 && p.y <= rr.top + 30) { bs[i].second(); return; }- right -= w + 10;- }- };- return r;-}-Group Plain(Row r) { Group g; g.box = false; g.rows.push_back(r); return g; }--// cabeçalho grande no topo de páginas como Wi-Fi e Bluetooth (ícone + título + descrição)-Row Hero(wchar_t glyph, UINT32 color, const std::wstring& title, const std::wstring& text) {- Row r; r.kind = Kind::Custom; r.height = 112;- r.draw = [=](Ctx& c, D2D1_RECT_F rr) {- float cx = (rr.left + rr.right) / 2;- Tile(c, D2D1::RectF(cx - 24, rr.top + 14, cx + 24, rr.top + 62), glyph, color, SymbolFor(title));- IDWriteTextFormat* tf = nullptr;- gfx::dw->CreateTextFormat(L"SF Pro Display", nullptr, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 15, L"pt-br", &tf);- if (tf) { tf->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); Text(c, title, D2D1::RectF(rr.left + 10, rr.top + 66, rr.right - 10, rr.top + 86), tf, c.text); tf->Release(); }- c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);- c.note->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);- Text(c, text, D2D1::RectF(rr.left + 40, rr.top + 87, rr.right - 40, rr.bottom), c.note, c.text2);- c.note->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);- c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);- };- return r;-}--// ---- reaproveitados por várias páginas-const std::vector<int> MINUTES = { 1, 2, 3, 5, 10, 15, 20, 30, 45, 60, 120, 180, 300, 0 };-std::vector<std::wstring> MinuteLabels(const wchar_t* prefix) {- std::vector<std::wstring> r;- for (int m : MINUTES) r.push_back(m == 0 ? L"Nunca" : m < 60 ? Fmt(L"%ls%d minuto%ls", Tr(prefix), m, m > 1 ? L"s" : L"") : Fmt(L"%ls%d hora%ls", Tr(prefix), m / 60, m >= 120 ? L"s" : L""));- return r;-}-int MinuteIndex(int m) {- if (m == 0) return (int)MINUTES.size() - 1;- for (int i = 0; i < (int)MINUTES.size() - 1; i++) if (MINUTES[i] >= m) return i;- return (int)MINUTES.size() - 2;-}--// ================= Conta-Page Conta() {- const sys::Info& inf = sys::About();- Page p;- Row head; head.kind = Kind::Custom; head.height = 150;- head.draw = [&inf](Ctx& c, D2D1_RECT_F rr) {- float cx = (rr.left + rr.right) / 2;- D2D1_POINT_2F m{ cx, rr.top + 52 };- if (ID2D1Bitmap* pic = sys::AccountPicture()) {- ID2D1Factory* f = nullptr; c.dc->GetFactory(&f);- ID2D1EllipseGeometry* eg = nullptr; f->CreateEllipseGeometry(D2D1::Ellipse(m, 40, 40), &eg);- c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), eg), nullptr);- c.dc->DrawBitmap(pic, D2D1::RectF(m.x - 40, m.y - 40, m.x + 40, m.y + 40), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);- c.dc->PopLayer();- eg->Release(); f->Release();- } else {- c.br->SetColor(D2D1::ColorF(0.6f, 0.6f, 0.63f, 1));- c.dc->FillEllipse(D2D1::Ellipse(m, 40, 40), c.br);- }- IDWriteTextFormat* tf = nullptr;- gfx::dw->CreateTextFormat(L"SF Pro Display", nullptr, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 20, L"pt-br", &tf);- if (tf) { tf->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); Text(c, inf.fullName, D2D1::RectF(rr.left, rr.top + 100, rr.right, rr.top + 126), tf, c.text); tf->Release(); }- c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);- Text(c, inf.user + L" · " + inf.computer, D2D1::RectF(rr.left, rr.top + 126, rr.right, rr.top + 144), c.note, c.text2);- c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);- };- p.groups.push_back(Plain(head));- p.groups.push_back(G({ Uri(L"Informações Pessoais", L"ms-settings:yourinfo", 0xE77B, C_GRAY),- Uri(L"Início de Sessão e Segurança", L"ms-settings:signinoptions", 0xE72E, C_GRAY),- Uri(L"E-mail e Contas", L"ms-settings:emailandaccounts", L'@', C_BLUE) }));- p.groups.push_back(G({ Uri(L"Família", L"ms-settings:family-group", 0xE716, C_BLUE),- Uri(L"Backup do Windows (OneDrive)", L"ms-settings:backup", 0xE753, C_CYAN) }));- return p;-}--// ================= Wi-Fi-Page WiFi() {- Page p;- int st = sys::RadioState(sys::RADIO_WIFI);- if (!sys::WifiPresent() && st == -1) {- p.groups.push_back(Plain(Hero(0xE701, C_BLUE, L"Wi‑Fi", L"Nenhum adaptador de Wi‑Fi foi encontrado neste computador. A conexão de rede está em Rede.")));- p.groups.push_back(G({ Link(L"Rede", [] { int i = SidebarIndexFor(L"rede"); (void)i; OpenUri(L"ms-settings:network"); }, 0xE774, C_BLUE) }));- return p;- }- // como no macOS 26: ícone, título com a explicação embaixo e a chave à direita- Row t = Toggle(L"Wi‑Fi", [] { return sys::RadioState(sys::RADIO_WIFI) == 1; }, [](bool on) { sys::SetRadio(sys::RADIO_WIFI, on); },- L"Configure o Wi‑Fi para conectar este computador à internet sem fio. Ligue o Wi‑Fi e escolha uma rede.");- t.icon = 0xE701; t.iconColor = C_BLUE;- t.height = 64;- std::wstring cur = sys::WifiCurrent();- Group top = G({ t });- if (!cur.empty() && st != 0) { // rede atual: nome, "● Conectado" em verde, cadeado, sinal e Detalhes…- int sig = 100; bool sec = true;- for (auto& n : sys::WifiNetworks()) if (n.connected) { sig = n.signal; sec = n.secure; }- Row r; r.kind = Kind::Custom; r.height = 54;- r.draw = [cur, sig, sec](Ctx& c, D2D1_RECT_F rr) {- Text(c, cur, D2D1::RectF(rr.left + 10, rr.top + 7, rr.right - 160, rr.top + 27), c.body, c.text);- c.br->SetColor(D2D1::ColorF(0.20f, 0.78f, 0.35f, 1));- c.dc->FillEllipse(D2D1::Ellipse({ rr.left + 15, rr.top + 37 }, 4.5f, 4.5f), c.br);- Text(c, L"Conectado", D2D1::RectF(rr.left + 25, rr.top + 27, rr.right - 160, rr.top + 47), c.note, c.text2);- D2D1_RECT_F b = D2D1::RectF(rr.right - 10 - 96, (rr.top + rr.bottom) / 2 - 13, rr.right - 10, (rr.top + rr.bottom) / 2 + 13);- ButtonFace(c, b, L"Detalhes…");- float x = b.left - 12;- D2D1_COLOR_F w = c.text; w.a *= sig > 66 ? 1 : sig > 33 ? 0.75f : 0.5f;- Text(c, std::wstring(1, (wchar_t)0xE701), D2D1::RectF(x - 18, rr.top, x, rr.bottom), c.glyphSmall, w);- if (sec) Text(c, std::wstring(1, (wchar_t)0xE72E), D2D1::RectF(x - 40, rr.top, x - 22, rr.bottom), c.glyphSmall, c.text);- };- r.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) { if (pt.x > rr.right - 110) OpenUri(L"ms-settings:network-wifi"); };- top.rows.push_back(r);- }- p.groups.push_back(top);- if (st == 0) return p;- auto nets = sys::WifiNetworks();- Group known = G({}, L"Redes Conhecidas"), other = G({}, L"Outras Redes");- for (auto& n : nets) {- if (n.connected) continue;- Row r; r.kind = Kind::Custom; r.height = 42;- std::wstring ssid = n.ssid; bool secure = n.secure, isKnown = n.known; int signal = n.signal;- r.draw = [ssid, secure, signal](Ctx& c, D2D1_RECT_F rr) {- Text(c, ssid, D2D1::RectF(rr.left + 30, rr.top, rr.right - 80, rr.bottom), c.body, c.text);- float x = rr.right - 12;- D2D1_COLOR_F weak = c.text; weak.a *= signal > 66 ? 1 : signal > 33 ? 0.7f : 0.45f;- Text(c, std::wstring(1, (wchar_t)0xE701), D2D1::RectF(x - 18, rr.top, x, rr.bottom), c.glyphSmall, weak);- if (secure) Text(c, std::wstring(1, (wchar_t)0xE72E), D2D1::RectF(x - 40, rr.top, x - 22, rr.bottom), c.glyphSmall, c.text);- };- r.clickAt = [ssid, secure, isKnown](D2D1_POINT_2F, D2D1_RECT_F) {- if (isKnown || !secure) { sys::WifiConnect(ssid, L"", secure); Rebuild(); return; }- AskText(Tr(L"A rede Wi‑Fi “") + ssid + Tr(L"” requer uma senha."), L"", L"Conectar", true,- [ssid](const std::wstring& pw) { sys::WifiConnect(ssid, pw, true); Rebuild(); });- };- (isKnown ? known : other).rows.push_back(r);- }- if (!known.rows.empty()) p.groups.push_back(known);- if (!other.rows.empty()) p.groups.push_back(other);- if (!cur.empty()) p.groups.push_back(G({ Button(Tr(L"Desconectar de “") + cur + L"”", L"Desconectar", [] { sys::WifiDisconnect(); Rebuild(); }) }));- p.groups.push_back(Plain(Buttons({ { L"Avançado…", [] { OpenUri(L"ms-settings:network-wifisettings"); } } })));- return p;-}--// ================= Bluetooth-Page Bluetooth() {- Page p;- int st = sys::RadioState(sys::RADIO_BT);- if (st == -1) {- p.groups.push_back(Plain(Hero(0xE702, C_BLUE, L"Bluetooth", L"Nenhum adaptador Bluetooth foi encontrado neste computador.")));- return p;- }- wchar_t name[64]; DWORD n = 64; GetComputerNameW(name, &n);- Row t = Toggle(L"Bluetooth", [] { return sys::RadioState(sys::RADIO_BT) == 1; }, [](bool on) { sys::SetRadio(sys::RADIO_BT, on); },- L"Conecte acessórios para ouvir música, digitar e jogar.");- t.icon = 0xE702; t.iconColor = C_BLUE;- Group top = G({ t });- if (st == 1) top.rows.push_back(Note(std::wstring(Tr(L"Este computador está detectável como “")) + name + Tr(L"” enquanto os ajustes do Bluetooth estão abertos.")));- p.groups.push_back(top);- if (st == 0) return p;- Group mine = G({}, L"Meus Dispositivos");- for (auto& d : sys::BluetoothDevices()) {- // ícone pelo tipo (classe Bluetooth: periférico = mouse/teclado, áudio = fone), nome e o estado embaixo, (i) à direita- Row r; r.kind = Kind::Custom; r.height = 52;- std::wstring nm = d.name; bool con = d.connected; ULONG cls = d.cls;- r.draw = [nm, con, cls](Ctx& c, D2D1_RECT_F rr) {- ULONG major = (cls >> 8) & 0x1F, minor = (cls >> 2) & 0x3F;- wchar_t g = major == 4 ? 0xE7F6 /*fone*/ : major == 5 ? ((minor & 0x10) ? 0xE765 /*teclado*/ : 0xE962 /*mouse*/) : major == 2 ? 0xE8EA /*celular*/ : 0xE702;- Text(c, std::wstring(1, g), D2D1::RectF(rr.left + 10, rr.top, rr.left + 36, rr.bottom), c.glyph, c.text2);- Text(c, nm, D2D1::RectF(rr.left + 46, rr.top + 7, rr.right - 50, rr.top + 27), c.body, c.text);- Text(c, con ? L"Conectado" : L"Não Conectado", D2D1::RectF(rr.left + 46, rr.top + 27, rr.right - 50, rr.top + 45), c.note, c.text2);- float cx = rr.right - 22, cy = (rr.top + rr.bottom) / 2; // (i)- c.br->SetColor(c.text2);- c.dc->DrawEllipse(D2D1::Ellipse({ cx, cy }, 9, 9), c.br, 1.2f);- Text(c, L"i", D2D1::RectF(cx - 9, cy - 9, cx + 9, cy + 9), c.center, c.text2);- };- r.clickAt = [](D2D1_POINT_2F, D2D1_RECT_F) { OpenUri(L"ms-settings:bluetooth"); };- mine.rows.push_back(r);- }- if (mine.rows.empty()) mine.rows.push_back(Note(L"Nenhum dispositivo emparelhado."));- p.groups.push_back(mine);- p.groups.push_back(G({ Button(L"Novo dispositivo", L"Adicionar…", [] {- wchar_t sysdir[MAX_PATH]; GetSystemDirectoryW(sysdir, MAX_PATH);- ShellExecuteW(nullptr, L"open", (std::wstring(sysdir) + L"\\DevicePairingWizard.exe").c_str(), nullptr, nullptr, SW_SHOWNORMAL);- }) }, L"Dispositivos Próximos"));- p.groups.push_back(Plain(Buttons({ { L"Avançado…", [] { OpenUri(L"ms-settings:bluetooth"); } } })));- return p;-}--// ================= Rede-Page RedeDetalhe(sys::NetIf n) {- Page p;- p.groups.push_back(G({ Value(L"Status", n.up ? L"Conectado" : L"Não conectado"), Value(L"Tipo", n.kind), Value(L"Endereço IP", n.ip.empty() ? L"—" : n.ip) }));- p.groups.push_back(Plain(Buttons({ { L"Ajustes do Adaptador…", [] { OpenUri(L"ms-settings:network-advancedsettings"); } } })));- return p;-}--Page Rede() {- Page p;- Group ifs = G({});- for (auto& n : sys::Interfaces()) {- Row r = Link(n.name, [n] { Push(n.name, [n] { return RedeDetalhe(n); }); }, n.kind == L"Ethernet" ? (wchar_t)0xE839 : (wchar_t)0xE701, C_BLUE,- [up = n.up] { return std::wstring(up ? L"Conectado" : L"Não conectado"); });- ifs.rows.push_back(r);- }- if (ifs.rows.empty()) ifs.rows.push_back(Note(L"Nenhum adaptador de rede encontrado."));- p.groups.push_back(ifs);- p.groups.push_back(G({ Uri(L"Firewall", L"windowsdefender://network", 0xE83D, C_RED),- Uri(L"VPN", L"ms-settings:network-vpn", 0xE705, C_BLUE),- Uri(L"Proxies", L"ms-settings:network-proxy", 0xE774, C_GRAY) }, L"Outros Serviços"));- return p;-}--// ================= Energia / Bateria-Page Energia() {- Page p;- int pct = 0; bool charging = false;- if (sys::HasBattery(&pct, &charging))- p.groups.push_back(G({ Value(L"Nível da Bateria", Fmt(L"%d%%%ls", pct, charging ? Tr(L" (carregando)") : L"")) }));- p.groups.push_back(G({ Popup(L"Modo de Energia", { L"Economia de Energia", L"Equilibrado", L"Melhor Desempenho" }, [] { return sys::PowerMode(); },- [](int i) { sys::SetPowerMode(i); }) }));- p.groups.push_back(G({ Popup(L"Desligar a tela quando inativo", MinuteLabels(L"Após "), [] { return MinuteIndex(sys::DisplayOffMinutes()); },- [](int i) { sys::SetDisplayOffMinutes(MINUTES[i]); }),- Popup(L"Repousar quando inativo", MinuteLabels(L"Após "), [] { return MinuteIndex(sys::SleepMinutes()); },- [](int i) { sys::SetSleepMinutes(MINUTES[i]); }) }));- // App Nap do Mac (shell\memoria.cpp): o Shell põe no modo eficiência do Windows quem está fora de vista- p.groups.push_back(G({ Toggle(L"Soneca de Apps", [] { return Setting(L"app_nap", L"1") != L"0"; },- [](bool v) { SetSetting(L"app_nap", v ? L"1" : L"0"); },- L"Programas com todas as janelas escondidas, minimizadas ou cobertas por 30 segundos passam a gastar menos processador, como o App Nap do Mac. Voltam ao normal assim que aparecem. Não vale para o que está tocando ou gravando som.") }));- // Modo Jogo do Mac (shell\jogo.cpp): jogo na frente → o Shell desliga o que mais pesa até o jogo fechar- p.groups.push_back(G({ Toggle(L"Modo Jogo", [] { return Setting(L"modo_jogo", L"1") != L"0"; },- [](bool v) { SetSetting(L"modo_jogo", v ? L"1" : L"0"); },- L"Quando um jogo vem para a frente, o WacOS desliga o vidro real, os efeitos que acompanham o mouse e os Cantos Ativos e passa a usar menos processador, até o jogo fechar. Jogos que não forem reconhecidos podem ser postos em jogos.txt, na pasta de ajustes.") }));- p.groups.push_back(Plain(Buttons({ { L"Opções de Energia…", [] { OpenUri(L"ms-settings:powersleep"); } } })));- return p;-}--// ================= Geral-Page Sobre() {- const sys::Info& i = sys::About();- Page p;- Row head; head.kind = Kind::Custom; head.height = 150;- std::wstring model = i.model.empty() ? L"PC" : i.model;- head.draw = [model](Ctx& c, D2D1_RECT_F rr) {- float cx = (rr.left + rr.right) / 2;- // monitor desenhado (no lugar da foto do Mac)- D2D1_RECT_F scr = D2D1::RectF(cx - 52, rr.top + 14, cx + 52, rr.top + 80);- c.br->SetColor(D2D1::ColorF(0.12f, 0.12f, 0.13f, 1));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(scr, 5, 5), c.br);- ID2D1GradientStopCollection* st = nullptr;- D2D1_GRADIENT_STOP gs[2] = { { 0, D2D1::ColorF(0.24f, 0.55f, 0.95f, 1) }, { 1, D2D1::ColorF(0.55f, 0.32f, 0.85f, 1) } };- c.dc->CreateGradientStopCollection(gs, 2, &st);- ID2D1LinearGradientBrush* lg = nullptr;- if (st) c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ scr.left, scr.top }, { scr.right, scr.bottom }), st, &lg);- if (lg) { c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(scr.left + 3, scr.top + 3, scr.right - 3, scr.bottom - 3), 3, 3), lg); lg->Release(); }- if (st) st->Release();- c.br->SetColor(c.dark ? D2D1::ColorF(0.6f, 0.6f, 0.62f, 1) : D2D1::ColorF(0.72f, 0.72f, 0.74f, 1));- c.dc->FillRectangle(D2D1::RectF(cx - 8, scr.bottom, cx + 8, scr.bottom + 12), c.br);- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 24, scr.bottom + 11, cx + 24, scr.bottom + 15), 2, 2), c.br);- IDWriteTextFormat* tf = nullptr;- gfx::dw->CreateTextFormat(L"SF Pro Display", nullptr, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 20, L"pt-br", &tf);- if (tf) { tf->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); Text(c, model, D2D1::RectF(rr.left, rr.top + 102, rr.right, rr.top + 128), tf, c.text); tf->Release(); }- };- p.groups.push_back(Plain(head));- p.groups.push_back(G({ Value(L"Nome", i.computer), Value(L"Processador", i.cpu), Value(L"Memória", i.ram), Value(L"Gráficos", i.gpu) }));- p.groups.push_back(G({ Value(L"Windows", i.windows), Value(L"Compilação", i.build) }, L"Sistema"));- auto mode = sys::CurrentResolution();- p.groups.push_back(G({ Button(L"Tela", L"Ajustes de Telas…", [] { int k = SidebarIndexFor(L"telas"); if (k >= 0) { HWND w = Window(); COPYDATASTRUCT cd{ 0x414A5354, 10, (void*)L"telas" }; SendMessageW(w, WM_COPYDATA, 0, (LPARAM)&cd); } },- Fmt(L"%d × %d", mode.w, mode.h)) }, L"Telas"));- std::vector<Row> disks;- for (auto& d : sys::Disks())- disks.push_back(Button(d.label.empty() ? d.root : d.label + L" (" + d.root.substr(0, 2) + L")", L"Ajustes de Armazenamento…",- [] { Push(L"Armazenamento", Armazenamento); },- Size(d.free) + Tr(L" disponíveis de ") + Size(d.total)));- if (!disks.empty()) p.groups.push_back(G(disks, L"Armazenamento"));- // o que o "Sobre Este Mac" do menu da Apple mostra (sobre_mac=, src\shell\sobre.cpp): este PC ou o Mac Studio de enfeite- p.groups.push_back(G({ Popup(L"Sobre Este Mac mostra", { L"Este PC", L"Mac Studio" },- [] { return Setting(L"sobre_mac", L"pc") == L"macstudio" ? 1 : 0; },- [](int i) { SetSetting(L"sobre_mac", i == 1 ? L"macstudio" : L"pc"); }),- Note(L"A janela do menu da Apple: os dados reais deste computador ou um Mac Studio de enfeite.") }, L"Menu da Apple"));- p.groups.push_back(Plain(Buttons({ { L"Relatório do Sistema…",[] { ShellExecuteW(nullptr, L"open", L"msinfo32.exe", nullptr, nullptr, SW_SHOWNORMAL); } } })));- return p;-}--} // namespace--Page Armazenamento() {- Page p;- for (auto& d : sys::Disks()) {- Row r; r.kind = Kind::Custom; r.height = 84;- std::wstring name = (d.label.empty() ? std::wstring(Tr(L"Disco Local")) : d.label) + L" (" + d.root.substr(0, 2) + L")";- ULONGLONG total = d.total, freeB = d.free;- r.draw = [name, total, freeB](Ctx& c, D2D1_RECT_F rr) {- Text(c, name, D2D1::RectF(rr.left + 12, rr.top + 10, rr.right - 12, rr.top + 28), c.bold, c.text);- Text(c, Size(total - freeB) + Tr(L" usados de ") + Size(total), D2D1::RectF(rr.left + 12, rr.top + 28, rr.right - 12, rr.top + 44), c.note, c.text2);- D2D1_RECT_F bar = D2D1::RectF(rr.left + 12, rr.top + 52, rr.right - 12, rr.top + 66);- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.10f) : D2D1::ColorF(0, 0, 0, 0.07f));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(bar, 4, 4), c.br);- float k = total ? (float)(total - freeB) / total : 0;- c.br->SetColor(D2D1::ColorF(1.0f, 0.62f, 0.04f, 1));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(bar.left, bar.top, bar.left + (bar.right - bar.left) * k, bar.bottom), 4, 4), c.br);- };- p.groups.push_back(G({ r }));- }- p.groups.push_back(Plain(Buttons({ { L"Recomendações…", [] { OpenUri(L"ms-settings:storagesense"); } } })));- return p;-}--namespace {--// ---- Atualização do WacOS pelo GitHub (tools\atualizar-github.ps1). Ao abrir a página o Ajustes confere sozinho,-// numa thread, a versão instalada (bin\versao.txt), a mais nova publicada e os commits que faltam; o botão só-// aparece quando há o que instalar e roda o mesmo script, que baixa e troca só o que mudou.-static std::wstring BinDir();-struct Upd { int state = 0; std::wstring atual, novo, data, erro; std::vector<std::wstring> faltam; }; // 0 nada, 1 procurando, 2 pronto-static Upd g_upd;-static std::mutex g_updMu;-static std::wstring UpdScript() {- std::wstring root = BinDir(); root = root.substr(0, root.find_last_of(L'\\'));- return root + L"\\tools\\atualizar-github.ps1";-}-static void UpdCheck() {- { std::lock_guard<std::mutex> lk(g_updMu); if (g_upd.state == 1) return; g_upd.state = 1; }- std::thread([] {- Upd u; u.state = 2;- wchar_t tmp[MAX_PATH], f[MAX_PATH]; GetTempPathW(MAX_PATH, tmp); GetTempFileNameW(tmp, L"wac", 0, f);- std::wstring cmd = L"powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"" + UpdScript() + L"\" -Verificar -Saida \"" + f + L"\" -Bin \"" + BinDir() + L"\"";- STARTUPINFOW si{ sizeof(si) }; PROCESS_INFORMATION pi{};- if (CreateProcessW(nullptr, cmd.data(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW, nullptr, nullptr, &si, &pi)) {- WaitForSingleObject(pi.hProcess, 45000);- CloseHandle(pi.hThread); CloseHandle(pi.hProcess);- }- FILE* fp = nullptr;- if (!_wfopen_s(&fp, f, L"r, ccs=UTF-8") && fp) {- wchar_t line[1024];- while (fgetws(line, 1024, fp)) {- std::wstring l = line;- while (!l.empty() && (l.back() == L'\n' || l.back() == L'\r')) l.pop_back();- if (!l.empty() && l[0] == 0xFEFF) l.erase(0, 1);- auto val = [&](const wchar_t* k) { size_t n = wcslen(k); return l.compare(0, n, k) == 0 ? l.substr(n) : std::wstring(1, 0); };- if (auto v = val(L"atual="); v != std::wstring(1, 0)) u.atual = v;- else if (auto v2 = val(L"novo="); v2 != std::wstring(1, 0)) u.novo = v2;- else if (auto v3 = val(L"data="); v3 != std::wstring(1, 0)) u.data = v3;- else if (auto v4 = val(L"erro="); v4 != std::wstring(1, 0)) u.erro = v4;- else if (auto v5 = val(L"commit="); v5 != std::wstring(1, 0)) u.faltam.push_back(v5);- }- fclose(fp);- } else u.erro = Tr(L"não deu para conferir agora");- DeleteFileW(f);- if (u.novo.empty() && u.erro.empty()) u.erro = Tr(L"não deu para conferir agora");- { std::lock_guard<std::mutex> lk(g_updMu); g_upd = u; }- aj::Rebuild();- }).detach();-}--Page Atualizacao() {- const sys::Info& i = sys::About();- Page p;- Upd u;- { std::lock_guard<std::mutex> lk(g_updMu); u = g_upd; }- if (u.state == 0) { UpdCheck(); u.state = 1; }- bool tem = u.state == 2 && !u.novo.empty() && u.novo != u.atual;- std::vector<Row> rows;- rows.push_back(Value(L"Versão instalada", u.atual.empty() ? (u.state == 2 ? Tr(L"desconhecida") : Tr(L"Procurando…")) : u.atual));- rows.push_back(Value(L"Versão mais nova", u.state == 1 ? Tr(L"Procurando…") : !u.erro.empty() ? u.erro : u.novo + (u.data.empty() ? L"" : L" (" + u.data + L")")));- if (tem) {- std::wstring label = u.faltam.empty() ? Tr(L"Há uma versão nova do WacOS.")- : std::to_wstring(u.faltam.size()) + (u.faltam.size() == 1 ? Tr(L" mudança para instalar.") : Tr(L" mudanças para instalar."));- rows.push_back(Button(label, L"Atualizar Agora", [] {- // o instalador do WacOS (WacOSSetup.exe, na pasta da instalação): baixa, confere e instala, com janela própria- std::wstring setup = BinDir().substr(0, BinDir().find_last_of(L'\\')) + L"\\WacOSSetup.exe";- if (GetFileAttributesW(setup.c_str()) != INVALID_FILE_ATTRIBUTES) {- ShellExecuteW(nullptr, L"open", setup.c_str(), L"--atualizar", nullptr, SW_SHOWNORMAL);- return;- }- std::wstring cmd = L"powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"" + UpdScript() + L"\"";- STARTUPINFOW si{ sizeof(si) }; PROCESS_INFORMATION pi{};- if (CreateProcessW(nullptr, cmd.data(), nullptr, nullptr, FALSE, CREATE_NEW_CONSOLE, nullptr, nullptr, &si, &pi)) { CloseHandle(pi.hThread); CloseHandle(pi.hProcess); }- }));- } else if (u.state == 2 && u.erro.empty()) rows.push_back(Note(Tr(L"O WacOS está atualizado.")));- rows.push_back(Button(L"Confere de novo no GitHub.", L"Procurar Atualizações", [] { { std::lock_guard<std::mutex> lk(g_updMu); g_upd.state = 0; } aj::Rebuild(); }));- p.groups.push_back(G(rows, L"WacOS"));- p.groups.push_back(G({ Toggle(L"Avisar quando houver atualização", [] { return Setting(L"avisar_atualizacao", L"1") != L"0"; },- [](bool v) { SetSetting(L"avisar_atualizacao", v ? L"1" : L"0"); },- L"O WacOS confere o GitHub ao entrar e a cada 6 horas e mostra uma notificação quando sai uma versão nova.") }));- if (tem && !u.faltam.empty()) {- std::vector<Row> ch;- for (size_t k = 0; k < u.faltam.size() && k < 15; k++) ch.push_back(Note(L"• " + u.faltam[k]));- if (u.faltam.size() > 15) ch.push_back(Note(L"… +" + std::to_wstring(u.faltam.size() - 15)));- p.groups.push_back(G(ch, L"O que falta"));- }- p.groups.push_back(G({ Button(L"O Windows Update cuida das atualizações deste computador.", L"Abrir o Windows Update…", [] { OpenUri(L"ms-settings:windowsupdate"); }) }, L"Windows"));- p.groups.push_back(G({ Value(L"Instalado", i.windows + L" (" + i.build + L")"), Link(L"Atualizações Automáticas", [] { OpenUri(L"ms-settings:windowsupdate-options"); }) }));- return p;-}--Page Inicio() {- Page p;- Group g = G({}, L"Abrir ao Iniciar Sessão", L"Estes itens abrem automaticamente quando você inicia a sessão.");- for (auto& s : sys::StartupItems()) {- std::wstring name = s.name;- g.rows.push_back(Toggle(name, [name] { for (auto& x : sys::StartupItems()) if (x.name == name) return x.enabled; return false; },- [name](bool on) { sys::SetStartupEnabled(name, on); }));- }- if (g.rows.empty()) g.rows.push_back(Note(L"Nenhum item."));- p.groups.push_back(g);- p.groups.push_back(Plain(Buttons({ { L"Mais Itens…", [] { OpenUri(L"ms-settings:startupapps"); } } })));- return p;-}--Page DataHora() {- Page p;- TIME_ZONE_INFORMATION tz{};- GetTimeZoneInformation(&tz);- std::wstring zone = tz.StandardName;- p.groups.push_back(G({- Value(L"Data e hora", [] {- SYSTEMTIME st; GetLocalTime(&st);- wchar_t d[64], t[32];- GetDateFormatEx(LOCALE_NAME_USER_DEFAULT, DATE_LONGDATE, &st, nullptr, d, 64, nullptr);- GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, t, 32);- return std::wstring(d) + L", " + t;- }),- Value(L"Fuso horário", zone),- }));- p.groups.push_back(Plain(Buttons({ { L"Ajustar…", [] { OpenUri(L"ms-settings:dateandtime"); } } })));- return p;-}--// ================= O próprio WacOS (Geral): abrir ao entrar no Windows, pastas no Finder, desligar-// A tarefa agendada "WacOS" (a mesma do instalador e do docs\iniciar-com-windows.ps1) abre o Shell no login.-static std::wstring BinDir() {- wchar_t exe[MAX_PATH]; GetModuleFileNameW(nullptr, exe, MAX_PATH);- std::wstring d = exe;- return d.substr(0, d.find_last_of(L'\\'));-}-static DWORD RunHidden(std::wstring cmd, DWORD waitMs = 15000) {- STARTUPINFOW si{ sizeof(si) }; PROCESS_INFORMATION pi{};- DWORD code = 1;- if (!CreateProcessW(nullptr, cmd.data(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW, nullptr, nullptr, &si, &pi)) return code;- WaitForSingleObject(pi.hProcess, waitMs);- GetExitCodeProcess(pi.hProcess, &code);- CloseHandle(pi.hThread); CloseHandle(pi.hProcess);- return code;-}-static bool ShellAutoStart() { return RunHidden(L"schtasks.exe /Query /TN WacOS", 5000) == 0; }-// A chave "Abrir ao entrar no Windows" lia o estado rodando o schtasks.exe A CADA DESENHO da linha (13-33 ms por-// processo, medido em 20/11/2026): rolar a página Geral até o fim, onde ela fica, travava a rolagem (cada quadro-// esperava um processo). Agora o estado é lido uma vez, numa thread, e guardado; o clique muda o guardado na hora.-static std::atomic<int> g_autoStart{ -1 }; // -1 não lido, -2 lendo, 0/1-static bool ShellAutoStartCached() {- int v = g_autoStart.load();- if (v == -1 && g_autoStart.compare_exchange_strong(v, -2))- std::thread([] { g_autoStart = ShellAutoStart() ? 1 : 0; aj::Rebuild(); }).detach();- return g_autoStart.load() == 1;-}-static void SetShellAutoStart(bool on);-static void SetShellAutoStartAsync(bool on) {- g_autoStart = on ? 1 : 0;- std::thread([on] { SetShellAutoStart(on); g_autoStart = ShellAutoStart() ? 1 : 0; aj::Rebuild(); }).detach();-}-static void SetShellAutoStart(bool on) {- if (!on) { RunHidden(L"schtasks.exe /Delete /TN WacOS /F"); return; }- std::wstring exe = BinDir() + L"\\WacOSShell.exe";- // ao fazer logon, só para este usuário, sem administrador (o schtasks /SC ONLOGON pediria administrador)- std::wstring ps = L"$u=\"$env:USERDOMAIN\\$env:USERNAME\"; Register-ScheduledTask -TaskName WacOS -Force "- L"-Action (New-ScheduledTaskAction -Execute '" + exe + L"' -WorkingDirectory '" + BinDir() + L"') "- L"-Trigger (New-ScheduledTaskTrigger -AtLogOn -User $u) "- L"-Settings (New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit ([TimeSpan]::Zero) -Priority 4 -MultipleInstances IgnoreNew) "- L"-Principal (New-ScheduledTaskPrincipal -UserId $u -LogonType Interactive -RunLevel Limited) | Out-Null";- RunHidden(L"powershell.exe -NoProfile -ExecutionPolicy Bypass -Command \"" + ps + L"\"", 30000);-}-static void TurnShellOff() {- int r = MessageBoxW(GetActiveWindow(),- Tr(L"O WacOS vai fechar agora e não vai mais abrir ao entrar no Windows. A barra de tarefas e o "- L"Explorador do Windows voltam como antes, e as pastas voltam a abrir no Explorador.\n\n"- L"Para usar de novo: abra \"WacOS\" no Menu Iniciar."),- Tr(L"Desligar o WacOS?"), MB_OKCANCEL | MB_ICONQUESTION | MB_DEFBUTTON2);- if (r != IDOK) return;- SetShellAutoStart(false);- g_autoStart = 0;- RunHidden(L"\"" + BinDir() + L"\\WacOSFinder.exe\" --padrao off --quieto"); // pastas voltam para o Explorador- SetSetting(L"finder_padrao", L"0");- SetSetting(L"finder_volta", L"1"); // o Shell, ao abrir de novo, religa o Finder (issue #1: o Win+E ficava no Explorador)- if (HWND h = FindWindowW(L"ShellMensagens", nullptr)) PostMessageW(h, WM_HOTKEY, 1, 0); // o mesmo do "sair do Shell"-}--Page Geral() {- Page p;- if (Setting(L"liquid_glass", L"0") == L"1" && Setting(L"golden_gate", L"0") == L"1") {- // macOS 27 (captura Settings-General, 2x): cartão de 163,5 no alto com o ícone de 50 (centro a 50), "Geral" em- // negrito de 22 (centro a 99) e a descrição cinza de 13 centrada embaixo- Row hero; hero.kind = Kind::Custom; hero.height = 163.5f;- hero.draw = [](Ctx& c, D2D1_RECT_F rr) {- float cx = (rr.left + rr.right) / 2;- Tile(c, D2D1::RectF(cx - 25, rr.top + 25, cx + 25, rr.top + 75), 0xE713, C_GRAY, L"gearshape.fill");- static IDWriteTextFormat* tfBig = nullptr;- if (!tfBig) { IDWriteFactory* dw = nullptr; DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), (IUnknown**)&dw);- if (dw) { dw->CreateTextFormat(L"SF Pro Display", nullptr, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 22, L"", &tfBig); dw->Release(); }- if (tfBig) { tfBig->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); tfBig->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); } }- if (tfBig) Text(c, L"Geral", D2D1::RectF(rr.left, rr.top + 85, rr.right, rr.top + 113), tfBig, c.text);- DWRITE_WORD_WRAPPING ww = c.noteCenter->GetWordWrapping();- c.noteCenter->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP);- Text(c, L"Gerencie a configuração geral e as preferências do computador, como atualizações de software, idioma, compartilhamento e mais.",- D2D1::RectF(rr.left + 30, rr.top + 106, rr.right - 30, rr.top + 146), c.noteCenter, c.text2);- c.noteCenter->SetWordWrapping(ww);- };- p.groups.push_back(G({ hero }));- }- p.groups.push_back(G({ Link(L"Sobre", [] { Push(L"Sobre", Sobre); }, 0xE7F4, C_GRAY),- Link(L"Atualização de Software", [] { Push(L"Atualização de Software", Atualizacao); }, 0xE895, C_GRAY) }));- p.groups.push_back(G({ Link(L"Armazenamento", [] { Push(L"Armazenamento", Armazenamento); }, 0xEDA2, C_GRAY) }));- p.groups.push_back(G({ Uri(L"Compartilhamento por Proximidade", L"ms-settings:crossdevice", 0xE72D, C_BLUE),- Link(L"Itens de Início", [] { Push(L"Itens de Início", Inicio); }, 0xE8FD, C_GRAY) }));- // Idioma do WacOS (idioma=<código> no ajustes.txt, idioma.h): o Shell troca na hora; este app também;- // os outros apps abertos leem o idioma ao abrir. Cada idioma aparece com o nome na própria língua.- std::vector<std::wstring> langs;- for (int l : idioma::kMenuOrder) langs.push_back(idioma::kInfo[l].native);- Row lang = Popup(L"Idioma", langs, [] {- int cur = idioma::FromCode(Setting(L"idioma", L"en"));- for (int i = 0; i < idioma::COUNT; i++) if (idioma::kMenuOrder[i] == cur) return i;- return 0;- },- [](int i) {- int l = idioma::kMenuOrder[std::clamp(i, 0, idioma::COUNT - 1)];- SetSetting(L"idioma", idioma::kInfo[l].code);- idioma::Set(l);- SetWindowTextW(Window(), TrPick(L"Ajustes do Sistema", L"System Settings"));- Rebuild();- });- lang.icon = 0xE774; lang.iconColor = C_BLUE;- p.groups.push_back(G({ lang, Note(L"O Shell muda na hora. Os apps abertos (Finder, Notas, Terminal…) mudam ao serem reabertos.") },- L"Idioma do WacOS"));- p.groups.push_back(G({ Uri(L"Idioma e Região", L"ms-settings:regionlanguage", 0xE774, C_BLUE),- Link(L"Data e Hora", [] { Push(L"Data e Hora", DataHora); }, 0xE787, C_BLUE) }));- p.groups.push_back(G({ Uri(L"Compartilhamento", L"ms-settings:sharedexperiences", 0xE72D, C_GRAY),- Uri(L"Histórico de Arquivos", L"control.exe /name Microsoft.FileHistory", 0xE81C, C_GREEN),- Uri(L"Transferir ou Redefinir", L"ms-settings:recovery", 0xE777, C_GRAY) }));- p.groups.push_back(G({ Toggle(L"Abrir ao entrar no Windows", [] { return ShellAutoStartCached(); }, [](bool on) { SetShellAutoStartAsync(on); }),- Toggle(L"Abrir pastas no Finder", [] { return Setting(L"finder_padrao", L"1") == L"1"; },- [](bool on) {- SetSetting(L"finder_padrao", on ? L"1" : L"0");- RunHidden(L"\"" + BinDir() + L"\\WacOSFinder.exe\" --quieto --padrao " + (on ? L"on" : L"off"));- }, L"Downloads do navegador, \"Mostrar na pasta\" e o Win+E também"),- // Só o Dock e a barra de menus (modo=dock, shell::SoDock): o resto fica com o Windows. Pastas voltam ao- // Explorador (o "Abrir pastas no Finder" de antes é guardado e volta no modo completo). Reinicia o Shell.- Popup(L"Modo do WacOS", { L"Completo", L"Só o Dock e a barra de menus" },- [] { return Setting(L"modo", L"completo") == L"dock" ? 1 : 0; },- [](int i) {- bool dock = i == 1;- if (dock == (Setting(L"modo", L"completo") == L"dock")) return;- if (dock) {- SetSetting(L"finder_padrao_antes", Setting(L"finder_padrao", L"1"));- SetSetting(L"finder_padrao", L"0");- RunHidden(L"\"" + BinDir() + L"\\WacOSFinder.exe\" --quieto --padrao off");- } else if (Setting(L"finder_padrao_antes", L"1") == L"1") {- SetSetting(L"finder_padrao", L"1");- RunHidden(L"\"" + BinDir() + L"\\WacOSFinder.exe\" --quieto --padrao on");- }- SetSetting(L"modo", dock ? L"dock" : L"completo");- static UINT msg = RegisterWindowMessageW(L"ShellReiniciar");- HWND sh = FindWindowExW(HWND_MESSAGE, nullptr, L"ShellMensagens", nullptr);- if (!sh) sh = FindWindowW(L"ShellMensagens", nullptr);- if (sh) PostMessageW(sh, msg, 0, 0);- }),- // reinicia só o Shell (barra, Dock, mesa, vidro): o mesmo do "ShellReiniciar" que a atualização usa- Button(L"Reiniciar o WacOS", L"Reiniciar", [] {- static UINT msg = RegisterWindowMessageW(L"ShellReiniciar");- HWND sh = FindWindowExW(HWND_MESSAGE, nullptr, L"ShellMensagens", nullptr);- if (!sh) sh = FindWindowW(L"ShellMensagens", nullptr);- if (sh) PostMessageW(sh, msg, 0, 0);- else ShellExecuteW(nullptr, L"open", (BinDir() + L"\\WacOSShell.exe").c_str(), nullptr, nullptr, SW_SHOWNORMAL); // o Shell não está rodando: abre- }, L"Fecha e abre de novo a barra de menus, o Dock, a mesa e o vidro, sem sair do Windows. Os seus apps continuam abertos."),- Button(L"Parar de usar o WacOS", L"Desligar…", [] { TurnShellOff(); },- L"Fecha o Shell e devolve a barra de tarefas e o Explorador do Windows") }, L"WacOS",- L"Só o Dock e a barra de menus: a área de trabalho, as pastas, o Alt+Tab, a tecla Windows, a captura de tela e as barras de título ficam com o Windows."));- return p;-}--// ================= Acessibilidade-Page Acessibilidade() {- Page p;- p.groups.push_back(G({ Uri(L"Narrador", L"ms-settings:easeofaccess-narrator", 0xE7F5, C_DARK),- Uri(L"Lupa", L"ms-settings:easeofaccess-magnifier", 0xE71E, C_DARK),- Uri(L"Tela", L"ms-settings:easeofaccess-display", 0xE7F4, C_BLUE),- Uri(L"Tamanho do Texto", L"ms-settings:easeofaccess-display", 0xE8D2, C_BLUE),- Uri(L"Filtros de Cor", L"ms-settings:easeofaccess-colorfilter", 0xE790, C_ORANGE) }, L"Visão"));- p.groups.push_back(G({ Uri(L"Áudio", L"ms-settings:easeofaccess-audio", 0xE767, C_PINK),- Uri(L"Legendas", L"ms-settings:easeofaccess-closedcaptioning", 0xE7F0, C_GRAY) }, L"Audição"));- p.groups.push_back(G({ Uri(L"Controle por Voz", L"ms-settings:easeofaccess-speechrecognition", 0xE720, C_BLUE),- Uri(L"Teclado", L"ms-settings:easeofaccess-keyboard", 0xE765, C_GRAY),- Uri(L"Ponteiro do Mouse", L"ms-settings:easeofaccess-mousepointer", 0xE962, C_GRAY) }, L"Motor"));- // Reduzir Movimento do Mac (Acessibilidade > Tela): janelas, Spotlight e Central de Notificações aparecem na hora,- // a Central de Controle só com fade (medido no macOS 26; Shell: anim::reduceMotion)- p.groups.push_back(G({ Toggle(L"Reduzir movimento", [] { return Setting(L"reduzir_movimento", L"0") == L"1"; },- [](bool v) { SetSetting(L"reduzir_movimento", v ? L"1" : L"0"); Rebuild(); },- L"Troca os movimentos e as mudanças de tamanho por cortes secos ou fades curtos.") }, L"Movimento"));- return p;-}--// ================= Aparência-const std::vector<std::pair<std::wstring, UINT32>> ACCENTS = {- { L"multicor", 0 }, { L"azul", 0x007AFF }, { L"roxo", 0x953D96 }, { L"rosa", 0xF74F9E }, { L"vermelho", 0xE0383E },- { L"laranja", 0xF7821B }, { L"amarelo", 0xFCB827 }, { L"verde", 0x62BA46 }, { L"grafite", 0x8C8C8C } };-const wchar_t* ACCENT_NAMES[] = { L"Multicor", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite" };--Page TransparenciaEfeitos();--Row TemaRow() {- // Tema: o vidro do Sequoia, o Liquid Glass do macOS Tahoe ou o macOS Golden Gate (macOS 27: o Tahoe com botões- // Aqua de vidro, um canto só e menor em todas as janelas e o controle de transparência). Golden Gate =- // liquid_glass=1 + golden_gate=1, então tudo o que só conhece o Tahoe continua funcionando. Detalhes do vidro em- // Transparência e Efeitos.- // Mac OS X Leopard (10.5, 2007) = leopard=1 SEM o liquid_glass: o Sequoia por baixo (tudo o que não conhece o- // Leopard continua no visual do Sequoia) e, por cima, o Aqua de 2007: barra de menus clara com a maçã grafite, Dock- // em prateleira espelhada, botões de gel e barras cinza metálico. Ligar o Liquid Glass em outro lugar desliga o- // Leopard sozinho (leopard só vale com liquid_glass=0).- // Lançado em 20/11/2026 (antes só aparecia com leopard_previa=1): o pacote leva icones\leopard e cursor\Leopard.- // ordem do usuário: o mais novo primeiro (0 Golden Gate, 1 Tahoe, 2 Sequoia, 3 Leopard)- std::vector<std::wstring> temas = { L"macOS Golden Gate", L"macOS Tahoe", L"macOS Sequoia", L"Mac OS X Leopard" };- return Popup(L"Tema", temas,- [] {- if (Setting(L"liquid_glass", L"0") != L"1") return Setting(L"leopard", L"0") == L"1" ? 3 : 2;- return Setting(L"golden_gate", L"0") == L"1" ? 0 : 1;- },- [](int i) {- if (i == 0) SetSetting(L"liquid_estilo", L"nitido"); // o vidro do Golden Gate é o controle deslizante- SetSetting(L"leopard", i == 3 ? L"1" : L"0");- SetSetting(L"golden_gate", i == 0 ? L"1" : L"0");- SetSetting(L"liquid_glass", i == 0 || i == 1 ? L"1" : L"0");- // o papel de parede do usuário nunca muda ao trocar de tema (o usuário pediu)- Rebuild();- });-}--Row GlassEstiloRow(bool title = true) { // title = false: embaixo da foto da página nova, que já tem o título- Row glass; glass.kind = Kind::Custom; glass.height = 96;- glass.enabled = Setting(L"reduzir_transparencia", L"0") != L"1";- glass.draw = [title](Ctx& c, D2D1_RECT_F rr) {- if (title) Text(c, L"Liquid Glass", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 160, rr.top + 28), c.body, c.text);- const wchar_t* names[2] = { L"Transparente", L"Tingido" };- int cur = Setting(L"liquid_estilo", L"nitido") == L"tingido" ? 1 : 0;- float w = 66, h = 44, gap = 16, x = rr.right - 10 - 2 * w - gap;- for (int k = 0; k < 2; k++, x += w + gap) {- D2D1_RECT_F t = D2D1::RectF(x, rr.top + 12, x + w, rr.top + 12 + h);- // papel de parede colorido atrás e uma placa de vidro por cima: clara (transparente) ou fosca (tingida)- ID2D1GradientStopCollection* gs = nullptr;- D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.30f, 0.55f, 0.98f, 1) }, { 1, D2D1::ColorF(0.95f, 0.50f, 0.55f, 1) } };- c.dc->CreateGradientStopCollection(st, 2, &gs);- ID2D1LinearGradientBrush* lg = nullptr;- if (gs) c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ t.left, t.top }, { t.right, t.bottom }), gs, &lg);- if (lg) { c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), lg); lg->Release(); }- if (gs) gs->Release();- D2D1_RECT_F pl = D2D1::RectF(t.left + 9, t.top + 9, t.right - 9, t.bottom - 9);- c.br->SetColor(k == 0 ? D2D1::ColorF(1, 1, 1, 0.18f) : (c.dark ? D2D1::ColorF(0.16f, 0.16f, 0.17f, 0.82f) : D2D1::ColorF(0.97f, 0.97f, 0.98f, 0.85f)));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(pl, 8, 8), c.br);- c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.75f));- c.dc->DrawRoundedRectangle(D2D1::RoundedRect(pl, 8, 8), c.br, 0.8f);- if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }- Text(c, names[k], D2D1::RectF(t.left - 12, t.bottom + 6, t.right + 12, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);- }- };- glass.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- float w = 66, gap = 16, x = rr.right - 10 - 2 * w - gap;- for (int k = 0; k < 2; k++, x += w + gap)- if (pt.x >= x - 6 && pt.x <= x + w + 6) { SetSetting(L"liquid_estilo", k == 0 ? L"nitido" : L"tingido"); Rebuild(); }- };- return glass;-}--Page AparenciaGolden();-Page AparenciaLeopard();-Page Aparencia() {- // Mac OS X Leopard: o painel Aparência do 10.5 (pop-ups Aqua em vez das miniaturas do macOS moderno)- if (Setting(L"leopard", L"0") == L"1" && Setting(L"liquid_glass", L"0") != L"1") return AparenciaLeopard();- // a página do macOS 27 vale para os três temas (o usuário pediu): no Tahoe a foto ganha a escolha Transparente /- // Tingido no lugar do controle; no Sequoia (sem Liquid Glass) só Aparência, Tema e o resto. A antiga fica de reserva.- if (true) return AparenciaGolden();- Page p;- Row modes; modes.kind = Kind::Custom; modes.height = 108;- auto modeIdx = [] { return Setting(L"aparencia_auto", L"0") == L"1" ? 0 : sys::Theme() == 0 ? 1 : 2; };- modes.draw = [modeIdx](Ctx& c, D2D1_RECT_F rr) {- Text(c, L"Aparência", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 140, rr.top + 28), c.body, c.text);- const wchar_t* names[3] = { L"Automático", L"Claro", L"Escuro" };- int cur = modeIdx();- float w = 66, h = 44, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;- for (int k = 0; k < 3; k++) {- D2D1_RECT_F t = D2D1::RectF(x, rr.top + 14, x + w, rr.top + 14 + h);- // miniatura: fundo + janelinha clara/escura (automático: metade de cada)- auto mini = [&](bool dark, D2D1_RECT_F clip) {- c.dc->PushAxisAlignedClip(clip, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);- c.br->SetColor(dark ? D2D1::ColorF(0.12f, 0.2f, 0.42f, 1) : D2D1::ColorF(0.45f, 0.68f, 0.95f, 1));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), c.br);- D2D1_RECT_F win = D2D1::RectF(t.left + 10, t.top + 8, t.right - 10, t.bottom - 6);- c.br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 1) : D2D1::ColorF(0.97f, 0.97f, 0.97f, 1));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(win, 3, 3), c.br);- c.br->SetColor(dark ? D2D1::ColorF(0.3f, 0.3f, 0.32f, 1) : D2D1::ColorF(0.85f, 0.85f, 0.86f, 1));- c.dc->FillRectangle(D2D1::RectF(win.left, win.top + 3, win.left + 12, win.bottom - 1), c.br);- c.br->SetColor(c.accent);- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(win.left + 16, win.top + 6, win.left + 32, win.top + 10), 2, 2), c.br);- c.dc->PopAxisAlignedClip();- };- if (k == 0) { mini(false, D2D1::RectF(t.left, t.top, (t.left + t.right) / 2, t.bottom)); mini(true, D2D1::RectF((t.left + t.right) / 2, t.top, t.right, t.bottom)); }- else mini(k == 2, t);- if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }- Text(c, names[k], D2D1::RectF(t.left - 10, t.bottom + 6, t.right + 10, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);- x += w + gap;- }- };- modes.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- float w = 66, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;- for (int k = 0; k < 3; k++, x += w + gap) {- if (pt.x < x - 6 || pt.x > x + w + 6) continue;- if (k == 0) { // automático: claro de dia, escuro à noite (o Shell troca na hora certa)- SetSetting(L"aparencia_auto", L"1");- SYSTEMTIME st; GetLocalTime(&st);- sys::SetTheme(st.wHour >= 7 && st.wHour < 19 ? 0 : 1);- } else {- SetSetting(L"aparencia_auto", L"0");- sys::SetTheme(k == 1 ? 0 : 1);- }- SetSetting(L"tema", L"auto");- Rebuild();- }- };- Row acc; acc.kind = Kind::Custom; acc.height = 56;- acc.draw = [](Ctx& c, D2D1_RECT_F rr) {- Text(c, L"Cor de destaque", D2D1::RectF(rr.left + 10, rr.top, rr.left + 160, rr.top + 38), c.body, c.text);- std::wstring cur = Setting(L"destaque", L"azul");- float x = rr.right - 10 - 9 * 22 + 8;- for (int k = 0; k < 9; k++, x += 22) {- D2D1_POINT_2F m{ x, rr.top + 19 };- if (k == 0) { // multicor: arco-íris- const UINT32 cols[6] = { 0xE0383E, 0xF7821B, 0xFCB827, 0x62BA46, 0x007AFF, 0x953D96 };- for (int s = 0; s < 6; s++) {- c.br->SetColor(D2D1::ColorF(((cols[s] >> 16) & 255) / 255.f, ((cols[s] >> 8) & 255) / 255.f, (cols[s] & 255) / 255.f, 1));- c.dc->PushAxisAlignedClip(D2D1::RectF(m.x - 8 + s * 16 / 6.f, m.y - 8, m.x - 8 + (s + 1) * 16 / 6.f, m.y + 8), D2D1_ANTIALIAS_MODE_ALIASED);- c.dc->FillEllipse(D2D1::Ellipse(m, 8, 8), c.br);- c.dc->PopAxisAlignedClip();- }- } else {- UINT32 col = ACCENTS[k].second;- c.br->SetColor(D2D1::ColorF(((col >> 16) & 255) / 255.f, ((col >> 8) & 255) / 255.f, (col & 255) / 255.f, 1));- c.dc->FillEllipse(D2D1::Ellipse(m, 8, 8), c.br);- }- c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.12f));- c.dc->DrawEllipse(D2D1::Ellipse(m, 8, 8), c.br, 0.6f);- if (ACCENTS[k].first == cur) { c.br->SetColor(D2D1::ColorF(1, 1, 1, 1)); c.dc->FillEllipse(D2D1::Ellipse(m, 3, 3), c.br); }- }- std::wstring name = L"Azul";- for (int k = 0; k < 9; k++) if (ACCENTS[k].first == cur) name = ACCENT_NAMES[k];- c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_TRAILING);- Text(c, name, D2D1::RectF(rr.left, rr.top + 30, rr.right - 10, rr.top + 48), c.note, c.text2);- c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);- };- acc.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- float x = rr.right - 10 - 9 * 22 + 8;- for (int k = 0; k < 9; k++, x += 22)- if (std::fabs(pt.x - x) <= 10 && std::fabs(pt.y - (rr.top + 19)) <= 10) { SetSetting(L"destaque", k == 0 ? L"azul" : ACCENTS[k].first); Rebuild(); }- };- Row tema = TemaRow();- // o Tema fica sempre livre: com "Reduzir transparência" o vidro só fica opaco (como no Mac)- bool tahoeOn = Setting(L"liquid_glass", L"0") == L"1";- if (!tahoeOn) { p.groups.push_back(G({ tema, modes, acc })); }- else {- // macOS 26 (Aparência): "Liquid Glass" com a escolha Transparente / Tingido (26.1) e "Estilo de ícones e widgets"- // em miniaturas — Padrão, Escuro, Transparente (o modo translúcido) e Tingido. A transparência fina continua em- // Transparência e Efeitos.- Row glass = GlassEstiloRow();- p.groups.push_back(G({ tema, modes, glass }));- static const wchar_t* ESTILOS[] = { L"padrao", L"escuro", L"transparente", L"tingido" };- Row icons; icons.kind = Kind::Custom; icons.height = 96;- icons.draw = [](Ctx& c, D2D1_RECT_F rr) {- Text(c, L"Estilo de ícones e widgets", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 200, rr.top + 28), c.body, c.text);- const wchar_t* names[4] = { L"Padrão", L"Escuro", L"Transparente", L"Tingido" };- std::wstring v = Setting(L"estilo_icones", L"padrao");- int cur = 0;- for (int k = 0; k < 4; k++) if (v == ESTILOS[k]) cur = k;- float w = 52, h = 44, gap = 14, x = rr.right - 10 - 4 * w - 3 * gap;- for (int k = 0; k < 4; k++, x += w + gap) {- D2D1_RECT_F t = D2D1::RectF(x, rr.top + 12, x + w, rr.top + 12 + h);- c.br->SetColor(c.dark ? D2D1::ColorF(0.22f, 0.22f, 0.24f, 1) : D2D1::ColorF(0.88f, 0.89f, 0.92f, 1));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), c.br);- // o ícone de exemplo (quadrado arredondado com uma folha) em cada estilo- float s = 28, cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;- D2D1_RECT_F ic = D2D1::RectF(cx - s / 2, cy - s / 2, cx + s / 2, cy + s / 2);- D2D1_COLOR_F bg, fg;- if (k == 0) { bg = D2D1::ColorF(1, 1, 1, 1); fg = D2D1::ColorF(0.20f, 0.70f, 0.30f, 1); }- else if (k == 1) { bg = D2D1::ColorF(0.13f, 0.13f, 0.14f, 1); fg = D2D1::ColorF(0.30f, 0.82f, 0.42f, 1); }- else if (k == 2) { bg = D2D1::ColorF(1, 1, 1, c.dark ? 0.16f : 0.45f); fg = D2D1::ColorF(1, 1, 1, 0.92f); }- else { bg = D2D1::ColorF(c.accent.r * 0.35f, c.accent.g * 0.35f, c.accent.b * 0.35f, 1); fg = c.accent; }- c.br->SetColor(bg);- c.dc->FillRoundedRectangle(D2D1::RoundedRect(ic, 7, 7), c.br);- if (k == 2) { c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.8f)); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(ic, 7, 7), c.br, 0.8f); }- c.br->SetColor(fg);- c.dc->FillEllipse(D2D1::Ellipse({ cx, cy }, 7, 7), c.br);- if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }- Text(c, names[k], D2D1::RectF(t.left - 12, t.bottom + 6, t.right + 12, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);- }- };- icons.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- float w = 52, gap = 14, x = rr.right - 10 - 4 * w - 3 * gap;- for (int k = 0; k < 4; k++, x += w + gap)- if (pt.x >= x - 5 && pt.x <= x + w + 5) { SetSetting(L"estilo_icones", ESTILOS[k]); Rebuild(); }- };- p.groups.push_back(G({ acc, icons }, L"Tema"));- }- // barras de rolagem: "Sempre" = barras do Windows sempre visíveis (DynamicScrollbars = 0)- p.groups.push_back(G({ Popup(L"Mostrar barras de rolagem", { L"Ao rolar", L"Sempre" },- [] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v ? 0 : 1; },- [](int i) {- DWORD v = i == 0 ? 1 : 0;- RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", REG_DWORD, &v, sizeof(v));- SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Accessibility", SMTO_ABORTIFHUNG, 200, nullptr);- }) }));- if (Setting(L"liquid_glass", L"0") == L"1") p.groups.back().title = L"Janelas";- p.groups.push_back(G({ Link(L"Transparência e Efeitos", [] { Push(L"Transparência e Efeitos", TransparenciaEfeitos); }, 0xE790, C_BLUE) }));- return p;-}--// ================= Aparência no macOS 27 Golden Gate-// Copiada da captura 2x dos Ajustes do macOS 27 (512 Pixels, Settings-Appearance.png), medidas em pt a partir da-// caixa (ver Documents\macOS27-Theme-Reference\MEDIDAS.md):-// caixa 1: Aparência (85,5) com miniaturas 71,5 x 48,5 de passo 82 (Claro, Escuro, Automático), a última a 11 da-// borda, 10,5 do alto, rótulos centrados a 69; Liquid Glass (196 + 36) com a foto 267,5 x 179,5 a 10 da-// borda e 11 do alto, e o controle (trilho a 213 / 33,5 das bordas)-// "Tema" (57,5 entre as caixas); caixa 2: Cor (61) com bolinhas de 23,5, passo 36, a última a 21,75 da borda e o-// centro a 21,25 do alto, nome da escolhida embaixo; Cor do realce do texto (37,5)-// caixa 3: Estilo de ícones e widgets (87,5) com quadrinhos de 29,5, passo 51,5, a 13 da borda e 24 do alto, rótulos-// a 54; Cor das pastas (40). Menus: bolinha de 16, texto a 8,5 dela e o botão redondo a 13,5 da borda.-static D2D1_COLOR_F GGRgb(UINT32 c, float a = 1) { return D2D1::ColorF(((c >> 16) & 255) / 255.f, ((c >> 8) & 255) / 255.f, (c & 255) / 255.f, a); }--// Cor do realce do texto: a cor de seleção do Windows (HKCU\Control Panel\Colors\Hilight + SetSysColors, vale na hora-// para os programas clássicos). A original é guardada em realce_original na 1ª troca e volta com "Automática"-// (registrado em docs\registro-mudancas.txt).-static const UINT32 GG_REALCE[9] = { 0, 0x007AFF, 0x953D96, 0xF74F9E, 0xE0383E, 0xF7821B, 0xFFC726, 0x62BA46, 0x989898 };-static void GGAplicaRealce(int i) {- wchar_t cur[64] = {}; DWORD cb = sizeof(cur);- RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Colors", L"Hilight", RRF_RT_REG_SZ, nullptr, cur, &cb);- std::wstring orig = Setting(L"realce_original", L"");- if (i <= 0) {- if (orig.empty()) { SetSetting(L"realce_texto", L"0"); return; }- int r = 0, g = 0, b = 0;- if (swscanf_s(orig.c_str(), L"%d %d %d", &r, &g, &b) == 3) {- RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Colors", L"Hilight", REG_SZ, orig.c_str(), (DWORD)((orig.size() + 1) * sizeof(wchar_t)));- INT el = COLOR_HIGHLIGHT; COLORREF cr = RGB(r, g, b); SetSysColors(1, &el, &cr);- }- SetSetting(L"realce_original", L"");- SetSetting(L"realce_texto", L"0");- return;- }- if (orig.empty() && cur[0]) SetSetting(L"realce_original", cur);- UINT32 c = GG_REALCE[i];- int r = (c >> 16) & 255, g = (c >> 8) & 255, b = c & 255;- wchar_t v[32]; swprintf_s(v, L"%d %d %d", r, g, b);- RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Colors", L"Hilight", REG_SZ, v, (DWORD)((wcslen(v) + 1) * sizeof(wchar_t)));- INT el = COLOR_HIGHLIGHT; COLORREF cr = RGB(r, g, b); SetSysColors(1, &el, &cr);- SetSetting(L"realce_texto", std::to_wstring(i));-}--Page AparenciaGolden() {- Page p;- // ---- Aparência: Claro, Escuro, Automático- Row modes; modes.kind = Kind::Custom; modes.height = 85.5f;- auto modeIdx = [] { return Setting(L"aparencia_auto", L"0") == L"1" ? 2 : sys::Theme() == 0 ? 0 : 1; };- modes.draw = [modeIdx](Ctx& c, D2D1_RECT_F rr) {- Text(c, L"Aparência", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 160, rr.top + 28), c.body, c.text);- const wchar_t* names[3] = { L"Claro", L"Escuro", L"Automático" };- int cur = modeIdx();- float w = 71.5f, h = 48.5f, pitch = 82, x = rr.right - 11 - w - 2 * pitch;- for (int k = 0; k < 3; k++, x += pitch) {- D2D1_RECT_F t = D2D1::RectF(x, rr.top + 10.5f, x + w, rr.top + 10.5f + h);- ID2D1Factory* fac = nullptr; c.dc->GetFactory(&fac);- ID2D1RoundedRectangleGeometry* rg = nullptr; fac->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 7, 7), &rg);- c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);- auto mini = [&](bool dark, D2D1_RECT_F clip) {- c.dc->PushAxisAlignedClip(clip, D2D1_ANTIALIAS_MODE_ALIASED);- // o papel de parede azul das miniaturas do macOS 27 (claro: céu pálido -> azul; escuro: anil profundo)- D2D1_GRADIENT_STOP st[3] = { { 0, dark ? D2D1::ColorF(0.33f, 0.33f, 0.72f, 1) : D2D1::ColorF(0.80f, 0.82f, 0.86f, 1) },- { 0.55f, dark ? D2D1::ColorF(0.14f, 0.16f, 0.52f, 1) : D2D1::ColorF(0.35f, 0.58f, 0.92f, 1) },- { 1, dark ? D2D1::ColorF(0.05f, 0.07f, 0.28f, 1) : D2D1::ColorF(0.10f, 0.36f, 0.85f, 1) } };- ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;- if (SUCCEEDED(c.dc->CreateGradientStopCollection(st, 3, &gs)) &&- SUCCEEDED(c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ t.left, t.top }, { t.right, t.bottom }), gs, &lb)))- c.dc->FillRectangle(t, lb);- if (lb) lb->Release();- if (gs) gs->Release();- // janelinha de cima à esquerda com a barra na cor de destaque- D2D1_RECT_F top = D2D1::RectF(t.left + 3, t.top + 3, t.left + 44, t.top + 21);- c.br->SetColor(dark ? D2D1::ColorF(0.10f, 0.10f, 0.22f, 0.85f) : D2D1::ColorF(1, 1, 1, 0.72f));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(top, 3.5f, 3.5f), c.br);- c.br->SetColor(c.accent);- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(top.left + 3, top.top + 8, top.right - 3, top.top + 14), 1.5f, 1.5f), c.br);- // janela de baixo à direita com os três botões- D2D1_RECT_F win = D2D1::RectF(t.left + 19, t.top + 26, t.right + 6, t.bottom + 6);- c.br->SetColor(dark ? D2D1::ColorF(0.07f, 0.07f, 0.09f, 1) : D2D1::ColorF(0.97f, 0.97f, 0.97f, 1));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(win, 5, 5), c.br);- const UINT32 lights[3] = { 0xFF6159, 0xFEBC2E, 0x28C840 };- for (int d = 0; d < 3; d++) {- c.br->SetColor(GGRgb(lights[d]));- c.dc->FillEllipse(D2D1::Ellipse({ win.left + 11 + d * 7.5f, win.top + 11 }, 2.6f, 2.6f), c.br);- }- c.dc->PopAxisAlignedClip();- };- if (k == 2) { mini(false, D2D1::RectF(t.left, t.top, (t.left + t.right) / 2, t.bottom)); mini(true, D2D1::RectF((t.left + t.right) / 2, t.top, t.right, t.bottom)); }- else mini(k == 1, t);- c.dc->PopLayer();- if (rg) rg->Release();- if (fac) fac->Release();- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.12f) : D2D1::ColorF(0, 0, 0, 0.10f));- c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left + 0.25f, t.top + 0.25f, t.right - 0.25f, t.bottom - 0.25f), 7, 7), c.br, 0.5f);- if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 2, t.top - 2, t.right + 2, t.bottom + 2), 9, 9), c.br, 3); }- // rótulo de 11 pt (escolhido em negrito), centrado a 69 do alto da linha- Text(c, names[k], D2D1::RectF(t.left - 20, rr.top + 61, t.right + 20, rr.top + 77), k == cur && c.noteBoldCenter ? c.noteBoldCenter : c.noteCenter, k == cur ? c.text : c.text2);- }- };- modes.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- float w = 71.5f, pitch = 82, x = rr.right - 11 - w - 2 * pitch;- for (int k = 0; k < 3; k++, x += pitch) {- if (pt.x < x - 4 || pt.x > x + w + 4) continue;- if (k == 2) { // automático: claro de dia, escuro à noite (o Shell troca na hora certa)- SetSetting(L"aparencia_auto", L"1");- SYSTEMTIME st; GetLocalTime(&st);- sys::SetTheme(st.wHour >= 7 && st.wHour < 19 ? 0 : 1);- } else {- SetSetting(L"aparencia_auto", L"0");- sys::SetTheme(k == 0 ? 0 : 1);- }- SetSetting(L"tema", L"auto");- Rebuild();- }- };- // ---- Liquid Glass: a foto com a barra de vidro de exemplo e o controle embaixo- bool reduce = Setting(L"reduzir_transparencia", L"0") == L"1";- const bool liquidOn = Setting(L"liquid_glass", L"0") == L"1", goldenOn = liquidOn && Setting(L"golden_gate", L"0") == L"1";- Row prev; prev.kind = Kind::Custom; prev.height = 196;- prev.enabled = !reduce;- prev.draw = [](Ctx& c, D2D1_RECT_F rr) {- Text(c, L"Liquid Glass", D2D1::RectF(rr.left + 10, rr.top + 9.5f, rr.left + 160, rr.top + 29.5f), c.body, c.text);- float w = 267.5f, h = 179.5f;- D2D1_RECT_F t = D2D1::RectF(rr.right - 10 - w, rr.top + 11, rr.right - 10, rr.top + 11 + h);- ID2D1Factory* fac = nullptr; c.dc->GetFactory(&fac);- ID2D1RoundedRectangleGeometry* rg = nullptr; fac->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 14, 14), &rg);- c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);- c.br->SetColor(D2D1::ColorF(0.45f, 0.62f, 0.80f, 1));- c.dc->FillRectangle(t, c.br);- D2D1_RECT_F card = D2D1::RectF(t.left, t.bottom - 34.5f, t.right, t.bottom);- std::wstring photo;- wchar_t prof[MAX_PATH];- if (GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) photo = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS\\macOS 27\\macos-27-golden-4096x2160-27635.jpg";- if (photo.empty() || GetFileAttributesW(photo.c_str()) == INVALID_FILE_ATTRIBUTES) photo = sys::Wallpaper();- if (ID2D1Bitmap* b = BitmapFromFile(photo, 640)) { // a foto ocupa o que fica acima do cartão- auto s2 = b->GetSize();- float ph = card.top - t.top, k = std::max(w / s2.width, ph / s2.height);- float bw = s2.width * k, bh = s2.height * k, cx = (t.left + t.right) / 2, cy = t.top + ph / 2;- c.dc->PushAxisAlignedClip(D2D1::RectF(t.left, t.top, t.right, card.top), D2D1_ANTIALIAS_MODE_ALIASED);- c.dc->DrawBitmap(b, D2D1::RectF(cx - bw / 2, cy - bh / 2, cx + bw / 2, cy + bh / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);- c.dc->PopAxisAlignedClip();- }- // cartão de baixo (medido: 234,230,224 no claro) com o título em negrito, cortado pela borda como na referência- c.br->SetColor(c.dark ? D2D1::ColorF(0.16f, 0.16f, 0.17f, 1) : GGRgb(0xEAE6E0));- c.dc->FillRectangle(card, c.br);- Text(c, L"Golden Gate Bridge", D2D1::RectF(card.left + 16.5f, card.top + 9, card.right - 10, card.top + 42), c.title, c.dark ? c.text : D2D1::ColorF(0, 0, 0, 0.85f));- // barra de vidro: quanto mais para a direita o controle, mais opaco o vidro- // Golden Gate: o controle; Tahoe: Transparente (quase nada) ou Tingido (fosco)- float v = Setting(L"golden_gate", L"0") == L"1" ? std::clamp((float)_wtof(Setting(L"vidro_tinta", L"0.5").c_str()), 0.f, 1.f)- : Setting(L"liquid_estilo", L"nitido") == L"tingido" ? 0.85f : 0.15f;- D2D1_COLOR_F fill = c.dark ? D2D1::ColorF(0.20f, 0.20f, 0.21f, 0.18f + 0.72f * v) : D2D1::ColorF(1, 1, 1, 0.28f + 0.66f * v);- D2D1_COLOR_F ink = c.dark ? D2D1::ColorF(1, 1, 1, 0.9f) : D2D1::ColorF(0, 0, 0, 0.82f);- auto pill = [&](D2D1_RECT_F q) {- float rad = (q.bottom - q.top) / 2;- c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.08f));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(q.left, q.top + 1, q.right, q.bottom + 1.5f), rad, rad), c.br);- c.br->SetColor(fill);- c.dc->FillRoundedRectangle(D2D1::RoundedRect(q, rad, rad), c.br);- c.br->SetColor(D2D1::ColorF(1, 1, 1, c.dark ? 0.25f : 0.8f));- c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(q.left + 0.5f, q.top + 0.5f, q.right - 0.5f, q.bottom - 0.5f), rad - 0.5f, rad - 0.5f), c.br, 0.8f);- };- float y0 = t.top + 8, hh = 36;- D2D1_RECT_F g1 = D2D1::RectF(t.left + 8, y0, t.left + 8 + 73.5f, y0 + hh);- D2D1_RECT_F g2 = D2D1::RectF(g1.right + 7.5f, y0, g1.right + 7.5f + hh, y0 + hh);- D2D1_RECT_F g3 = D2D1::RectF(g2.right + 7.5f, y0, t.right - 8.5f, y0 + hh);- pill(g1); pill(g2); pill(g3);- c.br->SetColor(ink);- simbolo::Draw(c.dc, L"square.and.arrow.up", D2D1::RectF(g1.left + 11, y0 + 8, g1.left + 29, y0 + 28), c.br);- for (int k = 0; k < 3; k++) c.dc->FillEllipse(D2D1::Ellipse({ g1.left + 49.5f + k * 5.5f, y0 + hh / 2 }, 1.5f, 1.5f), c.br);- c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(g2.left + 13, y0 + 13, g2.right - 8, y0 + 27), 3, 3), c.br, 1.5f);- c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(g2.left + 9, y0 + 9, g2.right - 12, y0 + 23), 3, 3), c.br, 1.5f);- simbolo::Draw(c.dc, L"magnifyingglass", D2D1::RectF(g3.left + 10, y0 + 11, g3.left + 24, y0 + 25), c.br);- Text(c, L"Buscar", D2D1::RectF(g3.left + 32, y0, g3.right - 6, y0 + hh), c.body, c.dark ? D2D1::ColorF(1, 1, 1, 0.6f) : D2D1::ColorF(0, 0, 0, 0.5f));- c.dc->PopLayer();- if (rg) rg->Release();- if (fac) fac->Release();- };- Row gg = Slider(L"", 0, 1, [] { return (float)_wtof(Setting(L"vidro_tinta", L"0.5").c_str()); },- [](float v) { wchar_t b[16]; swprintf_s(b, L"%.2f", v); SetSetting(L"vidro_tinta", b); Redraw(); }, L"", L"");- gg.height = 36; gg.noLine = true; gg.gg = true; gg.enabled = !reduce;- if (goldenOn) p.groups.push_back(G({ modes, prev, gg }));- else if (liquidOn) { Row ge = GlassEstiloRow(false); ge.noLine = true; p.groups.push_back(G({ modes, prev, ge })); }- else p.groups.push_back(G({ modes }));-- // ---- Tema: cor de destaque (Multicor + 10 cores; as do macOS 27 lidas na captura) e cor do realce do texto- Row color; color.kind = Kind::Custom; color.height = 61;- static const UINT32 GG_COLS[10] = { 0, 0x007AFF, 0x953D96, 0xF74F9E, 0xE0383E, 0xF7821B, 0xFFC726, 0x62BA46, 0x989898, 0x98A8D9 };- static const wchar_t* GG_KEYS[10] = { L"multicor", L"azul", L"roxo", L"rosa", L"vermelho", L"laranja", L"amarelo", L"verde", L"grafite", L"lavanda" };- static const wchar_t* GG_NAMES[10] = { L"Multicor", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite", L"Lavanda" };- color.draw = [](Ctx& c, D2D1_RECT_F rr) {- Text(c, L"Cor", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 120, rr.top + 28), c.body, c.text);- std::wstring cur = Setting(L"destaque", L"azul");- int sel = 1;- for (int k = 0; k < 10; k++) if (cur == GG_KEYS[k]) sel = k;- ID2D1Factory* f = nullptr; c.dc->GetFactory(&f);- for (int k = 0; k < 10; k++) {- D2D1_POINT_2F m{ rr.right - 21.75f - (9 - k) * 36.f, rr.top + 21.25f };- if (k == 0) { // multicor: disco de cores feito em fatias- for (int s = 0; s < 36 && f; s++) {- float a0 = s * 10.f * 3.14159f / 180, a1 = (s + 1.2f) * 10.f * 3.14159f / 180;- float hue = s / 36.f;- float r = std::clamp(std::fabs(hue * 6 - 3) - 1, 0.f, 1.f), g = std::clamp(2 - std::fabs(hue * 6 - 2), 0.f, 1.f), b = std::clamp(2 - std::fabs(hue * 6 - 4), 0.f, 1.f);- ID2D1PathGeometry* pg = nullptr;- if (SUCCEEDED(f->CreatePathGeometry(&pg))) {- ID2D1GeometrySink* sk = nullptr;- if (SUCCEEDED(pg->Open(&sk))) {- sk->BeginFigure(m, D2D1_FIGURE_BEGIN_FILLED);- sk->AddLine({ m.x + 11.75f * std::cos(a0), m.y + 11.75f * std::sin(a0) });- sk->AddLine({ m.x + 11.75f * std::cos(a1), m.y + 11.75f * std::sin(a1) });- sk->EndFigure(D2D1_FIGURE_END_CLOSED);- sk->Close(); sk->Release();- }- c.br->SetColor(D2D1::ColorF(r, g, b, 1));- c.dc->FillGeometry(pg, c.br);- pg->Release();- }- }- } else {- c.br->SetColor(GGRgb(GG_COLS[k]));- c.dc->FillEllipse(D2D1::Ellipse(m, 11.75f, 11.75f), c.br);- }- if (k == sel) { // anel na cor de destaque, com um respiro da cor da caixa- c.br->SetColor(c.dark ? D2D1::ColorF(0.19f, 0.19f, 0.19f, 1) : D2D1::ColorF(0.97f, 0.97f, 0.97f, 1));- c.dc->DrawEllipse(D2D1::Ellipse(m, 12.9f, 12.9f), c.br, 1.5f);- c.br->SetColor(c.accent);- c.dc->DrawEllipse(D2D1::Ellipse(m, 14.5f, 14.5f), c.br, 2.5f);- Text(c, GG_NAMES[k], D2D1::RectF(m.x - 50, rr.top + 36, m.x + 50, rr.top + 52), c.noteCenter, c.text2); // 11 pt, a 44 do alto- }- }- if (f) f->Release();- };- color.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- for (int k = 0; k < 10; k++) {- float x = rr.right - 21.75f - (9 - k) * 36.f;- if (std::fabs(pt.x - x) <= 15 && std::fabs(pt.y - (rr.top + 21.25f)) <= 15) { SetSetting(L"destaque", k == 0 ? L"azul" : GG_KEYS[k]); Rebuild(); }- }- };- Row hl = Popup(L"Cor do realce do texto", { L"Automática", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite" },- [] { return std::clamp(_wtoi(Setting(L"realce_texto", L"0").c_str()), 0, 8); }, [](int i) { GGAplicaRealce(i); Rebuild(); });- hl.gg = true; hl.height = 37.5f;- hl.dot = [](int i) { return i <= 0 ? D2D1::ColorF(0, 0, 0, -1) : GGRgb(GG_REALCE[std::clamp(i, 0, 8)]); };- p.groups.push_back(G({ color, hl }, L"Tema"));-- // ---- Estilo de ícones e widgets (o símbolo do Tempo em cada estilo) e cor das pastas- static const wchar_t* ESTILOS[] = { L"padrao", L"escuro", L"transparente", L"tingido" };- Row icons; icons.kind = Kind::Custom;- // com Escuro escolhido o macOS 27 mostra embaixo "Sempre / Auto" (Auto: escuro só no modo escuro) e a linha cresce- icons.height = Setting(L"estilo_icones", L"padrao") == L"escuro" ? 102.5f : 87.5f;- icons.draw = [](Ctx& c, D2D1_RECT_F rr) {- Text(c, L"Estilo de ícones e widgets", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 220, rr.top + 28), c.body, c.text);- const wchar_t* names[4] = { L"Padrão", L"Escuro", L"Transparente", L"Tingido" };- std::wstring v = Setting(L"estilo_icones", L"padrao");- int cur = 0;- for (int k = 0; k < 4; k++) if (v == ESTILOS[k]) cur = k;- const float s = 29.5f, pitch = 51.5f;- for (int k = 0; k < 4; k++) {- float x = rr.right - 13 - s - (3 - k) * pitch;- D2D1_RECT_F t = D2D1::RectF(x, rr.top + 13, x + s, rr.top + 13 + s); // medido: 13 do alto da linha- D2D1_COLOR_F top, bot;- if (k == 0) { top = GGRgb(0x5AB8F5); bot = GGRgb(0x1E7AE6); }- else if (k == 1) { top = GGRgb(0x2A2A2C); bot = GGRgb(0x0E0E10); }- else if (k == 2) { top = GGRgb(0xA9A9AE); bot = GGRgb(0x7E7E84); }- else { top = D2D1::ColorF(std::min(1.f, c.accent.r + 0.25f), std::min(1.f, c.accent.g + 0.25f), std::min(1.f, c.accent.b + 0.25f), 1); bot = c.accent; }- D2D1_GRADIENT_STOP st[2] = { { 0, top }, { 1, bot } };- ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;- if (SUCCEEDED(c.dc->CreateGradientStopCollection(st, 2, &gs)) &&- SUCCEEDED(c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ t.left, t.top }, { t.left, t.bottom }), gs, &lb)))- c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 7, 7), lb);- if (lb) lb->Release();- if (gs) gs->Release();- // nuvem com o sol atrás (o ícone do Tempo da referência)- float cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;- if (k <= 1) { c.br->SetColor(GGRgb(0xFFC52E)); c.dc->FillEllipse(D2D1::Ellipse({ cx + 4.5f, cy - 4 }, 5.5f, 5.5f), c.br); }- c.br->SetColor(k == 2 ? D2D1::ColorF(0.93f, 0.93f, 0.95f, 1) : D2D1::ColorF(1, 1, 1, 1));- c.dc->FillEllipse(D2D1::Ellipse({ cx - 4, cy + 2.5f }, 5, 4.5f), c.br);- c.dc->FillEllipse(D2D1::Ellipse({ cx + 1, cy }, 5.5f, 5.5f), c.br);- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 9, cy + 1.5f, cx + 9, cy + 7.5f), 3, 3), c.br);- if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 2.5f, t.top - 2.5f, t.right + 2.5f, t.bottom + 2.5f), 9, 9), c.br, 3); }- Text(c, names[k], D2D1::RectF(t.left - 22, rr.top + 46, t.right + 22, rr.top + 62), k == cur && c.noteBoldCenter ? c.noteBoldCenter : c.noteCenter, k == cur ? c.text : c.text2);- }- if (cur == 1) { // medido: bolinhas a 123,5 e 52,5 da borda, textos a 13 delas, centro a 85,5 do alto- bool autoOn = Setting(L"estilo_escuro_auto", L"0") == L"1";- float cy = rr.top + 85.5f;- const wchar_t* labels[2] = { L"Sempre", L"Automático" };- float xs[2] = { rr.right - 123.5f, rr.right - 52.5f };- for (int k = 0; k < 2; k++) {- bool on = (k == 1) == autoOn;- D2D1_POINT_2F m{ xs[k], cy };- if (on) {- c.br->SetColor(c.accent); c.dc->FillEllipse(D2D1::Ellipse(m, 7, 7), c.br);- c.br->SetColor(D2D1::ColorF(1, 1, 1, 1)); c.dc->FillEllipse(D2D1::Ellipse(m, 2.8f, 2.8f), c.br);- } else {- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.08f)); c.dc->FillEllipse(D2D1::Ellipse(m, 7, 7), c.br);- }- Text(c, labels[k], D2D1::RectF(m.x + 13, cy - 10, m.x + 80, cy + 10), c.body, c.text);- }- }- };- icons.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- const float s = 29.5f, pitch = 51.5f;- for (int k = 0; k < 4; k++) {- float x = rr.right - 13 - s - (3 - k) * pitch;- if (pt.x >= x - 10 && pt.x <= x + s + 10 && pt.y >= rr.top + 8 && pt.y <= rr.top + 64) { SetSetting(L"estilo_icones", ESTILOS[k]); Rebuild(); }- }- if (Setting(L"estilo_icones", L"padrao") == L"escuro" && std::fabs(pt.y - (rr.top + 85.5f)) <= 10) {- if (pt.x >= rr.right - 132 && pt.x < rr.right - 60) { SetSetting(L"estilo_escuro_auto", L"0"); Rebuild(); }- else if (pt.x >= rr.right - 60) { SetSetting(L"estilo_escuro_auto", L"1"); Rebuild(); }- }- };- // Cor das pastas: "Automática" segue a cor de destaque; as outras retingem as pastas comuns do Finder (as mesmas cores- // de Personalizar Pasta, finder\pastacor.cpp), gravado em cor_pastas (-1 = automática)- static const UINT32 GG_PASTAS[9] = { 0xFF453A, 0xFF9F0A, 0xFFD60A, 0x30D158, 0x64D2FF, 0x0A84FF, 0xBF5AF2, 0xFF375F, 0x8E8E93 };- Row folder = Popup(L"Cor das pastas", { L"Automática", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Menta", L"Azul", L"Roxo", L"Rosa", L"Cinza" },- [] { return std::clamp(_wtoi(Setting(L"cor_pastas", L"-1").c_str()) + 1, 0, 9); },- [](int i) { SetSetting(L"cor_pastas", std::to_wstring(i - 1)); Rebuild(); });- folder.gg = true; folder.height = 40;- folder.dot = [](int i) { return i <= 0 ? Accent() : GGRgb(GG_PASTAS[std::clamp(i - 1, 0, 8)]); };- p.groups.push_back(G({ icons, folder }));-- // ---- Janelas (barras de rolagem), Transparência e Efeitos e o tema do WacOS- p.groups.push_back(G({ Popup(L"Mostrar barras de rolagem", { L"Ao rolar", L"Sempre" },- [] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v ? 0 : 1; },- [](int i) {- DWORD v = i == 0 ? 1 : 0;- RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", REG_DWORD, &v, sizeof(v));- SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Accessibility", SMTO_ABORTIFHUNG, 200, nullptr);- }) }, L"Janelas"));- p.groups.push_back(G({ Link(L"Transparência e Efeitos", [] { Push(L"Transparência e Efeitos", TransparenciaEfeitos); }, 0xE790, C_BLUE) }));- Row tema = TemaRow();- tema.label = L"Estilo do WacOS";- if (Setting(L"leopard", L"0") == L"1" && Setting(L"liquid_glass", L"0") != L"1") {- // Leopard: o Aurora (o papel de parede padrão do 10.5) só como sugestão; trocar de tema nunca muda o papel de- // parede do usuário (pedido dele), quem troca é este botão- Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", [] {- wchar_t prof[MAX_PATH] = {};- if (!GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) return;- std::wstring f = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS\\Leopard\\os-x-leopard-aurora-5120x3200-24048.jpg";- if (GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES) sys::SetWallpaper(f);- Rebuild();- }, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");- p.groups.push_back(G({ tema, aurora }));- } else p.groups.push_back(G({ tema }));- return p;-}--// ================= Aparência no Mac OS X Leopard-// O painel "Aparência" das Preferências do Sistema do 10.5: Aparência (Azul / Grafite: botões, menus e janelas), Cor-// de realce (a seleção do texto), barras de rolagem, a barra de menus translúcida (10.5.2) e o tema do WacOS.-Page AparenciaLeopard() {- Page p;- p.groups.push_back(G({- Popup(L"Aparência", { L"Azul", L"Grafite" }, [] { return Setting(L"destaque", L"azul") == L"grafite" ? 1 : 0; },- [](int i) { SetSetting(L"destaque", i == 1 ? L"grafite" : L"azul"); Rebuild(); }),- Popup(L"Cor de realce", { L"Automática", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite" },- [] { return std::clamp(_wtoi(Setting(L"realce_texto", L"0").c_str()), 0, 8); }, [](int i) { GGAplicaRealce(i); Rebuild(); }),- Note(L"A aparência vale para os botões, menus e janelas."),- }));- p.groups.push_back(G({- Popup(L"Mostrar barras de rolagem", { L"Ao rolar", L"Sempre" },- [] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v ? 0 : 1; },- [](int i) {- DWORD v = i == 0 ? 1 : 0;- RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", REG_DWORD, &v, sizeof(v));- SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Accessibility", SMTO_ABORTIFHUNG, 200, nullptr);- }),- Toggle(L"Barra de menus translúcida", [] { return Setting(L"barra_translucida", L"1") == L"1"; },- [](bool v) { SetSetting(L"barra_translucida", v ? L"1" : L"0"); Rebuild(); }),- }));- Row tema = TemaRow();- tema.label = L"Estilo do WacOS";- Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", [] {- wchar_t prof[MAX_PATH] = {};- if (!GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) return;- std::wstring f = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS\\Leopard\\os-x-leopard-aurora-5120x3200-24048.jpg";- if (GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES) sys::SetWallpaper(f);- Rebuild();- }, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");- p.groups.push_back(G({ tema, aurora }));- return p;-}--// ================= Aparência > Transparência e Efeitos-// O vidro do Shell (Dock, barra de menus, menus, Central de Controle, Spotlight e painéis): o do-// Sequoia, ou o Liquid Glass do macOS Tahoe (lente nas bordas, brilho especular, cantos redondos)-// em "Nítido" ou "Tingido", como no 26.1. Tudo vai para %APPDATA%\Shell\ajustes.txt e o Shell-// reaplica na hora (mensagem ShellAjustesMudaram).-Page TransparenciaEfeitos() {- Page p;- auto on = [](const wchar_t* k, const wchar_t* d) { return Setting(k, d) == L"1"; };- auto num = [](const wchar_t* k, const wchar_t* d) { return (float)_wtof(Setting(k, d).c_str()); };- bool liquid = on(L"liquid_glass", L"0"), reduce = on(L"reduzir_transparencia", L"0");-- // material: três miniaturas (papel de parede com um Dock de vidro em cima)- Row mat; mat.kind = Kind::Custom; mat.height = 112;- auto current = [] {- if (Setting(L"liquid_glass", L"0") != L"1") return 0;- return Setting(L"liquid_estilo", L"nitido") == L"tingido" ? 2 : 1;- };- mat.draw = [current](Ctx& c, D2D1_RECT_F rr) {- Text(c, L"Material", D2D1::RectF(rr.left + 10, rr.top, rr.left + 160, rr.top + 38), c.body, c.text);- const wchar_t* names[3] = { L"Sequoia", L"Nítido", L"Tingido" };- int cur = current();- float w = 92, h = 58, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;- for (int k = 0; k < 3; k++, x += w + gap) {- D2D1_RECT_F t = D2D1::RectF(x, rr.top + 12, x + w, rr.top + 12 + h);- // papel de parede: degradê com duas manchas de cor- ID2D1GradientStopCollection* gs = nullptr;- D2D1_GRADIENT_STOP st[3] = { { 0, c.dark ? D2D1::ColorF(0.10f, 0.16f, 0.38f, 1) : D2D1::ColorF(0.38f, 0.62f, 0.98f, 1) },- { 0.55f, c.dark ? D2D1::ColorF(0.30f, 0.12f, 0.40f, 1) : D2D1::ColorF(0.78f, 0.52f, 0.95f, 1) },- { 1, c.dark ? D2D1::ColorF(0.55f, 0.20f, 0.25f, 1) : D2D1::ColorF(1.0f, 0.62f, 0.45f, 1) } };- c.dc->CreateGradientStopCollection(st, 3, &gs);- ID2D1LinearGradientBrush* lg = nullptr;- if (gs) c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ t.left, t.top }, { t.right, t.bottom }), gs, &lg);- if (lg) { c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), lg); lg->Release(); }- if (gs) gs->Release();- c.br->SetColor(D2D1::ColorF(1.0f, 0.85f, 0.35f, 0.85f));- c.dc->FillEllipse(D2D1::Ellipse({ t.left + 30, t.bottom - 14 }, 10, 10), c.br);- c.br->SetColor(D2D1::ColorF(0.2f, 0.85f, 0.75f, 0.8f));- c.dc->FillEllipse(D2D1::Ellipse({ t.right - 24, t.bottom - 20 }, 8, 8), c.br);- // "Dock" de vidro- D2D1_RECT_F d = D2D1::RectF(t.left + 12, t.bottom - 22, t.right - 12, t.bottom - 7);- float rad = k == 0 ? 3.5f : 7.5f;- float a = k == 0 ? 0.42f : k == 1 ? 0.16f : 0.62f;- c.br->SetColor(c.dark ? D2D1::ColorF(0.13f, 0.14f, 0.15f, a + 0.1f) : D2D1::ColorF(1, 1, 1, a));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(d, rad, rad), c.br);- if (k == 0) {- c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.5f));- c.dc->DrawRoundedRectangle(D2D1::RoundedRect(d, rad, rad), c.br, 0.6f);- } else { // contorno especular (claro em cima à esquerda e embaixo à direita)- D2D1_GRADIENT_STOP rs[3] = { { 0, D2D1::ColorF(1, 1, 1, 0.95f) }, { 0.5f, D2D1::ColorF(1, 1, 1, 0.15f) }, { 1, D2D1::ColorF(1, 1, 1, 0.7f) } };- gs = nullptr; lg = nullptr;- c.dc->CreateGradientStopCollection(rs, 3, &gs);- if (gs) c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ d.left, d.top }, { d.right, d.bottom }), gs, &lg);- if (lg) { c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(d.left + 0.5f, d.top + 0.5f, d.right - 0.5f, d.bottom - 0.5f), rad - 0.5f, rad - 0.5f), lg, 1.0f); lg->Release(); }- if (gs) gs->Release();- c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.22f));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(d.left + 3, d.top + 1.5f, d.right - 3, d.top + 4.5f), 1.5f, 1.5f), c.br);- }- const UINT32 col[4] = { 0x0A84FF, 0x34C759, 0xFF9500, 0xFF2D55 };- for (int i = 0; i < 4; i++) { // ícones- c.br->SetColor(D2D1::ColorF(((col[i] >> 16) & 255) / 255.f, ((col[i] >> 8) & 255) / 255.f, (col[i] & 255) / 255.f, 1));- float ix = d.left + 7 + i * ((d.right - d.left - 14 - 9) / 3);- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(ix, d.top + 3, ix + 9, d.top + 12), 2.2f, 2.2f), c.br);- }- if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }- Text(c, names[k], D2D1::RectF(t.left - 10, t.bottom + 6, t.right + 10, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);- }- };- mat.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- float w = 92, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;- for (int k = 0; k < 3; k++, x += w + gap) {- if (pt.x < x - 6 || pt.x > x + w + 6) continue;- if (k == 0) { SetSetting(L"liquid_glass", L"0"); SetSetting(L"golden_gate", L"0"); SetSetting(L"leopard", L"0"); } // Sequoia: sai do Golden Gate e do Leopard também- else { SetSetting(L"liquid_estilo", k == 1 ? L"nitido" : L"tingido"); SetSetting(L"liquid_glass", L"1"); }- Rebuild();- }- };- Row lg = Toggle(L"Liquid Glass", [] { return Setting(L"liquid_glass", L"0") == L"1"; },- [](bool v) { SetSetting(L"liquid_glass", v ? L"1" : L"0"); if (!v) SetSetting(L"golden_gate", L"0"); else SetSetting(L"leopard", L"0"); Rebuild(); },- L"O vidro do macOS Tahoe: pouco fosco e mais vivo, com brilho nas bordas e cantos mais redondos.");- lg.enabled = !reduce;- // vidro real: a tela por baixo, com refração de verdade na borda (como o Tahoe); desligado, o vidro- // fosco (aparece em gravações de outros programas, que não veem as peças do vidro real)- Row real = Toggle(L"Vidro real (refração)", [] { return Setting(L"vidro_real", L"1") == L"1"; },- [](bool v) { SetSetting(L"vidro_real", v ? L"1" : L"0"); Rebuild(); },- L"O fundo aparece através do vidro e dobra nas bordas, com o brilho da luz na borda, como no Tahoe. Desligado, o vidro fica fosco.");- real.enabled = liquid && !reduce;- Row refr = Slider(L"Refração nas bordas", 0, 1, [num] { return num(L"liquid_refracao", L"0.6"); },- [](float v) { wchar_t b[16]; swprintf_s(b, L"%.2f", v); SetSetting(L"liquid_refracao", b); }, L"Nenhum", L"Forte");- refr.enabled = liquid && !reduce;- refr.hasDef = true; refr.def = 0.6f;- // (o vidro real é montado pelas janelas de trás e aparece nas gravações: não há mais o que trocar para gravar)- Row redo = Button(L"Se o vidro ficar fosco, preto ou parado, refaz o Liquid Glass sem reiniciar o Shell.", L"Reiniciar o Liquid Glass", [] {- static UINT msg = RegisterWindowMessageW(L"ShellReiniciarVidro");- HWND sh = FindWindowExW(HWND_MESSAGE, nullptr, L"ShellMensagens", nullptr);- if (!sh) sh = FindWindowW(L"ShellMensagens", nullptr);- if (sh) PostMessageW(sh, msg, 0, 0);- });- redo.enabled = liquid && !reduce;- p.groups.push_back(G({ mat, lg, real, refr, redo }, L"Vidro", L"Vale para o Dock, a barra de menus, os menus, a Central de Controle, o Spotlight e os painéis do Shell."));-- Row red = Toggle(L"Reduzir transparência", [] { return Setting(L"reduzir_transparencia", L"0") == L"1"; },- [](bool v) { SetSetting(L"reduzir_transparencia", v ? L"1" : L"0"); Rebuild(); },- L"Deixa o vidro quase opaco (e desliga o Liquid Glass).");- Row tint = Slider(L"Transparência do vidro", 0, 1, [num] { return num(L"vidro_tinta", L"0.5"); },- [](float v) { wchar_t b[16]; swprintf_s(b, L"%.2f", v); SetSetting(L"vidro_tinta", b); }, L"Transparente", L"Opaco");- tint.enabled = !reduce;- tint.hasDef = true; tint.def = 0.5f;- Row bar = Toggle(L"Mostrar fundo da barra de menus", [] { return Setting(L"barra_fundo", L"1") != L"0"; },- [](bool v) { SetSetting(L"barra_fundo", v ? L"1" : L"0"); },- L"Desligado, a barra fica sem fundo, só com o papel de parede atrás (como no Tahoe).");- bar.enabled = !reduce && !liquid; // no Tahoe a barra nunca tem fundo, como no macOS 26+// As páginas do Ajustes do Sistema, na ordem e com os nomes do macOS Sequoia (pt-BR). Cada uma+// mostra e muda o equivalente do Windows; o que não tem como ser feito aqui abre a página do Windows.+#include "ajustes.h"+#include <set>+#include <mutex>+#include <thread>+#include <atomic>+#include <shlobj.h>+#include <shobjidl.h>+#include <shlwapi.h>+#include <shellapi.h>+#include <wincodec.h>+#include <mfapi.h>+#include <mfidl.h>+#include <mfreadwrite.h>+#include <mferror.h>+#include "../comum/simbolos.h" // símbolos SF da prévia do Liquid Glass (Golden Gate)+#include "../comum/siri.h" // Siri com a chave do usuário (issue #39)+#pragma comment(lib, "mfplat.lib")+#pragma comment(lib, "mfreadwrite.lib")+#pragma comment(lib, "mfuuid.lib")++void AskText(const std::wstring& title, const std::wstring& message, const std::wstring& okLabel, bool password,+ std::function<void(const std::wstring&)> ok);++using namespace aj;++Page Armazenamento();++namespace {++// cores dos quadradinhos (as do Ajustes do Mac)+const UINT32 C_BLUE = 0x0A84FF, C_GREEN = 0x34C759, C_GRAY = 0x8E8E93, C_DARK = 0x2C2C2E, C_RED = 0xFF3B30, C_PINK = 0xFF2D55,+ C_INDIGO = 0x5856D6, C_PURPLE = 0xAF52DE, C_CYAN = 0x32ADE6, C_ORANGE = 0xFF9500, C_TEAL = 0x30B0C7;++std::wstring Fmt(const wchar_t* f, ...) {+ wchar_t buf[512];+ va_list a; va_start(a, f); vswprintf_s(buf, Tr(f), a); va_end(a); // o formato no idioma escolhido (mesmos %d/%ls)+ return buf;+}++std::wstring Size(ULONGLONG b) {+ double gb = b / 1e9;+ return gb >= 1000 ? Fmt(L"%.2f TB", gb / 1000) : gb >= 10 ? Fmt(L"%.0f GB", gb) : Fmt(L"%.1f GB", gb);+}++Row Value(const std::wstring& label, std::function<std::wstring()> v) { Row r; r.kind = Kind::Value; r.label = label; r.value = v; return r; }+Row Value(const std::wstring& label, const std::wstring& v) { return Value(label, [v] { return v; }); }+Row Toggle(const std::wstring& label, std::function<bool()> get, std::function<void(bool)> set, const std::wstring& detail = L"") {+ Row r; r.kind = Kind::Toggle; r.label = label; r.get = get; r.set = set; r.detail = detail; return r;+}+Row Popup(const std::wstring& label, std::vector<std::wstring> opts, std::function<int()> get, std::function<void(int)> set) {+ Row r; r.kind = Kind::Popup; r.label = label; r.options = opts; r.getIdx = get; r.setIdx = set; return r;+}+Row Slider(const std::wstring& label, float mn, float mx, std::function<float()> get, std::function<void(float)> set,+ const std::wstring& minG = L"", const std::wstring& maxG = L"") {+ Row r; r.kind = Kind::Slider; r.label = label; r.min = mn; r.max = mx; r.getF = get; r.setF = set; r.minGlyph = minG; r.maxGlyph = maxG; return r;+}+Row Link(const std::wstring& label, std::function<void()> click, wchar_t icon = 0, UINT32 color = 0, std::function<std::wstring()> v = nullptr) {+ Row r; r.kind = Kind::Link; r.label = label; r.click = click; r.icon = icon; r.iconColor = color; r.value = v; return r;+}+Row Uri(const std::wstring& label, const std::wstring& uri, wchar_t icon = 0, UINT32 color = 0) {+ return Link(label, [uri] { OpenUri(uri); }, icon, color);+}+Row Button(const std::wstring& label, const std::wstring& button, std::function<void()> click, const std::wstring& detail = L"") {+ Row r; r.kind = Kind::Button; r.label = label; r.button = button; r.click = click; r.detail = detail; return r;+}+Row Note(const std::wstring& text) { // linha só de texto cinza (explicação)+ Row r; r.kind = Kind::Custom;+ r.height = 0;+ r.draw = [text](Ctx& c, D2D1_RECT_F rr) {+ c.note->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);+ Text(c, text, D2D1::RectF(rr.left + 10, rr.top + 9, rr.right - 10, rr.bottom), c.note, c.text2);+ c.note->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);+ };+ r.height = 38;+ return r;+}+Group G(std::vector<Row> rows, const std::wstring& title = L"", const std::wstring& sub = L"") { Group g; g.rows = std::move(rows); g.title = title; g.subtitle = sub; return g; }++// botões alinhados à direita, fora das caixas (ex.: "Avançado…", "Relatório do Sistema…")+Row Buttons(std::vector<std::pair<std::wstring, std::function<void()>>> bs) {+ Row r; r.kind = Kind::Custom; r.height = 34;+ r.draw = [bs](Ctx& c, D2D1_RECT_F rr) {+ float right = rr.right;+ for (int i = (int)bs.size() - 1; i >= 0; i--) {+ float w = 0;+ IDWriteTextLayout* tl = nullptr;+ if (SUCCEEDED(gfx::dw->CreateTextLayout(bs[i].first.c_str(), (UINT32)bs[i].first.size(), c.center, 400, 30, &tl))) { DWRITE_TEXT_METRICS m{}; tl->GetMetrics(&m); w = m.width; tl->Release(); }+ w = std::max(w + (tahoe::On() ? 28 : 22), 60.f);+ D2D1_RECT_F b = tahoe::On() ? D2D1::RectF(right - w, rr.top + 4, right, rr.top + 30) : D2D1::RectF(right - w, rr.top + 6, right, rr.top + 28);+ ButtonFace(c, b, bs[i].first);+ right = b.left - 10;+ }+ };+ r.clickAt = [bs](D2D1_POINT_2F p, D2D1_RECT_F rr) {+ float right = rr.right;+ for (int i = (int)bs.size() - 1; i >= 0; i--) {+ float w = 0;+ IDWriteTextLayout* tl = nullptr;+ IDWriteTextFormat* tf = nullptr;+ gfx::dw->CreateTextFormat(L"SF Pro Text", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 13, L"pt-br", &tf);+ if (tf && SUCCEEDED(gfx::dw->CreateTextLayout(bs[i].first.c_str(), (UINT32)bs[i].first.size(), tf, 400, 30, &tl))) { DWRITE_TEXT_METRICS m{}; tl->GetMetrics(&m); w = m.width; tl->Release(); }+ if (tf) tf->Release();+ w = std::max(w + (tahoe::On() ? 28 : 22), 60.f);+ if (p.x >= right - w && p.x <= right && p.y >= rr.top + 4 && p.y <= rr.top + 30) { bs[i].second(); return; }+ right -= w + 10;+ }+ };+ return r;+}+Group Plain(Row r) { Group g; g.box = false; g.rows.push_back(r); return g; }++// cabeçalho grande no topo de páginas como Wi-Fi e Bluetooth (ícone + título + descrição)+Row Hero(wchar_t glyph, UINT32 color, const std::wstring& title, const std::wstring& text) {+ Row r; r.kind = Kind::Custom; r.height = 112;+ r.draw = [=](Ctx& c, D2D1_RECT_F rr) {+ float cx = (rr.left + rr.right) / 2;+ Tile(c, D2D1::RectF(cx - 24, rr.top + 14, cx + 24, rr.top + 62), glyph, color, SymbolFor(title));+ IDWriteTextFormat* tf = nullptr;+ gfx::dw->CreateTextFormat(L"SF Pro Display", nullptr, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 15, L"pt-br", &tf);+ if (tf) { tf->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); Text(c, title, D2D1::RectF(rr.left + 10, rr.top + 66, rr.right - 10, rr.top + 86), tf, c.text); tf->Release(); }+ c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);+ c.note->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);+ Text(c, text, D2D1::RectF(rr.left + 40, rr.top + 87, rr.right - 40, rr.bottom), c.note, c.text2);+ c.note->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);+ c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);+ };+ return r;+}++// ---- reaproveitados por várias páginas+const std::vector<int> MINUTES = { 1, 2, 3, 5, 10, 15, 20, 30, 45, 60, 120, 180, 300, 0 };+std::vector<std::wstring> MinuteLabels(const wchar_t* prefix) {+ std::vector<std::wstring> r;+ for (int m : MINUTES) r.push_back(m == 0 ? L"Nunca" : m < 60 ? Fmt(L"%ls%d minuto%ls", Tr(prefix), m, m > 1 ? L"s" : L"") : Fmt(L"%ls%d hora%ls", Tr(prefix), m / 60, m >= 120 ? L"s" : L""));+ return r;+}+int MinuteIndex(int m) {+ if (m == 0) return (int)MINUTES.size() - 1;+ for (int i = 0; i < (int)MINUTES.size() - 1; i++) if (MINUTES[i] >= m) return i;+ return (int)MINUTES.size() - 2;+}++// ================= Conta+Page Conta() {+ const sys::Info& inf = sys::About();+ Page p;+ Row head; head.kind = Kind::Custom; head.height = 150;+ head.draw = [&inf](Ctx& c, D2D1_RECT_F rr) {+ float cx = (rr.left + rr.right) / 2;+ D2D1_POINT_2F m{ cx, rr.top + 52 };+ if (ID2D1Bitmap* pic = sys::AccountPicture()) {+ ID2D1Factory* f = nullptr; c.dc->GetFactory(&f);+ ID2D1EllipseGeometry* eg = nullptr; f->CreateEllipseGeometry(D2D1::Ellipse(m, 40, 40), &eg);+ c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), eg), nullptr);+ c.dc->DrawBitmap(pic, D2D1::RectF(m.x - 40, m.y - 40, m.x + 40, m.y + 40), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);+ c.dc->PopLayer();+ eg->Release(); f->Release();+ } else {+ c.br->SetColor(D2D1::ColorF(0.6f, 0.6f, 0.63f, 1));+ c.dc->FillEllipse(D2D1::Ellipse(m, 40, 40), c.br);+ }+ IDWriteTextFormat* tf = nullptr;+ gfx::dw->CreateTextFormat(L"SF Pro Display", nullptr, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 20, L"pt-br", &tf);+ if (tf) { tf->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); Text(c, inf.fullName, D2D1::RectF(rr.left, rr.top + 100, rr.right, rr.top + 126), tf, c.text); tf->Release(); }+ c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);+ Text(c, inf.user + L" · " + inf.computer, D2D1::RectF(rr.left, rr.top + 126, rr.right, rr.top + 144), c.note, c.text2);+ c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);+ };+ p.groups.push_back(Plain(head));+ p.groups.push_back(G({ Uri(L"Informações Pessoais", L"ms-settings:yourinfo", 0xE77B, C_GRAY),+ Uri(L"Início de Sessão e Segurança", L"ms-settings:signinoptions", 0xE72E, C_GRAY),+ Uri(L"E-mail e Contas", L"ms-settings:emailandaccounts", L'@', C_BLUE) }));+ p.groups.push_back(G({ Uri(L"Família", L"ms-settings:family-group", 0xE716, C_BLUE),+ Uri(L"Backup do Windows (OneDrive)", L"ms-settings:backup", 0xE753, C_CYAN) }));+ return p;+}++// ================= Wi-Fi+Page WiFi() {+ Page p;+ int st = sys::RadioState(sys::RADIO_WIFI);+ if (!sys::WifiPresent() && st == -1) {+ p.groups.push_back(Plain(Hero(0xE701, C_BLUE, L"Wi‑Fi", L"Nenhum adaptador de Wi‑Fi foi encontrado neste computador. A conexão de rede está em Rede.")));+ p.groups.push_back(G({ Link(L"Rede", [] { int i = SidebarIndexFor(L"rede"); (void)i; OpenUri(L"ms-settings:network"); }, 0xE774, C_BLUE) }));+ return p;+ }+ // como no macOS 26: ícone, título com a explicação embaixo e a chave à direita+ Row t = Toggle(L"Wi‑Fi", [] { return sys::RadioState(sys::RADIO_WIFI) == 1; }, [](bool on) { sys::SetRadio(sys::RADIO_WIFI, on); },+ L"Configure o Wi‑Fi para conectar este computador à internet sem fio. Ligue o Wi‑Fi e escolha uma rede.");+ t.icon = 0xE701; t.iconColor = C_BLUE;+ t.height = 64;+ std::wstring cur = sys::WifiCurrent();+ Group top = G({ t });+ if (!cur.empty() && st != 0) { // rede atual: nome, "● Conectado" em verde, cadeado, sinal e Detalhes…+ int sig = 100; bool sec = true;+ for (auto& n : sys::WifiNetworks()) if (n.connected) { sig = n.signal; sec = n.secure; }+ Row r; r.kind = Kind::Custom; r.height = 54;+ r.draw = [cur, sig, sec](Ctx& c, D2D1_RECT_F rr) {+ Text(c, cur, D2D1::RectF(rr.left + 10, rr.top + 7, rr.right - 160, rr.top + 27), c.body, c.text);+ c.br->SetColor(D2D1::ColorF(0.20f, 0.78f, 0.35f, 1));+ c.dc->FillEllipse(D2D1::Ellipse({ rr.left + 15, rr.top + 37 }, 4.5f, 4.5f), c.br);+ Text(c, L"Conectado", D2D1::RectF(rr.left + 25, rr.top + 27, rr.right - 160, rr.top + 47), c.note, c.text2);+ D2D1_RECT_F b = D2D1::RectF(rr.right - 10 - 96, (rr.top + rr.bottom) / 2 - 13, rr.right - 10, (rr.top + rr.bottom) / 2 + 13);+ ButtonFace(c, b, L"Detalhes…");+ float x = b.left - 12;+ D2D1_COLOR_F w = c.text; w.a *= sig > 66 ? 1 : sig > 33 ? 0.75f : 0.5f;+ Text(c, std::wstring(1, (wchar_t)0xE701), D2D1::RectF(x - 18, rr.top, x, rr.bottom), c.glyphSmall, w);+ if (sec) Text(c, std::wstring(1, (wchar_t)0xE72E), D2D1::RectF(x - 40, rr.top, x - 22, rr.bottom), c.glyphSmall, c.text);+ };+ r.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) { if (pt.x > rr.right - 110) OpenUri(L"ms-settings:network-wifi"); };+ top.rows.push_back(r);+ }+ p.groups.push_back(top);+ if (st == 0) return p;+ auto nets = sys::WifiNetworks();+ Group known = G({}, L"Redes Conhecidas"), other = G({}, L"Outras Redes");+ for (auto& n : nets) {+ if (n.connected) continue;+ Row r; r.kind = Kind::Custom; r.height = 42;+ std::wstring ssid = n.ssid; bool secure = n.secure, isKnown = n.known; int signal = n.signal;+ r.draw = [ssid, secure, signal](Ctx& c, D2D1_RECT_F rr) {+ Text(c, ssid, D2D1::RectF(rr.left + 30, rr.top, rr.right - 80, rr.bottom), c.body, c.text);+ float x = rr.right - 12;+ D2D1_COLOR_F weak = c.text; weak.a *= signal > 66 ? 1 : signal > 33 ? 0.7f : 0.45f;+ Text(c, std::wstring(1, (wchar_t)0xE701), D2D1::RectF(x - 18, rr.top, x, rr.bottom), c.glyphSmall, weak);+ if (secure) Text(c, std::wstring(1, (wchar_t)0xE72E), D2D1::RectF(x - 40, rr.top, x - 22, rr.bottom), c.glyphSmall, c.text);+ };+ r.clickAt = [ssid, secure, isKnown](D2D1_POINT_2F, D2D1_RECT_F) {+ if (isKnown || !secure) { sys::WifiConnect(ssid, L"", secure); Rebuild(); return; }+ AskText(Tr(L"A rede Wi‑Fi “") + ssid + Tr(L"” requer uma senha."), L"", L"Conectar", true,+ [ssid](const std::wstring& pw) { sys::WifiConnect(ssid, pw, true); Rebuild(); });+ };+ (isKnown ? known : other).rows.push_back(r);+ }+ if (!known.rows.empty()) p.groups.push_back(known);+ if (!other.rows.empty()) p.groups.push_back(other);+ if (!cur.empty()) p.groups.push_back(G({ Button(Tr(L"Desconectar de “") + cur + L"”", L"Desconectar", [] { sys::WifiDisconnect(); Rebuild(); }) }));+ p.groups.push_back(Plain(Buttons({ { L"Avançado…", [] { OpenUri(L"ms-settings:network-wifisettings"); } } })));+ return p;+}++// ================= Bluetooth+Page Bluetooth() {+ Page p;+ int st = sys::RadioState(sys::RADIO_BT);+ if (st == -1) {+ p.groups.push_back(Plain(Hero(0xE702, C_BLUE, L"Bluetooth", L"Nenhum adaptador Bluetooth foi encontrado neste computador.")));+ return p;+ }+ wchar_t name[64]; DWORD n = 64; GetComputerNameW(name, &n);+ Row t = Toggle(L"Bluetooth", [] { return sys::RadioState(sys::RADIO_BT) == 1; }, [](bool on) { sys::SetRadio(sys::RADIO_BT, on); },+ L"Conecte acessórios para ouvir música, digitar e jogar.");+ t.icon = 0xE702; t.iconColor = C_BLUE;+ Group top = G({ t });+ if (st == 1) top.rows.push_back(Note(std::wstring(Tr(L"Este computador está detectável como “")) + name + Tr(L"” enquanto os ajustes do Bluetooth estão abertos.")));+ p.groups.push_back(top);+ if (st == 0) return p;+ Group mine = G({}, L"Meus Dispositivos");+ for (auto& d : sys::BluetoothDevices()) {+ // ícone pelo tipo (classe Bluetooth: periférico = mouse/teclado, áudio = fone), nome e o estado embaixo, (i) à direita+ Row r; r.kind = Kind::Custom; r.height = 52;+ std::wstring nm = d.name; bool con = d.connected; ULONG cls = d.cls;+ r.draw = [nm, con, cls](Ctx& c, D2D1_RECT_F rr) {+ ULONG major = (cls >> 8) & 0x1F, minor = (cls >> 2) & 0x3F;+ wchar_t g = major == 4 ? 0xE7F6 /*fone*/ : major == 5 ? ((minor & 0x10) ? 0xE765 /*teclado*/ : 0xE962 /*mouse*/) : major == 2 ? 0xE8EA /*celular*/ : 0xE702;+ Text(c, std::wstring(1, g), D2D1::RectF(rr.left + 10, rr.top, rr.left + 36, rr.bottom), c.glyph, c.text2);+ Text(c, nm, D2D1::RectF(rr.left + 46, rr.top + 7, rr.right - 50, rr.top + 27), c.body, c.text);+ Text(c, con ? L"Conectado" : L"Não Conectado", D2D1::RectF(rr.left + 46, rr.top + 27, rr.right - 50, rr.top + 45), c.note, c.text2);+ float cx = rr.right - 22, cy = (rr.top + rr.bottom) / 2; // (i)+ c.br->SetColor(c.text2);+ c.dc->DrawEllipse(D2D1::Ellipse({ cx, cy }, 9, 9), c.br, 1.2f);+ Text(c, L"i", D2D1::RectF(cx - 9, cy - 9, cx + 9, cy + 9), c.center, c.text2);+ };+ r.clickAt = [](D2D1_POINT_2F, D2D1_RECT_F) { OpenUri(L"ms-settings:bluetooth"); };+ mine.rows.push_back(r);+ }+ if (mine.rows.empty()) mine.rows.push_back(Note(L"Nenhum dispositivo emparelhado."));+ p.groups.push_back(mine);+ p.groups.push_back(G({ Button(L"Novo dispositivo", L"Adicionar…", [] {+ wchar_t sysdir[MAX_PATH]; GetSystemDirectoryW(sysdir, MAX_PATH);+ ShellExecuteW(nullptr, L"open", (std::wstring(sysdir) + L"\\DevicePairingWizard.exe").c_str(), nullptr, nullptr, SW_SHOWNORMAL);+ }) }, L"Dispositivos Próximos"));+ p.groups.push_back(Plain(Buttons({ { L"Avançado…", [] { OpenUri(L"ms-settings:bluetooth"); } } })));+ return p;+}++// ================= Rede+Page RedeDetalhe(sys::NetIf n) {+ Page p;+ p.groups.push_back(G({ Value(L"Status", n.up ? L"Conectado" : L"Não conectado"), Value(L"Tipo", n.kind), Value(L"Endereço IP", n.ip.empty() ? L"—" : n.ip) }));+ p.groups.push_back(Plain(Buttons({ { L"Ajustes do Adaptador…", [] { OpenUri(L"ms-settings:network-advancedsettings"); } } })));+ return p;+}++Page Rede() {+ Page p;+ Group ifs = G({});+ for (auto& n : sys::Interfaces()) {+ Row r = Link(n.name, [n] { Push(n.name, [n] { return RedeDetalhe(n); }); }, n.kind == L"Ethernet" ? (wchar_t)0xE839 : (wchar_t)0xE701, C_BLUE,+ [up = n.up] { return std::wstring(up ? L"Conectado" : L"Não conectado"); });+ ifs.rows.push_back(r);+ }+ if (ifs.rows.empty()) ifs.rows.push_back(Note(L"Nenhum adaptador de rede encontrado."));+ p.groups.push_back(ifs);+ p.groups.push_back(G({ Uri(L"Firewall", L"windowsdefender://network", 0xE83D, C_RED),+ Uri(L"VPN", L"ms-settings:network-vpn", 0xE705, C_BLUE),+ Uri(L"Proxies", L"ms-settings:network-proxy", 0xE774, C_GRAY) }, L"Outros Serviços"));+ return p;+}++// ================= Energia / Bateria+Page Energia() {+ Page p;+ int pct = 0; bool charging = false;+ if (sys::HasBattery(&pct, &charging))+ p.groups.push_back(G({ Value(L"Nível da Bateria", Fmt(L"%d%%%ls", pct, charging ? Tr(L" (carregando)") : L"")) }));+ p.groups.push_back(G({ Popup(L"Modo de Energia", { L"Economia de Energia", L"Equilibrado", L"Melhor Desempenho" }, [] { return sys::PowerMode(); },+ [](int i) { sys::SetPowerMode(i); }) }));+ p.groups.push_back(G({ Popup(L"Desligar a tela quando inativo", MinuteLabels(L"Após "), [] { return MinuteIndex(sys::DisplayOffMinutes()); },+ [](int i) { sys::SetDisplayOffMinutes(MINUTES[i]); }),+ Popup(L"Repousar quando inativo", MinuteLabels(L"Após "), [] { return MinuteIndex(sys::SleepMinutes()); },+ [](int i) { sys::SetSleepMinutes(MINUTES[i]); }) }));+ // App Nap do Mac (shell\memoria.cpp): o Shell põe no modo eficiência do Windows quem está fora de vista+ p.groups.push_back(G({ Toggle(L"Soneca de Apps", [] { return Setting(L"app_nap", L"1") != L"0"; },+ [](bool v) { SetSetting(L"app_nap", v ? L"1" : L"0"); },+ L"Programas com todas as janelas escondidas, minimizadas ou cobertas por 30 segundos passam a gastar menos processador, como o App Nap do Mac. Voltam ao normal assim que aparecem. Não vale para o que está tocando ou gravando som.") }));+ // Modo Jogo do Mac (shell\jogo.cpp): jogo na frente → o Shell desliga o que mais pesa até o jogo fechar+ p.groups.push_back(G({ Toggle(L"Modo Jogo", [] { return Setting(L"modo_jogo", L"1") != L"0"; },+ [](bool v) { SetSetting(L"modo_jogo", v ? L"1" : L"0"); },+ L"Quando um jogo vem para a frente, o WacOS desliga o vidro real, os efeitos que acompanham o mouse e os Cantos Ativos e passa a usar menos processador, até o jogo fechar. Jogos que não forem reconhecidos podem ser postos em jogos.txt, na pasta de ajustes.") }));+ p.groups.push_back(Plain(Buttons({ { L"Opções de Energia…", [] { OpenUri(L"ms-settings:powersleep"); } } })));+ return p;+}++// ================= Geral+Page Sobre() {+ const sys::Info& i = sys::About();+ Page p;+ Row head; head.kind = Kind::Custom; head.height = 150;+ std::wstring model = i.model.empty() ? L"PC" : i.model;+ head.draw = [model](Ctx& c, D2D1_RECT_F rr) {+ float cx = (rr.left + rr.right) / 2;+ // monitor desenhado (no lugar da foto do Mac)+ D2D1_RECT_F scr = D2D1::RectF(cx - 52, rr.top + 14, cx + 52, rr.top + 80);+ c.br->SetColor(D2D1::ColorF(0.12f, 0.12f, 0.13f, 1));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(scr, 5, 5), c.br);+ ID2D1GradientStopCollection* st = nullptr;+ D2D1_GRADIENT_STOP gs[2] = { { 0, D2D1::ColorF(0.24f, 0.55f, 0.95f, 1) }, { 1, D2D1::ColorF(0.55f, 0.32f, 0.85f, 1) } };+ c.dc->CreateGradientStopCollection(gs, 2, &st);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (st) c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ scr.left, scr.top }, { scr.right, scr.bottom }), st, &lg);+ if (lg) { c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(scr.left + 3, scr.top + 3, scr.right - 3, scr.bottom - 3), 3, 3), lg); lg->Release(); }+ if (st) st->Release();+ c.br->SetColor(c.dark ? D2D1::ColorF(0.6f, 0.6f, 0.62f, 1) : D2D1::ColorF(0.72f, 0.72f, 0.74f, 1));+ c.dc->FillRectangle(D2D1::RectF(cx - 8, scr.bottom, cx + 8, scr.bottom + 12), c.br);+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 24, scr.bottom + 11, cx + 24, scr.bottom + 15), 2, 2), c.br);+ IDWriteTextFormat* tf = nullptr;+ gfx::dw->CreateTextFormat(L"SF Pro Display", nullptr, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 20, L"pt-br", &tf);+ if (tf) { tf->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); Text(c, model, D2D1::RectF(rr.left, rr.top + 102, rr.right, rr.top + 128), tf, c.text); tf->Release(); }+ };+ p.groups.push_back(Plain(head));+ p.groups.push_back(G({ Value(L"Nome", i.computer), Value(L"Processador", i.cpu), Value(L"Memória", i.ram), Value(L"Gráficos", i.gpu) }));+ p.groups.push_back(G({ Value(L"Windows", i.windows), Value(L"Compilação", i.build) }, L"Sistema"));+ auto mode = sys::CurrentResolution();+ p.groups.push_back(G({ Button(L"Tela", L"Ajustes de Telas…", [] { int k = SidebarIndexFor(L"telas"); if (k >= 0) { HWND w = Window(); COPYDATASTRUCT cd{ 0x414A5354, 10, (void*)L"telas" }; SendMessageW(w, WM_COPYDATA, 0, (LPARAM)&cd); } },+ Fmt(L"%d × %d", mode.w, mode.h)) }, L"Telas"));+ std::vector<Row> disks;+ for (auto& d : sys::Disks())+ disks.push_back(Button(d.label.empty() ? d.root : d.label + L" (" + d.root.substr(0, 2) + L")", L"Ajustes de Armazenamento…",+ [] { Push(L"Armazenamento", Armazenamento); },+ Size(d.free) + Tr(L" disponíveis de ") + Size(d.total)));+ if (!disks.empty()) p.groups.push_back(G(disks, L"Armazenamento"));+ // o que o "Sobre Este Mac" do menu da Apple mostra (sobre_mac=, src\shell\sobre.cpp): este PC ou o Mac Studio de enfeite+ p.groups.push_back(G({ Popup(L"Sobre Este Mac mostra", { L"Este PC", L"Mac Studio" },+ [] { return Setting(L"sobre_mac", L"pc") == L"macstudio" ? 1 : 0; },+ [](int i) { SetSetting(L"sobre_mac", i == 1 ? L"macstudio" : L"pc"); }),+ Note(L"A janela do menu da Apple: os dados reais deste computador ou um Mac Studio de enfeite.") }, L"Menu da Apple"));+ p.groups.push_back(Plain(Buttons({ { L"Relatório do Sistema…",[] { ShellExecuteW(nullptr, L"open", L"msinfo32.exe", nullptr, nullptr, SW_SHOWNORMAL); } } })));+ return p;+}++} // namespace++Page Armazenamento() {+ Page p;+ for (auto& d : sys::Disks()) {+ Row r; r.kind = Kind::Custom; r.height = 84;+ std::wstring name = (d.label.empty() ? std::wstring(Tr(L"Disco Local")) : d.label) + L" (" + d.root.substr(0, 2) + L")";+ ULONGLONG total = d.total, freeB = d.free;+ r.draw = [name, total, freeB](Ctx& c, D2D1_RECT_F rr) {+ Text(c, name, D2D1::RectF(rr.left + 12, rr.top + 10, rr.right - 12, rr.top + 28), c.bold, c.text);+ Text(c, Size(total - freeB) + Tr(L" usados de ") + Size(total), D2D1::RectF(rr.left + 12, rr.top + 28, rr.right - 12, rr.top + 44), c.note, c.text2);+ D2D1_RECT_F bar = D2D1::RectF(rr.left + 12, rr.top + 52, rr.right - 12, rr.top + 66);+ c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.10f) : D2D1::ColorF(0, 0, 0, 0.07f));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(bar, 4, 4), c.br);+ float k = total ? (float)(total - freeB) / total : 0;+ c.br->SetColor(D2D1::ColorF(1.0f, 0.62f, 0.04f, 1));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(bar.left, bar.top, bar.left + (bar.right - bar.left) * k, bar.bottom), 4, 4), c.br);+ };+ p.groups.push_back(G({ r }));+ }+ p.groups.push_back(Plain(Buttons({ { L"Recomendações…", [] { OpenUri(L"ms-settings:storagesense"); } } })));+ return p;+}++namespace {++// ---- Atualização do WacOS pelo GitHub (tools\atualizar-github.ps1). Ao abrir a página o Ajustes confere sozinho,+// numa thread, a versão instalada (bin\versao.txt), a mais nova publicada e os commits que faltam; o botão só+// aparece quando há o que instalar e roda o mesmo script, que baixa e troca só o que mudou.+static std::wstring BinDir();+struct Upd { int state = 0; std::wstring atual, novo, data, erro; std::vector<std::wstring> faltam; }; // 0 nada, 1 procurando, 2 pronto+static Upd g_upd;+static std::mutex g_updMu;+static std::wstring UpdScript() {+ std::wstring root = BinDir(); root = root.substr(0, root.find_last_of(L'\\'));+ return root + L"\\tools\\atualizar-github.ps1";+}+static void UpdCheck() {+ { std::lock_guard<std::mutex> lk(g_updMu); if (g_upd.state == 1) return; g_upd.state = 1; }+ std::thread([] {+ Upd u; u.state = 2;+ wchar_t tmp[MAX_PATH], f[MAX_PATH]; GetTempPathW(MAX_PATH, tmp); GetTempFileNameW(tmp, L"wac", 0, f);+ std::wstring cmd = L"powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"" + UpdScript() + L"\" -Verificar -Saida \"" + f + L"\" -Bin \"" + BinDir() + L"\"";+ STARTUPINFOW si{ sizeof(si) }; PROCESS_INFORMATION pi{};+ if (CreateProcessW(nullptr, cmd.data(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW, nullptr, nullptr, &si, &pi)) {+ // rede parada: encerra o script (antes ele seguia rodando escondido depois de o Ajustes desistir)+ if (WaitForSingleObject(pi.hProcess, 45000) == WAIT_TIMEOUT) TerminateProcess(pi.hProcess, 1);+ CloseHandle(pi.hThread); CloseHandle(pi.hProcess);+ }+ FILE* fp = nullptr;+ if (!_wfopen_s(&fp, f, L"r, ccs=UTF-8") && fp) {+ wchar_t line[1024];+ while (fgetws(line, 1024, fp)) {+ std::wstring l = line;+ while (!l.empty() && (l.back() == L'\n' || l.back() == L'\r')) l.pop_back();+ if (!l.empty() && l[0] == 0xFEFF) l.erase(0, 1);+ auto val = [&](const wchar_t* k) { size_t n = wcslen(k); return l.compare(0, n, k) == 0 ? l.substr(n) : std::wstring(1, 0); };+ if (auto v = val(L"atual="); v != std::wstring(1, 0)) u.atual = v;+ else if (auto v2 = val(L"novo="); v2 != std::wstring(1, 0)) u.novo = v2;+ else if (auto v3 = val(L"data="); v3 != std::wstring(1, 0)) u.data = v3;+ else if (auto v4 = val(L"erro="); v4 != std::wstring(1, 0)) u.erro = v4;+ else if (auto v5 = val(L"commit="); v5 != std::wstring(1, 0)) u.faltam.push_back(v5);+ }+ fclose(fp);+ } else u.erro = Tr(L"não deu para conferir agora");+ DeleteFileW(f);+ if (u.novo.empty() && u.erro.empty()) u.erro = Tr(L"não deu para conferir agora");+ { std::lock_guard<std::mutex> lk(g_updMu); g_upd = u; }+ aj::Rebuild();+ }).detach();+}++Page Atualizacao() {+ const sys::Info& i = sys::About();+ Page p;+ Upd u;+ { std::lock_guard<std::mutex> lk(g_updMu); u = g_upd; }+ if (u.state == 0) { UpdCheck(); u.state = 1; }+ bool tem = u.state == 2 && !u.novo.empty() && u.novo != u.atual;+ std::vector<Row> rows;+ rows.push_back(Value(L"Versão instalada", u.atual.empty() ? (u.state == 2 ? Tr(L"desconhecida") : Tr(L"Procurando…")) : u.atual));+ rows.push_back(Value(L"Versão mais nova", u.state == 1 ? Tr(L"Procurando…") : !u.erro.empty() ? u.erro : u.novo + (u.data.empty() ? L"" : L" (" + u.data + L")")));+ if (tem) {+ std::wstring label = u.faltam.empty() ? Tr(L"Há uma versão nova do WacOS.")+ : std::to_wstring(u.faltam.size()) + (u.faltam.size() == 1 ? Tr(L" mudança para instalar.") : Tr(L" mudanças para instalar."));+ rows.push_back(Button(label, L"Atualizar Agora", [] {+ // o instalador do WacOS (WacOSSetup.exe, na pasta da instalação): baixa, confere e instala, com janela própria+ std::wstring setup = BinDir().substr(0, BinDir().find_last_of(L'\\')) + L"\\WacOSSetup.exe";+ if (GetFileAttributesW(setup.c_str()) != INVALID_FILE_ATTRIBUTES) {+ ShellExecuteW(nullptr, L"open", setup.c_str(), L"--atualizar", nullptr, SW_SHOWNORMAL);+ return;+ }+ std::wstring cmd = L"powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"" + UpdScript() + L"\"";+ STARTUPINFOW si{ sizeof(si) }; PROCESS_INFORMATION pi{};+ if (CreateProcessW(nullptr, cmd.data(), nullptr, nullptr, FALSE, CREATE_NEW_CONSOLE, nullptr, nullptr, &si, &pi)) { CloseHandle(pi.hThread); CloseHandle(pi.hProcess); }+ }));+ } else if (u.state == 2 && u.erro.empty()) rows.push_back(Note(Tr(L"O WacOS está atualizado.")));+ rows.push_back(Button(L"Confere de novo no GitHub.", L"Procurar Atualizações", [] { { std::lock_guard<std::mutex> lk(g_updMu); g_upd.state = 0; } aj::Rebuild(); }));+ p.groups.push_back(G(rows, L"WacOS"));+ p.groups.push_back(G({ Toggle(L"Avisar quando houver atualização", [] { return Setting(L"avisar_atualizacao", L"1") != L"0"; },+ [](bool v) { SetSetting(L"avisar_atualizacao", v ? L"1" : L"0"); },+ L"O WacOS confere o GitHub ao entrar e a cada 6 horas e mostra uma notificação quando sai uma versão nova.") }));+ if (tem && !u.faltam.empty()) {+ std::vector<Row> ch;+ for (size_t k = 0; k < u.faltam.size() && k < 15; k++) ch.push_back(Note(L"• " + u.faltam[k]));+ if (u.faltam.size() > 15) ch.push_back(Note(L"… +" + std::to_wstring(u.faltam.size() - 15)));+ p.groups.push_back(G(ch, L"O que falta"));+ }+ p.groups.push_back(G({ Button(L"O Windows Update cuida das atualizações deste computador.", L"Abrir o Windows Update…", [] { OpenUri(L"ms-settings:windowsupdate"); }) }, L"Windows"));+ p.groups.push_back(G({ Value(L"Instalado", i.windows + L" (" + i.build + L")"), Link(L"Atualizações Automáticas", [] { OpenUri(L"ms-settings:windowsupdate-options"); }) }));+ return p;+}++Page Inicio() {+ Page p;+ Group g = G({}, L"Abrir ao Iniciar Sessão", L"Estes itens abrem automaticamente quando você inicia a sessão.");+ for (auto& s : sys::StartupItems()) {+ std::wstring name = s.name;+ g.rows.push_back(Toggle(name, [name] { for (auto& x : sys::StartupItems()) if (x.name == name) return x.enabled; return false; },+ [name](bool on) { sys::SetStartupEnabled(name, on); }));+ }+ if (g.rows.empty()) g.rows.push_back(Note(L"Nenhum item."));+ p.groups.push_back(g);+ p.groups.push_back(Plain(Buttons({ { L"Mais Itens…", [] { OpenUri(L"ms-settings:startupapps"); } } })));+ return p;+}++Page DataHora() {+ Page p;+ TIME_ZONE_INFORMATION tz{};+ GetTimeZoneInformation(&tz);+ std::wstring zone = tz.StandardName;+ p.groups.push_back(G({+ Value(L"Data e hora", [] {+ SYSTEMTIME st; GetLocalTime(&st);+ wchar_t d[64], t[32];+ GetDateFormatEx(LOCALE_NAME_USER_DEFAULT, DATE_LONGDATE, &st, nullptr, d, 64, nullptr);+ GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, t, 32);+ return std::wstring(d) + L", " + t;+ }),+ Value(L"Fuso horário", zone),+ }));+ p.groups.push_back(Plain(Buttons({ { L"Ajustar…", [] { OpenUri(L"ms-settings:dateandtime"); } } })));+ return p;+}++// ================= O próprio WacOS (Geral): abrir ao entrar no Windows, pastas no Finder, desligar+// A tarefa agendada "WacOS" (a mesma do instalador e do docs\iniciar-com-windows.ps1) abre o Shell no login.+static std::wstring BinDir() {+ wchar_t exe[MAX_PATH]; GetModuleFileNameW(nullptr, exe, MAX_PATH);+ std::wstring d = exe;+ return d.substr(0, d.find_last_of(L'\\'));+}+static DWORD RunHidden(std::wstring cmd, DWORD waitMs = 15000) {+ STARTUPINFOW si{ sizeof(si) }; PROCESS_INFORMATION pi{};+ DWORD code = 1;+ if (!CreateProcessW(nullptr, cmd.data(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW, nullptr, nullptr, &si, &pi)) return code;+ WaitForSingleObject(pi.hProcess, waitMs);+ GetExitCodeProcess(pi.hProcess, &code);+ CloseHandle(pi.hThread); CloseHandle(pi.hProcess);+ return code;+}+static bool ShellAutoStart() { return RunHidden(L"schtasks.exe /Query /TN WacOS", 5000) == 0; }+// A chave "Abrir ao entrar no Windows" lia o estado rodando o schtasks.exe A CADA DESENHO da linha (13-33 ms por+// processo, medido em 20/11/2026): rolar a página Geral até o fim, onde ela fica, travava a rolagem (cada quadro+// esperava um processo). Agora o estado é lido uma vez, numa thread, e guardado; o clique muda o guardado na hora.+static std::atomic<int> g_autoStart{ -1 }; // -1 não lido, -2 lendo, 0/1+static bool ShellAutoStartCached() {+ int v = g_autoStart.load();+ if (v == -1 && g_autoStart.compare_exchange_strong(v, -2))+ std::thread([] { g_autoStart = ShellAutoStart() ? 1 : 0; aj::Rebuild(); }).detach();+ return g_autoStart.load() == 1;+}+static void SetShellAutoStart(bool on);+static void SetShellAutoStartAsync(bool on) {+ g_autoStart = on ? 1 : 0;+ std::thread([on] { SetShellAutoStart(on); g_autoStart = ShellAutoStart() ? 1 : 0; aj::Rebuild(); }).detach();+}+static void SetShellAutoStart(bool on) {+ if (!on) { RunHidden(L"schtasks.exe /Delete /TN WacOS /F"); return; }+ // texto entre aspas simples do PowerShell: a aspa simples dobra (pasta de um usuário como O'Brien)+ auto lit = [](std::wstring s) { for (size_t i = 0; (i = s.find(L'\'', i)) != std::wstring::npos; i += 2) s.insert(i, 1, L'\''); return L"'" + s + L"'"; };+ std::wstring exe = BinDir() + L"\\WacOSShell.exe";+ // ao fazer logon, só para este usuário, sem administrador (o schtasks /SC ONLOGON pediria administrador)+ std::wstring ps = L"$u = $env:USERDOMAIN + '\\' + $env:USERNAME; Register-ScheduledTask -TaskName WacOS -Force "+ L"-Action (New-ScheduledTaskAction -Execute " + lit(exe) + L" -WorkingDirectory " + lit(BinDir()) + L") "+ L"-Trigger (New-ScheduledTaskTrigger -AtLogOn -User $u) "+ L"-Settings (New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit ([TimeSpan]::Zero) -Priority 4 -MultipleInstances IgnoreNew) "+ L"-Principal (New-ScheduledTaskPrincipal -UserId $u -LogonType Interactive -RunLevel Limited) | Out-Null";+ // O comando vai codificado (-EncodedCommand: UTF-16 em base64), sem aspas na linha de comando. Antes ia em+ // -Command "...", e as aspas duplas de dentro ($u="...") fechavam o argumento no meio: erro de sintaxe, a tarefa+ // nunca era criada e "Abrir ao entrar no Windows" voltava a desligado sem aviso (PR #17 apontou, 21/11/2026).+ static const char* B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";+ std::string bytes;+ for (wchar_t c : ps) { bytes += (char)(c & 0xFF); bytes += (char)((c >> 8) & 0xFF); }+ std::wstring enc;+ for (size_t i = 0; i < bytes.size(); i += 3) {+ unsigned v = (unsigned char)bytes[i] << 16 | (i + 1 < bytes.size() ? (unsigned char)bytes[i + 1] << 8 : 0) | (i + 2 < bytes.size() ? (unsigned char)bytes[i + 2] : 0);+ enc += (wchar_t)B64[(v >> 18) & 63]; enc += (wchar_t)B64[(v >> 12) & 63];+ enc += i + 1 < bytes.size() ? (wchar_t)B64[(v >> 6) & 63] : L'=';+ enc += i + 2 < bytes.size() ? (wchar_t)B64[v & 63] : L'=';+ }+ RunHidden(L"powershell.exe -NoProfile -ExecutionPolicy Bypass -EncodedCommand " + enc, 30000);+}+// "Abrir no lugar da área de trabalho do Windows" (issue #39): o WacOSShell vira o shell do Windows deste usuário+// (HKCU\...\Winlogon, valor Shell). Ele abre logo no login, no lugar em que o Explorador abriria, e o Shell põe o Explorador+// no fundo sozinho (mesa.cpp, StartExplorer). Desligado, o valor é apagado e vale o do Windows (explorer.exe).+static const wchar_t* WINLOGON_K = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon";+static bool ShellDoWindows() {+ wchar_t b[1024]; DWORD cb = sizeof(b);+ if (RegGetValueW(HKEY_CURRENT_USER, WINLOGON_K, L"Shell", RRF_RT_REG_SZ, nullptr, b, &cb) != ERROR_SUCCESS) return false;+ std::wstring v = b; for (auto& c : v) c = (wchar_t)towlower(c);+ return v.find(L"wacosshell.exe") != std::wstring::npos || v.find(L"sequoiashell.exe") != std::wstring::npos;+}+static void SetShellDoWindows(bool on) {+ if (!on) { RegDeleteKeyValueW(HKEY_CURRENT_USER, WINLOGON_K, L"Shell"); return; }+ std::wstring exe = BinDir() + L"\\WacOSShell.exe";+ if (GetFileAttributesW(exe.c_str()) == INVALID_FILE_ATTRIBUTES) return;+ int r = MessageBoxW(GetActiveWindow(),+ Tr(L"No próximo login, o WacOS abre no lugar da área de trabalho do Windows, antes do Explorador, sem a tela do Windows "+ L"aparecer antes. O Explorador continua rodando no fundo.\n\nSe algo der errado, aperte Ctrl+Alt+Shift+F11 para voltar ao "+ L"Explorador, ou desligue esta opção. Desinstalar o WacOS também desfaz isso."),+ Tr(L"Abrir no lugar da área de trabalho do Windows?"), MB_OKCANCEL | MB_ICONQUESTION | MB_DEFBUTTON2);+ if (r != IDOK) return;+ std::wstring v = L"\"" + exe + L"\"";+ RegSetKeyValueW(HKEY_CURRENT_USER, WINLOGON_K, L"Shell", REG_SZ, v.c_str(), (DWORD)(v.size() + 1) * 2);+}+static void TurnShellOff() {+ int r = MessageBoxW(GetActiveWindow(),+ Tr(L"O WacOS vai fechar agora e não vai mais abrir ao entrar no Windows. A barra de tarefas e o "+ L"Explorador do Windows voltam como antes, e as pastas voltam a abrir no Explorador.\n\n"+ L"Para usar de novo: abra \"WacOS\" no Menu Iniciar."),+ Tr(L"Desligar o WacOS?"), MB_OKCANCEL | MB_ICONQUESTION | MB_DEFBUTTON2);+ if (r != IDOK) return;+ SetShellAutoStart(false);+ g_autoStart = 0;+ SetShellDoWindows(false); // o próximo login volta a abrir o Explorador+ RunHidden(L"\"" + BinDir() + L"\\WacOSFinder.exe\" --padrao off --quieto"); // pastas voltam para o Explorador+ SetSetting(L"finder_padrao", L"0");+ SetSetting(L"finder_volta", L"1"); // o Shell, ao abrir de novo, religa o Finder (issue #1: o Win+E ficava no Explorador)+ if (HWND h = FindWindowW(L"ShellMensagens", nullptr)) PostMessageW(h, WM_HOTKEY, 1, 0); // o mesmo do "sair do Shell"+}++Page Geral() {+ Page p;+ if (Setting(L"liquid_glass", L"0") == L"1" && Setting(L"golden_gate", L"0") == L"1") {+ // macOS 27 (captura Settings-General, 2x): cartão de 163,5 no alto com o ícone de 50 (centro a 50), "Geral" em+ // negrito de 22 (centro a 99) e a descrição cinza de 13 centrada embaixo+ Row hero; hero.kind = Kind::Custom; hero.height = 163.5f;+ hero.draw = [](Ctx& c, D2D1_RECT_F rr) {+ float cx = (rr.left + rr.right) / 2;+ Tile(c, D2D1::RectF(cx - 25, rr.top + 25, cx + 25, rr.top + 75), 0xE713, C_GRAY, L"gearshape.fill");+ static IDWriteTextFormat* tfBig = nullptr;+ if (!tfBig) { IDWriteFactory* dw = nullptr; DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), (IUnknown**)&dw);+ if (dw) { dw->CreateTextFormat(L"SF Pro Display", nullptr, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 22, L"", &tfBig); dw->Release(); }+ if (tfBig) { tfBig->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); tfBig->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); } }+ if (tfBig) Text(c, L"Geral", D2D1::RectF(rr.left, rr.top + 85, rr.right, rr.top + 113), tfBig, c.text);+ DWRITE_WORD_WRAPPING ww = c.noteCenter->GetWordWrapping();+ c.noteCenter->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP);+ Text(c, L"Gerencie a configuração geral e as preferências do computador, como atualizações de software, idioma, compartilhamento e mais.",+ D2D1::RectF(rr.left + 30, rr.top + 106, rr.right - 30, rr.top + 146), c.noteCenter, c.text2);+ c.noteCenter->SetWordWrapping(ww);+ };+ p.groups.push_back(G({ hero }));+ }+ p.groups.push_back(G({ Link(L"Sobre", [] { Push(L"Sobre", Sobre); }, 0xE7F4, C_GRAY),+ Link(L"Atualização de Software", [] { Push(L"Atualização de Software", Atualizacao); }, 0xE895, C_GRAY) }));+ p.groups.push_back(G({ Link(L"Armazenamento", [] { Push(L"Armazenamento", Armazenamento); }, 0xEDA2, C_GRAY) }));+ p.groups.push_back(G({ Uri(L"Compartilhamento por Proximidade", L"ms-settings:crossdevice", 0xE72D, C_BLUE),+ Link(L"Itens de Início", [] { Push(L"Itens de Início", Inicio); }, 0xE8FD, C_GRAY) }));+ // Idioma do WacOS (idioma=<código> no ajustes.txt, idioma.h): o Shell troca na hora; este app também;+ // os outros apps abertos leem o idioma ao abrir. Cada idioma aparece com o nome na própria língua.+ std::vector<std::wstring> langs;+ for (int l : idioma::kMenuOrder) langs.push_back(idioma::kInfo[l].native);+ Row lang = Popup(L"Idioma", langs, [] {+ int cur = idioma::FromCode(Setting(L"idioma", L"en"));+ for (int i = 0; i < idioma::COUNT; i++) if (idioma::kMenuOrder[i] == cur) return i;+ return 0;+ },+ [](int i) {+ int l = idioma::kMenuOrder[std::clamp(i, 0, idioma::COUNT - 1)];+ SetSetting(L"idioma", idioma::kInfo[l].code);+ idioma::Set(l);+ SetWindowTextW(Window(), TrPick(L"Ajustes do Sistema", L"System Settings"));+ Rebuild();+ });+ lang.icon = 0xE774; lang.iconColor = C_BLUE;+ p.groups.push_back(G({ lang, Note(L"O Shell muda na hora. Os apps abertos (Finder, Notas, Terminal…) mudam ao serem reabertos.") },+ L"Idioma do WacOS"));+ p.groups.push_back(G({ Uri(L"Idioma e Região", L"ms-settings:regionlanguage", 0xE774, C_BLUE),+ Link(L"Data e Hora", [] { Push(L"Data e Hora", DataHora); }, 0xE787, C_BLUE) }));+ p.groups.push_back(G({ Uri(L"Compartilhamento", L"ms-settings:sharedexperiences", 0xE72D, C_GRAY),+ Uri(L"Histórico de Arquivos", L"control.exe /name Microsoft.FileHistory", 0xE81C, C_GREEN),+ Uri(L"Transferir ou Redefinir", L"ms-settings:recovery", 0xE777, C_GRAY) }));+ p.groups.push_back(G({ Toggle(L"Abrir ao entrar no Windows", [] { return ShellAutoStartCached(); }, [](bool on) { SetShellAutoStartAsync(on); }),+ Toggle(L"Abrir pastas no Finder", [] { return Setting(L"finder_padrao", L"1") == L"1"; },+ [](bool on) {+ SetSetting(L"finder_padrao", on ? L"1" : L"0");+ // numa thread: o Finder grava no Registro e o Ajustes esperava até 15 s parado+ std::thread([on] { RunHidden(L"\"" + BinDir() + L"\\WacOSFinder.exe\" --quieto --padrao " + (on ? L"on" : L"off")); }).detach();+ }, L"Downloads do navegador, \"Mostrar na pasta\" e o Win+E também"),+ // Só o Dock e a barra de menus (modo=dock, shell::SoDock): o resto fica com o Windows. Pastas voltam ao+ // Explorador (o "Abrir pastas no Finder" de antes é guardado e volta no modo completo). Reinicia o Shell.+ Popup(L"Modo do WacOS", { L"Completo", L"Só o Dock e a barra de menus" },+ [] { return Setting(L"modo", L"completo") == L"dock" ? 1 : 0; },+ [](int i) {+ bool dock = i == 1;+ if (dock == (Setting(L"modo", L"completo") == L"dock")) return;+ if (dock) {+ SetSetting(L"finder_padrao_antes", Setting(L"finder_padrao", L"1"));+ SetSetting(L"finder_padrao", L"0");+ RunHidden(L"\"" + BinDir() + L"\\WacOSFinder.exe\" --quieto --padrao off");+ } else if (Setting(L"finder_padrao_antes", L"1") == L"1") {+ SetSetting(L"finder_padrao", L"1");+ RunHidden(L"\"" + BinDir() + L"\\WacOSFinder.exe\" --quieto --padrao on");+ }+ SetSetting(L"modo", dock ? L"dock" : L"completo");+ static UINT msg = RegisterWindowMessageW(L"ShellReiniciar");+ HWND sh = FindWindowExW(HWND_MESSAGE, nullptr, L"ShellMensagens", nullptr);+ if (!sh) sh = FindWindowW(L"ShellMensagens", nullptr);+ if (sh) PostMessageW(sh, msg, 0, 0);+ }),+ // reinicia só o Shell (barra, Dock, mesa, vidro): o mesmo do "ShellReiniciar" que a atualização usa+ Button(L"Reiniciar o WacOS", L"Reiniciar", [] {+ static UINT msg = RegisterWindowMessageW(L"ShellReiniciar");+ HWND sh = FindWindowExW(HWND_MESSAGE, nullptr, L"ShellMensagens", nullptr);+ if (!sh) sh = FindWindowW(L"ShellMensagens", nullptr);+ if (sh) PostMessageW(sh, msg, 0, 0);+ else ShellExecuteW(nullptr, L"open", (BinDir() + L"\\WacOSShell.exe").c_str(), nullptr, nullptr, SW_SHOWNORMAL); // o Shell não está rodando: abre+ }, L"Fecha e abre de novo a barra de menus, o Dock, a mesa e o vidro, sem sair do Windows. Os seus apps continuam abertos."),+ Button(L"Parar de usar o WacOS", L"Desligar…", [] { TurnShellOff(); },+ L"Fecha o Shell e devolve a barra de tarefas e o Explorador do Windows") }, L"WacOS",+ L"Só o Dock e a barra de menus: a área de trabalho, as pastas, o Alt+Tab, a tecla Windows, a captura de tela e as barras de título ficam com o Windows."));+ return p;+}++// ================= Acessibilidade+Page Acessibilidade() {+ Page p;+ p.groups.push_back(G({ Uri(L"Narrador", L"ms-settings:easeofaccess-narrator", 0xE7F5, C_DARK),+ Uri(L"Lupa", L"ms-settings:easeofaccess-magnifier", 0xE71E, C_DARK),+ Uri(L"Tela", L"ms-settings:easeofaccess-display", 0xE7F4, C_BLUE),+ Uri(L"Tamanho do Texto", L"ms-settings:easeofaccess-display", 0xE8D2, C_BLUE),+ Uri(L"Filtros de Cor", L"ms-settings:easeofaccess-colorfilter", 0xE790, C_ORANGE) }, L"Visão"));+ p.groups.push_back(G({ Uri(L"Áudio", L"ms-settings:easeofaccess-audio", 0xE767, C_PINK),+ Uri(L"Legendas", L"ms-settings:easeofaccess-closedcaptioning", 0xE7F0, C_GRAY) }, L"Audição"));+ p.groups.push_back(G({ Uri(L"Controle por Voz", L"ms-settings:easeofaccess-speechrecognition", 0xE720, C_BLUE),+ Uri(L"Teclado", L"ms-settings:easeofaccess-keyboard", 0xE765, C_GRAY),+ Uri(L"Ponteiro do Mouse", L"ms-settings:easeofaccess-mousepointer", 0xE962, C_GRAY) }, L"Motor"));+ // Reduzir Movimento do Mac (Acessibilidade > Tela): janelas, Spotlight e Central de Notificações aparecem na hora,+ // a Central de Controle só com fade (medido no macOS 26; Shell: anim::reduceMotion)+ p.groups.push_back(G({ Toggle(L"Reduzir movimento", [] { return Setting(L"reduzir_movimento", L"0") == L"1"; },+ [](bool v) { SetSetting(L"reduzir_movimento", v ? L"1" : L"0"); Rebuild(); },+ L"Troca os movimentos e as mudanças de tamanho por cortes secos ou fades curtos.") }, L"Movimento"));+ return p;+}++// ================= Aparência+const std::vector<std::pair<std::wstring, UINT32>> ACCENTS = {+ { L"multicor", 0 }, { L"azul", 0x007AFF }, { L"roxo", 0x953D96 }, { L"rosa", 0xF74F9E }, { L"vermelho", 0xE0383E },+ { L"laranja", 0xF7821B }, { L"amarelo", 0xFCB827 }, { L"verde", 0x62BA46 }, { L"grafite", 0x8C8C8C } };+const wchar_t* ACCENT_NAMES[] = { L"Multicor", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite" };++Page TransparenciaEfeitos();++Row TemaRow() {+ // Tema: o vidro do Sequoia, o Liquid Glass do macOS Tahoe ou o macOS Golden Gate (macOS 27: o Tahoe com botões+ // Aqua de vidro, um canto só e menor em todas as janelas e o controle de transparência). Golden Gate =+ // liquid_glass=1 + golden_gate=1, então tudo o que só conhece o Tahoe continua funcionando. Detalhes do vidro em+ // Transparência e Efeitos.+ // Mac OS X Leopard (10.5, 2007) = leopard=1 SEM o liquid_glass: o Sequoia por baixo (tudo o que não conhece o+ // Leopard continua no visual do Sequoia) e, por cima, o Aqua de 2007: barra de menus clara com a maçã grafite, Dock+ // em prateleira espelhada, botões de gel e barras cinza metálico. Ligar o Liquid Glass em outro lugar desliga o+ // Leopard sozinho (leopard só vale com liquid_glass=0).+ // Lançado em 20/11/2026 (antes só aparecia com leopard_previa=1): o pacote leva icones\leopard e cursor\Leopard.+ // ordem do usuário: o mais novo primeiro (0 Golden Gate, 1 Tahoe, 2 Sequoia, 3 Leopard)+ std::vector<std::wstring> temas = { L"macOS Golden Gate", L"macOS Tahoe", L"macOS Sequoia", L"Mac OS X Leopard" };+ return Popup(L"Tema", temas,+ [] {+ if (Setting(L"liquid_glass", L"0") != L"1") return Setting(L"leopard", L"0") == L"1" ? 3 : 2;+ return Setting(L"golden_gate", L"0") == L"1" ? 0 : 1;+ },+ [](int i) {+ if (i == 0) SetSetting(L"liquid_estilo", L"nitido"); // o vidro do Golden Gate é o controle deslizante+ SetSetting(L"leopard", i == 3 ? L"1" : L"0");+ SetSetting(L"golden_gate", i == 0 ? L"1" : L"0");+ SetSetting(L"liquid_glass", i == 0 || i == 1 ? L"1" : L"0");+ // o papel de parede do usuário nunca muda ao trocar de tema (o usuário pediu)+ Rebuild();+ });+}++Row GlassEstiloRow(bool title = true) { // title = false: embaixo da foto da página nova, que já tem o título+ Row glass; glass.kind = Kind::Custom; glass.height = 96;+ glass.enabled = Setting(L"reduzir_transparencia", L"0") != L"1";+ glass.draw = [title](Ctx& c, D2D1_RECT_F rr) {+ if (title) Text(c, L"Liquid Glass", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 160, rr.top + 28), c.body, c.text);+ const wchar_t* names[2] = { L"Transparente", L"Tingido" };+ int cur = Setting(L"liquid_estilo", L"nitido") == L"tingido" ? 1 : 0;+ float w = 66, h = 44, gap = 16, x = rr.right - 10 - 2 * w - gap;+ for (int k = 0; k < 2; k++, x += w + gap) {+ D2D1_RECT_F t = D2D1::RectF(x, rr.top + 12, x + w, rr.top + 12 + h);+ // papel de parede colorido atrás e uma placa de vidro por cima: clara (transparente) ou fosca (tingida)+ ID2D1GradientStopCollection* gs = nullptr;+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.30f, 0.55f, 0.98f, 1) }, { 1, D2D1::ColorF(0.95f, 0.50f, 0.55f, 1) } };+ c.dc->CreateGradientStopCollection(st, 2, &gs);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (gs) c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ t.left, t.top }, { t.right, t.bottom }), gs, &lg);+ if (lg) { c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), lg); lg->Release(); }+ if (gs) gs->Release();+ D2D1_RECT_F pl = D2D1::RectF(t.left + 9, t.top + 9, t.right - 9, t.bottom - 9);+ c.br->SetColor(k == 0 ? D2D1::ColorF(1, 1, 1, 0.18f) : (c.dark ? D2D1::ColorF(0.16f, 0.16f, 0.17f, 0.82f) : D2D1::ColorF(0.97f, 0.97f, 0.98f, 0.85f)));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(pl, 8, 8), c.br);+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.75f));+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(pl, 8, 8), c.br, 0.8f);+ if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }+ Text(c, names[k], D2D1::RectF(t.left - 12, t.bottom + 6, t.right + 12, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);+ }+ };+ glass.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ float w = 66, gap = 16, x = rr.right - 10 - 2 * w - gap;+ for (int k = 0; k < 2; k++, x += w + gap)+ if (pt.x >= x - 6 && pt.x <= x + w + 6) { SetSetting(L"liquid_estilo", k == 0 ? L"nitido" : L"tingido"); Rebuild(); }+ };+ return glass;+}++Page AparenciaGolden();+Page AparenciaLeopard();+Page Aparencia() {+ // Mac OS X Leopard: o painel Aparência do 10.5 (pop-ups Aqua em vez das miniaturas do macOS moderno)+ if (Setting(L"leopard", L"0") == L"1" && Setting(L"liquid_glass", L"0") != L"1") return AparenciaLeopard();+ // a página do macOS 27 vale para os três temas (o usuário pediu): no Tahoe a foto ganha a escolha Transparente /+ // Tingido no lugar do controle; no Sequoia (sem Liquid Glass) só Aparência, Tema e o resto. A antiga fica de reserva.+ if (true) return AparenciaGolden();+ Page p;+ Row modes; modes.kind = Kind::Custom; modes.height = 108;+ auto modeIdx = [] { return Setting(L"aparencia_auto", L"0") == L"1" ? 0 : sys::Theme() == 0 ? 1 : 2; };+ modes.draw = [modeIdx](Ctx& c, D2D1_RECT_F rr) {+ Text(c, L"Aparência", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 140, rr.top + 28), c.body, c.text);+ const wchar_t* names[3] = { L"Automático", L"Claro", L"Escuro" };+ int cur = modeIdx();+ float w = 66, h = 44, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;+ for (int k = 0; k < 3; k++) {+ D2D1_RECT_F t = D2D1::RectF(x, rr.top + 14, x + w, rr.top + 14 + h);+ // miniatura: fundo + janelinha clara/escura (automático: metade de cada)+ auto mini = [&](bool dark, D2D1_RECT_F clip) {+ c.dc->PushAxisAlignedClip(clip, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);+ c.br->SetColor(dark ? D2D1::ColorF(0.12f, 0.2f, 0.42f, 1) : D2D1::ColorF(0.45f, 0.68f, 0.95f, 1));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), c.br);+ D2D1_RECT_F win = D2D1::RectF(t.left + 10, t.top + 8, t.right - 10, t.bottom - 6);+ c.br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 1) : D2D1::ColorF(0.97f, 0.97f, 0.97f, 1));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(win, 3, 3), c.br);+ c.br->SetColor(dark ? D2D1::ColorF(0.3f, 0.3f, 0.32f, 1) : D2D1::ColorF(0.85f, 0.85f, 0.86f, 1));+ c.dc->FillRectangle(D2D1::RectF(win.left, win.top + 3, win.left + 12, win.bottom - 1), c.br);+ c.br->SetColor(c.accent);+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(win.left + 16, win.top + 6, win.left + 32, win.top + 10), 2, 2), c.br);+ c.dc->PopAxisAlignedClip();+ };+ if (k == 0) { mini(false, D2D1::RectF(t.left, t.top, (t.left + t.right) / 2, t.bottom)); mini(true, D2D1::RectF((t.left + t.right) / 2, t.top, t.right, t.bottom)); }+ else mini(k == 2, t);+ if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }+ Text(c, names[k], D2D1::RectF(t.left - 10, t.bottom + 6, t.right + 10, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);+ x += w + gap;+ }+ };+ modes.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ float w = 66, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;+ for (int k = 0; k < 3; k++, x += w + gap) {+ if (pt.x < x - 6 || pt.x > x + w + 6) continue;+ if (k == 0) { // automático: claro de dia, escuro à noite (o Shell troca na hora certa)+ SetSetting(L"aparencia_auto", L"1");+ SYSTEMTIME st; GetLocalTime(&st);+ sys::SetTheme(st.wHour >= 7 && st.wHour < 19 ? 0 : 1);+ } else {+ SetSetting(L"aparencia_auto", L"0");+ sys::SetTheme(k == 1 ? 0 : 1);+ }+ SetSetting(L"tema", L"auto");+ Rebuild();+ }+ };+ Row acc; acc.kind = Kind::Custom; acc.height = 56;+ acc.draw = [](Ctx& c, D2D1_RECT_F rr) {+ Text(c, L"Cor de destaque", D2D1::RectF(rr.left + 10, rr.top, rr.left + 160, rr.top + 38), c.body, c.text);+ std::wstring cur = Setting(L"destaque", L"azul");+ float x = rr.right - 10 - 9 * 22 + 8;+ for (int k = 0; k < 9; k++, x += 22) {+ D2D1_POINT_2F m{ x, rr.top + 19 };+ if (k == 0) { // multicor: arco-íris+ const UINT32 cols[6] = { 0xE0383E, 0xF7821B, 0xFCB827, 0x62BA46, 0x007AFF, 0x953D96 };+ for (int s = 0; s < 6; s++) {+ c.br->SetColor(D2D1::ColorF(((cols[s] >> 16) & 255) / 255.f, ((cols[s] >> 8) & 255) / 255.f, (cols[s] & 255) / 255.f, 1));+ c.dc->PushAxisAlignedClip(D2D1::RectF(m.x - 8 + s * 16 / 6.f, m.y - 8, m.x - 8 + (s + 1) * 16 / 6.f, m.y + 8), D2D1_ANTIALIAS_MODE_ALIASED);+ c.dc->FillEllipse(D2D1::Ellipse(m, 8, 8), c.br);+ c.dc->PopAxisAlignedClip();+ }+ } else {+ UINT32 col = ACCENTS[k].second;+ c.br->SetColor(D2D1::ColorF(((col >> 16) & 255) / 255.f, ((col >> 8) & 255) / 255.f, (col & 255) / 255.f, 1));+ c.dc->FillEllipse(D2D1::Ellipse(m, 8, 8), c.br);+ }+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.12f));+ c.dc->DrawEllipse(D2D1::Ellipse(m, 8, 8), c.br, 0.6f);+ if (ACCENTS[k].first == cur) { c.br->SetColor(D2D1::ColorF(1, 1, 1, 1)); c.dc->FillEllipse(D2D1::Ellipse(m, 3, 3), c.br); }+ }+ std::wstring name = L"Azul";+ for (int k = 0; k < 9; k++) if (ACCENTS[k].first == cur) name = ACCENT_NAMES[k];+ c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_TRAILING);+ Text(c, name, D2D1::RectF(rr.left, rr.top + 30, rr.right - 10, rr.top + 48), c.note, c.text2);+ c.note->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);+ };+ acc.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ float x = rr.right - 10 - 9 * 22 + 8;+ for (int k = 0; k < 9; k++, x += 22)+ if (std::fabs(pt.x - x) <= 10 && std::fabs(pt.y - (rr.top + 19)) <= 10) { SetSetting(L"destaque", k == 0 ? L"azul" : ACCENTS[k].first); Rebuild(); }+ };+ Row tema = TemaRow();+ // o Tema fica sempre livre: com "Reduzir transparência" o vidro só fica opaco (como no Mac)+ bool tahoeOn = Setting(L"liquid_glass", L"0") == L"1";+ if (!tahoeOn) { p.groups.push_back(G({ tema, modes, acc })); }+ else {+ // macOS 26 (Aparência): "Liquid Glass" com a escolha Transparente / Tingido (26.1) e "Estilo de ícones e widgets"+ // em miniaturas — Padrão, Escuro, Transparente (o modo translúcido) e Tingido. A transparência fina continua em+ // Transparência e Efeitos.+ Row glass = GlassEstiloRow();+ p.groups.push_back(G({ tema, modes, glass }));+ static const wchar_t* ESTILOS[] = { L"padrao", L"escuro", L"transparente", L"tingido" };+ Row icons; icons.kind = Kind::Custom; icons.height = 96;+ icons.draw = [](Ctx& c, D2D1_RECT_F rr) {+ Text(c, L"Estilo de ícones e widgets", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 200, rr.top + 28), c.body, c.text);+ const wchar_t* names[4] = { L"Padrão", L"Escuro", L"Transparente", L"Tingido" };+ std::wstring v = Setting(L"estilo_icones", L"padrao");+ int cur = 0;+ for (int k = 0; k < 4; k++) if (v == ESTILOS[k]) cur = k;+ float w = 52, h = 44, gap = 14, x = rr.right - 10 - 4 * w - 3 * gap;+ for (int k = 0; k < 4; k++, x += w + gap) {+ D2D1_RECT_F t = D2D1::RectF(x, rr.top + 12, x + w, rr.top + 12 + h);+ c.br->SetColor(c.dark ? D2D1::ColorF(0.22f, 0.22f, 0.24f, 1) : D2D1::ColorF(0.88f, 0.89f, 0.92f, 1));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), c.br);+ // o ícone de exemplo (quadrado arredondado com uma folha) em cada estilo+ float s = 28, cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;+ D2D1_RECT_F ic = D2D1::RectF(cx - s / 2, cy - s / 2, cx + s / 2, cy + s / 2);+ D2D1_COLOR_F bg, fg;+ if (k == 0) { bg = D2D1::ColorF(1, 1, 1, 1); fg = D2D1::ColorF(0.20f, 0.70f, 0.30f, 1); }+ else if (k == 1) { bg = D2D1::ColorF(0.13f, 0.13f, 0.14f, 1); fg = D2D1::ColorF(0.30f, 0.82f, 0.42f, 1); }+ else if (k == 2) { bg = D2D1::ColorF(1, 1, 1, c.dark ? 0.16f : 0.45f); fg = D2D1::ColorF(1, 1, 1, 0.92f); }+ else { bg = D2D1::ColorF(c.accent.r * 0.35f, c.accent.g * 0.35f, c.accent.b * 0.35f, 1); fg = c.accent; }+ c.br->SetColor(bg);+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(ic, 7, 7), c.br);+ if (k == 2) { c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.8f)); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(ic, 7, 7), c.br, 0.8f); }+ c.br->SetColor(fg);+ c.dc->FillEllipse(D2D1::Ellipse({ cx, cy }, 7, 7), c.br);+ if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }+ Text(c, names[k], D2D1::RectF(t.left - 12, t.bottom + 6, t.right + 12, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);+ }+ };+ icons.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ float w = 52, gap = 14, x = rr.right - 10 - 4 * w - 3 * gap;+ for (int k = 0; k < 4; k++, x += w + gap)+ if (pt.x >= x - 5 && pt.x <= x + w + 5) { SetSetting(L"estilo_icones", ESTILOS[k]); Rebuild(); }+ };+ p.groups.push_back(G({ acc, icons }, L"Tema"));+ }+ // barras de rolagem: "Sempre" = barras do Windows sempre visíveis (DynamicScrollbars = 0)+ p.groups.push_back(G({ Popup(L"Mostrar barras de rolagem", { L"Ao rolar", L"Sempre" },+ [] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v ? 0 : 1; },+ [](int i) {+ DWORD v = i == 0 ? 1 : 0;+ RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", REG_DWORD, &v, sizeof(v));+ SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Accessibility", SMTO_ABORTIFHUNG, 200, nullptr);+ }) }));+ if (Setting(L"liquid_glass", L"0") == L"1") p.groups.back().title = L"Janelas";+ p.groups.push_back(G({ Link(L"Transparência e Efeitos", [] { Push(L"Transparência e Efeitos", TransparenciaEfeitos); }, 0xE790, C_BLUE) }));+ return p;+}++// ================= Aparência no macOS 27 Golden Gate+// Copiada da captura 2x dos Ajustes do macOS 27 (512 Pixels, Settings-Appearance.png), medidas em pt a partir da+// caixa (ver Documents\macOS27-Theme-Reference\MEDIDAS.md):+// caixa 1: Aparência (85,5) com miniaturas 71,5 x 48,5 de passo 82 (Claro, Escuro, Automático), a última a 11 da+// borda, 10,5 do alto, rótulos centrados a 69; Liquid Glass (196 + 36) com a foto 267,5 x 179,5 a 10 da+// borda e 11 do alto, e o controle (trilho a 213 / 33,5 das bordas)+// "Tema" (57,5 entre as caixas); caixa 2: Cor (61) com bolinhas de 23,5, passo 36, a última a 21,75 da borda e o+// centro a 21,25 do alto, nome da escolhida embaixo; Cor do realce do texto (37,5)+// caixa 3: Estilo de ícones e widgets (87,5) com quadrinhos de 29,5, passo 51,5, a 13 da borda e 24 do alto, rótulos+// a 54; Cor das pastas (40). Menus: bolinha de 16, texto a 8,5 dela e o botão redondo a 13,5 da borda.+static D2D1_COLOR_F GGRgb(UINT32 c, float a = 1) { return D2D1::ColorF(((c >> 16) & 255) / 255.f, ((c >> 8) & 255) / 255.f, (c & 255) / 255.f, a); }++// Cor do realce do texto: a cor de seleção do Windows (HKCU\Control Panel\Colors\Hilight + SetSysColors, vale na hora+// para os programas clássicos). A original é guardada em realce_original na 1ª troca e volta com "Automática"+// (registrado em docs\registro-mudancas.txt).+static const UINT32 GG_REALCE[9] = { 0, 0x007AFF, 0x953D96, 0xF74F9E, 0xE0383E, 0xF7821B, 0xFFC726, 0x62BA46, 0x989898 };+static void GGAplicaRealce(int i) {+ wchar_t cur[64] = {}; DWORD cb = sizeof(cur);+ RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Colors", L"Hilight", RRF_RT_REG_SZ, nullptr, cur, &cb);+ std::wstring orig = Setting(L"realce_original", L"");+ if (i <= 0) {+ if (orig.empty()) { SetSetting(L"realce_texto", L"0"); return; }+ int r = 0, g = 0, b = 0;+ if (swscanf_s(orig.c_str(), L"%d %d %d", &r, &g, &b) == 3) {+ RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Colors", L"Hilight", REG_SZ, orig.c_str(), (DWORD)((orig.size() + 1) * sizeof(wchar_t)));+ INT el = COLOR_HIGHLIGHT; COLORREF cr = RGB(r, g, b); SetSysColors(1, &el, &cr);+ }+ SetSetting(L"realce_original", L"");+ SetSetting(L"realce_texto", L"0");+ return;+ }+ if (orig.empty() && cur[0]) SetSetting(L"realce_original", cur);+ UINT32 c = GG_REALCE[i];+ int r = (c >> 16) & 255, g = (c >> 8) & 255, b = c & 255;+ wchar_t v[32]; swprintf_s(v, L"%d %d %d", r, g, b);+ RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Colors", L"Hilight", REG_SZ, v, (DWORD)((wcslen(v) + 1) * sizeof(wchar_t)));+ INT el = COLOR_HIGHLIGHT; COLORREF cr = RGB(r, g, b); SetSysColors(1, &el, &cr);+ SetSetting(L"realce_texto", std::to_wstring(i));+}++// "Usar o Aurora": o da coleção de papéis de parede do usuário (Imagens\Wallpapers macOS\Leopard) ou, sem ela, o que+// vem com o WacOS (icones\leopard\aurora.jpg). Antes só procurava na pasta Imagens do perfil: em quem não tinha a+// coleção o botão não fazia nada (21/11/2026).+static void UsarAurora() {+ const wchar_t* nome = L"\\Wallpapers macOS\\Leopard\\os-x-leopard-aurora-5120x3200-24048.jpg";+ std::vector<std::wstring> cands;+ wchar_t prof[MAX_PATH] = {};+ if (GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) cands.push_back(std::wstring(prof) + L"\\Pictures" + nome);+ PWSTR pics = nullptr;+ if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Pictures, 0, nullptr, &pics))) { cands.push_back(std::wstring(pics) + nome); CoTaskMemFree(pics); }+ wchar_t exe[MAX_PATH] = {}; GetModuleFileNameW(nullptr, exe, MAX_PATH);+ std::wstring inst = exe; inst = inst.substr(0, inst.find_last_of(L'\\')); inst = inst.substr(0, inst.find_last_of(L'\\')); // bin\ -> instalação+ cands.push_back(inst + L"\\icones\\leopard\\aurora.jpg");+ for (auto& f : cands)+ if (GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES) { sys::SetWallpaper(f); break; }+ Rebuild();+}++Page AparenciaGolden() {+ Page p;+ // ---- Aparência: Claro, Escuro, Automático+ Row modes; modes.kind = Kind::Custom; modes.height = 85.5f;+ auto modeIdx = [] { return Setting(L"aparencia_auto", L"0") == L"1" ? 2 : sys::Theme() == 0 ? 0 : 1; };+ modes.draw = [modeIdx](Ctx& c, D2D1_RECT_F rr) {+ Text(c, L"Aparência", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 160, rr.top + 28), c.body, c.text);+ const wchar_t* names[3] = { L"Claro", L"Escuro", L"Automático" };+ int cur = modeIdx();+ float w = 71.5f, h = 48.5f, pitch = 82, x = rr.right - 11 - w - 2 * pitch;+ for (int k = 0; k < 3; k++, x += pitch) {+ D2D1_RECT_F t = D2D1::RectF(x, rr.top + 10.5f, x + w, rr.top + 10.5f + h);+ ID2D1Factory* fac = nullptr; c.dc->GetFactory(&fac);+ ID2D1RoundedRectangleGeometry* rg = nullptr; fac->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 7, 7), &rg);+ c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);+ auto mini = [&](bool dark, D2D1_RECT_F clip) {+ c.dc->PushAxisAlignedClip(clip, D2D1_ANTIALIAS_MODE_ALIASED);+ // o papel de parede azul das miniaturas do macOS 27 (claro: céu pálido -> azul; escuro: anil profundo)+ D2D1_GRADIENT_STOP st[3] = { { 0, dark ? D2D1::ColorF(0.33f, 0.33f, 0.72f, 1) : D2D1::ColorF(0.80f, 0.82f, 0.86f, 1) },+ { 0.55f, dark ? D2D1::ColorF(0.14f, 0.16f, 0.52f, 1) : D2D1::ColorF(0.35f, 0.58f, 0.92f, 1) },+ { 1, dark ? D2D1::ColorF(0.05f, 0.07f, 0.28f, 1) : D2D1::ColorF(0.10f, 0.36f, 0.85f, 1) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(c.dc->CreateGradientStopCollection(st, 3, &gs)) &&+ SUCCEEDED(c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ t.left, t.top }, { t.right, t.bottom }), gs, &lb)))+ c.dc->FillRectangle(t, lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ // janelinha de cima à esquerda com a barra na cor de destaque+ D2D1_RECT_F top = D2D1::RectF(t.left + 3, t.top + 3, t.left + 44, t.top + 21);+ c.br->SetColor(dark ? D2D1::ColorF(0.10f, 0.10f, 0.22f, 0.85f) : D2D1::ColorF(1, 1, 1, 0.72f));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(top, 3.5f, 3.5f), c.br);+ c.br->SetColor(c.accent);+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(top.left + 3, top.top + 8, top.right - 3, top.top + 14), 1.5f, 1.5f), c.br);+ // janela de baixo à direita com os três botões+ D2D1_RECT_F win = D2D1::RectF(t.left + 19, t.top + 26, t.right + 6, t.bottom + 6);+ c.br->SetColor(dark ? D2D1::ColorF(0.07f, 0.07f, 0.09f, 1) : D2D1::ColorF(0.97f, 0.97f, 0.97f, 1));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(win, 5, 5), c.br);+ const UINT32 lights[3] = { 0xFF6159, 0xFEBC2E, 0x28C840 };+ for (int d = 0; d < 3; d++) {+ c.br->SetColor(GGRgb(lights[d]));+ c.dc->FillEllipse(D2D1::Ellipse({ win.left + 11 + d * 7.5f, win.top + 11 }, 2.6f, 2.6f), c.br);+ }+ c.dc->PopAxisAlignedClip();+ };+ if (k == 2) { mini(false, D2D1::RectF(t.left, t.top, (t.left + t.right) / 2, t.bottom)); mini(true, D2D1::RectF((t.left + t.right) / 2, t.top, t.right, t.bottom)); }+ else mini(k == 1, t);+ c.dc->PopLayer();+ if (rg) rg->Release();+ if (fac) fac->Release();+ c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.12f) : D2D1::ColorF(0, 0, 0, 0.10f));+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left + 0.25f, t.top + 0.25f, t.right - 0.25f, t.bottom - 0.25f), 7, 7), c.br, 0.5f);+ if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 2, t.top - 2, t.right + 2, t.bottom + 2), 9, 9), c.br, 3); }+ // rótulo de 11 pt (escolhido em negrito), centrado a 69 do alto da linha+ Text(c, names[k], D2D1::RectF(t.left - 20, rr.top + 61, t.right + 20, rr.top + 77), k == cur && c.noteBoldCenter ? c.noteBoldCenter : c.noteCenter, k == cur ? c.text : c.text2);+ }+ };+ modes.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ float w = 71.5f, pitch = 82, x = rr.right - 11 - w - 2 * pitch;+ for (int k = 0; k < 3; k++, x += pitch) {+ if (pt.x < x - 4 || pt.x > x + w + 4) continue;+ if (k == 2) { // automático: claro de dia, escuro à noite (o Shell troca na hora certa)+ SetSetting(L"aparencia_auto", L"1");+ SYSTEMTIME st; GetLocalTime(&st);+ sys::SetTheme(st.wHour >= 7 && st.wHour < 19 ? 0 : 1);+ } else {+ SetSetting(L"aparencia_auto", L"0");+ sys::SetTheme(k == 0 ? 0 : 1);+ }+ SetSetting(L"tema", L"auto");+ Rebuild();+ }+ };+ // ---- Liquid Glass: a foto com a barra de vidro de exemplo e o controle embaixo+ bool reduce = Setting(L"reduzir_transparencia", L"0") == L"1";+ const bool liquidOn = Setting(L"liquid_glass", L"0") == L"1", goldenOn = liquidOn && Setting(L"golden_gate", L"0") == L"1";+ Row prev; prev.kind = Kind::Custom; prev.height = 196;+ prev.enabled = !reduce;+ prev.draw = [](Ctx& c, D2D1_RECT_F rr) {+ Text(c, L"Liquid Glass", D2D1::RectF(rr.left + 10, rr.top + 9.5f, rr.left + 160, rr.top + 29.5f), c.body, c.text);+ float w = 267.5f, h = 179.5f;+ D2D1_RECT_F t = D2D1::RectF(rr.right - 10 - w, rr.top + 11, rr.right - 10, rr.top + 11 + h);+ ID2D1Factory* fac = nullptr; c.dc->GetFactory(&fac);+ ID2D1RoundedRectangleGeometry* rg = nullptr; fac->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 14, 14), &rg);+ c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);+ c.br->SetColor(D2D1::ColorF(0.45f, 0.62f, 0.80f, 1));+ c.dc->FillRectangle(t, c.br);+ D2D1_RECT_F card = D2D1::RectF(t.left, t.bottom - 34.5f, t.right, t.bottom);+ std::wstring photo;+ wchar_t prof[MAX_PATH];+ if (GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) photo = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS\\macOS 27\\macos-27-golden-4096x2160-27635.jpg";+ if (photo.empty() || GetFileAttributesW(photo.c_str()) == INVALID_FILE_ATTRIBUTES) photo = sys::Wallpaper();+ if (ID2D1Bitmap* b = BitmapFromFile(photo, 640)) { // a foto ocupa o que fica acima do cartão+ auto s2 = b->GetSize();+ float ph = card.top - t.top, k = std::max(w / s2.width, ph / s2.height);+ float bw = s2.width * k, bh = s2.height * k, cx = (t.left + t.right) / 2, cy = t.top + ph / 2;+ c.dc->PushAxisAlignedClip(D2D1::RectF(t.left, t.top, t.right, card.top), D2D1_ANTIALIAS_MODE_ALIASED);+ c.dc->DrawBitmap(b, D2D1::RectF(cx - bw / 2, cy - bh / 2, cx + bw / 2, cy + bh / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);+ c.dc->PopAxisAlignedClip();+ }+ // cartão de baixo (medido: 234,230,224 no claro) com o título em negrito, cortado pela borda como na referência+ c.br->SetColor(c.dark ? D2D1::ColorF(0.16f, 0.16f, 0.17f, 1) : GGRgb(0xEAE6E0));+ c.dc->FillRectangle(card, c.br);+ Text(c, L"Golden Gate Bridge", D2D1::RectF(card.left + 16.5f, card.top + 9, card.right - 10, card.top + 42), c.title, c.dark ? c.text : D2D1::ColorF(0, 0, 0, 0.85f));+ // barra de vidro: quanto mais para a direita o controle, mais opaco o vidro+ // Golden Gate: o controle; Tahoe: Transparente (quase nada) ou Tingido (fosco)+ float v = Setting(L"golden_gate", L"0") == L"1" ? std::clamp((float)_wtof(Setting(L"vidro_tinta", L"0.5").c_str()), 0.f, 1.f)+ : Setting(L"liquid_estilo", L"nitido") == L"tingido" ? 0.85f : 0.15f;+ D2D1_COLOR_F fill = c.dark ? D2D1::ColorF(0.20f, 0.20f, 0.21f, 0.18f + 0.72f * v) : D2D1::ColorF(1, 1, 1, 0.28f + 0.66f * v);+ D2D1_COLOR_F ink = c.dark ? D2D1::ColorF(1, 1, 1, 0.9f) : D2D1::ColorF(0, 0, 0, 0.82f);+ auto pill = [&](D2D1_RECT_F q) {+ float rad = (q.bottom - q.top) / 2;+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.08f));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(q.left, q.top + 1, q.right, q.bottom + 1.5f), rad, rad), c.br);+ c.br->SetColor(fill);+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(q, rad, rad), c.br);+ c.br->SetColor(D2D1::ColorF(1, 1, 1, c.dark ? 0.25f : 0.8f));+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(q.left + 0.5f, q.top + 0.5f, q.right - 0.5f, q.bottom - 0.5f), rad - 0.5f, rad - 0.5f), c.br, 0.8f);+ };+ float y0 = t.top + 8, hh = 36;+ D2D1_RECT_F g1 = D2D1::RectF(t.left + 8, y0, t.left + 8 + 73.5f, y0 + hh);+ D2D1_RECT_F g2 = D2D1::RectF(g1.right + 7.5f, y0, g1.right + 7.5f + hh, y0 + hh);+ D2D1_RECT_F g3 = D2D1::RectF(g2.right + 7.5f, y0, t.right - 8.5f, y0 + hh);+ pill(g1); pill(g2); pill(g3);+ c.br->SetColor(ink);+ simbolo::Draw(c.dc, L"square.and.arrow.up", D2D1::RectF(g1.left + 11, y0 + 8, g1.left + 29, y0 + 28), c.br);+ for (int k = 0; k < 3; k++) c.dc->FillEllipse(D2D1::Ellipse({ g1.left + 49.5f + k * 5.5f, y0 + hh / 2 }, 1.5f, 1.5f), c.br);+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(g2.left + 13, y0 + 13, g2.right - 8, y0 + 27), 3, 3), c.br, 1.5f);+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(g2.left + 9, y0 + 9, g2.right - 12, y0 + 23), 3, 3), c.br, 1.5f);+ simbolo::Draw(c.dc, L"magnifyingglass", D2D1::RectF(g3.left + 10, y0 + 11, g3.left + 24, y0 + 25), c.br);+ Text(c, L"Buscar", D2D1::RectF(g3.left + 32, y0, g3.right - 6, y0 + hh), c.body, c.dark ? D2D1::ColorF(1, 1, 1, 0.6f) : D2D1::ColorF(0, 0, 0, 0.5f));+ c.dc->PopLayer();+ if (rg) rg->Release();+ if (fac) fac->Release();+ };+ Row gg = Slider(L"", 0, 1, [] { return (float)_wtof(Setting(L"vidro_tinta", L"0.5").c_str()); },+ [](float v) { wchar_t b[16]; swprintf_s(b, L"%.2f", v); SetSetting(L"vidro_tinta", b); Redraw(); }, L"", L"");+ gg.height = 36; gg.noLine = true; gg.gg = true; gg.enabled = !reduce;+ if (goldenOn) p.groups.push_back(G({ modes, prev, gg }));+ else if (liquidOn) { Row ge = GlassEstiloRow(false); ge.noLine = true; p.groups.push_back(G({ modes, prev, ge })); }+ else p.groups.push_back(G({ modes }));++ // ---- Tema: cor de destaque (Multicor + 10 cores; as do macOS 27 lidas na captura) e cor do realce do texto+ Row color; color.kind = Kind::Custom; color.height = 61;+ static const UINT32 GG_COLS[10] = { 0, 0x007AFF, 0x953D96, 0xF74F9E, 0xE0383E, 0xF7821B, 0xFFC726, 0x62BA46, 0x989898, 0x98A8D9 };+ static const wchar_t* GG_KEYS[10] = { L"multicor", L"azul", L"roxo", L"rosa", L"vermelho", L"laranja", L"amarelo", L"verde", L"grafite", L"lavanda" };+ static const wchar_t* GG_NAMES[10] = { L"Multicor", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite", L"Lavanda" };+ color.draw = [](Ctx& c, D2D1_RECT_F rr) {+ Text(c, L"Cor", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 120, rr.top + 28), c.body, c.text);+ std::wstring cur = Setting(L"destaque", L"azul");+ int sel = 1;+ for (int k = 0; k < 10; k++) if (cur == GG_KEYS[k]) sel = k;+ ID2D1Factory* f = nullptr; c.dc->GetFactory(&f);+ for (int k = 0; k < 10; k++) {+ D2D1_POINT_2F m{ rr.right - 21.75f - (9 - k) * 36.f, rr.top + 21.25f };+ if (k == 0) { // multicor: disco de cores feito em fatias+ for (int s = 0; s < 36 && f; s++) {+ float a0 = s * 10.f * 3.14159f / 180, a1 = (s + 1.2f) * 10.f * 3.14159f / 180;+ float hue = s / 36.f;+ float r = std::clamp(std::fabs(hue * 6 - 3) - 1, 0.f, 1.f), g = std::clamp(2 - std::fabs(hue * 6 - 2), 0.f, 1.f), b = std::clamp(2 - std::fabs(hue * 6 - 4), 0.f, 1.f);+ ID2D1PathGeometry* pg = nullptr;+ if (SUCCEEDED(f->CreatePathGeometry(&pg))) {+ ID2D1GeometrySink* sk = nullptr;+ if (SUCCEEDED(pg->Open(&sk))) {+ sk->BeginFigure(m, D2D1_FIGURE_BEGIN_FILLED);+ sk->AddLine({ m.x + 11.75f * std::cos(a0), m.y + 11.75f * std::sin(a0) });+ sk->AddLine({ m.x + 11.75f * std::cos(a1), m.y + 11.75f * std::sin(a1) });+ sk->EndFigure(D2D1_FIGURE_END_CLOSED);+ sk->Close(); sk->Release();+ }+ c.br->SetColor(D2D1::ColorF(r, g, b, 1));+ c.dc->FillGeometry(pg, c.br);+ pg->Release();+ }+ }+ } else {+ c.br->SetColor(GGRgb(GG_COLS[k]));+ c.dc->FillEllipse(D2D1::Ellipse(m, 11.75f, 11.75f), c.br);+ }+ if (k == sel) { // anel na cor de destaque, com um respiro da cor da caixa+ c.br->SetColor(c.dark ? D2D1::ColorF(0.19f, 0.19f, 0.19f, 1) : D2D1::ColorF(0.97f, 0.97f, 0.97f, 1));+ c.dc->DrawEllipse(D2D1::Ellipse(m, 12.9f, 12.9f), c.br, 1.5f);+ c.br->SetColor(c.accent);+ c.dc->DrawEllipse(D2D1::Ellipse(m, 14.5f, 14.5f), c.br, 2.5f);+ Text(c, GG_NAMES[k], D2D1::RectF(m.x - 50, rr.top + 36, m.x + 50, rr.top + 52), c.noteCenter, c.text2); // 11 pt, a 44 do alto+ }+ }+ if (f) f->Release();+ };+ color.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ for (int k = 0; k < 10; k++) {+ float x = rr.right - 21.75f - (9 - k) * 36.f;+ if (std::fabs(pt.x - x) <= 15 && std::fabs(pt.y - (rr.top + 21.25f)) <= 15) { SetSetting(L"destaque", k == 0 ? L"azul" : GG_KEYS[k]); Rebuild(); }+ }+ };+ Row hl = Popup(L"Cor do realce do texto", { L"Automática", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite" },+ [] { return std::clamp(_wtoi(Setting(L"realce_texto", L"0").c_str()), 0, 8); }, [](int i) { GGAplicaRealce(i); Rebuild(); });+ hl.gg = true; hl.height = 37.5f;+ hl.dot = [](int i) { return i <= 0 ? D2D1::ColorF(0, 0, 0, -1) : GGRgb(GG_REALCE[std::clamp(i, 0, 8)]); };+ p.groups.push_back(G({ color, hl }, L"Tema"));++ // ---- Estilo de ícones e widgets (o símbolo do Tempo em cada estilo) e cor das pastas+ static const wchar_t* ESTILOS[] = { L"padrao", L"escuro", L"transparente", L"tingido" };+ Row icons; icons.kind = Kind::Custom;+ // com Escuro escolhido o macOS 27 mostra embaixo "Sempre / Auto" (Auto: escuro só no modo escuro) e a linha cresce+ icons.height = Setting(L"estilo_icones", L"padrao") == L"escuro" ? 102.5f : 87.5f;+ icons.draw = [](Ctx& c, D2D1_RECT_F rr) {+ Text(c, L"Estilo de ícones e widgets", D2D1::RectF(rr.left + 10, rr.top + 8, rr.left + 220, rr.top + 28), c.body, c.text);+ const wchar_t* names[4] = { L"Padrão", L"Escuro", L"Transparente", L"Tingido" };+ std::wstring v = Setting(L"estilo_icones", L"padrao");+ int cur = 0;+ for (int k = 0; k < 4; k++) if (v == ESTILOS[k]) cur = k;+ const float s = 29.5f, pitch = 51.5f;+ for (int k = 0; k < 4; k++) {+ float x = rr.right - 13 - s - (3 - k) * pitch;+ D2D1_RECT_F t = D2D1::RectF(x, rr.top + 13, x + s, rr.top + 13 + s); // medido: 13 do alto da linha+ D2D1_COLOR_F top, bot;+ if (k == 0) { top = GGRgb(0x5AB8F5); bot = GGRgb(0x1E7AE6); }+ else if (k == 1) { top = GGRgb(0x2A2A2C); bot = GGRgb(0x0E0E10); }+ else if (k == 2) { top = GGRgb(0xA9A9AE); bot = GGRgb(0x7E7E84); }+ else { top = D2D1::ColorF(std::min(1.f, c.accent.r + 0.25f), std::min(1.f, c.accent.g + 0.25f), std::min(1.f, c.accent.b + 0.25f), 1); bot = c.accent; }+ D2D1_GRADIENT_STOP st[2] = { { 0, top }, { 1, bot } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(c.dc->CreateGradientStopCollection(st, 2, &gs)) &&+ SUCCEEDED(c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ t.left, t.top }, { t.left, t.bottom }), gs, &lb)))+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 7, 7), lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ // nuvem com o sol atrás (o ícone do Tempo da referência)+ float cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;+ if (k <= 1) { c.br->SetColor(GGRgb(0xFFC52E)); c.dc->FillEllipse(D2D1::Ellipse({ cx + 4.5f, cy - 4 }, 5.5f, 5.5f), c.br); }+ c.br->SetColor(k == 2 ? D2D1::ColorF(0.93f, 0.93f, 0.95f, 1) : D2D1::ColorF(1, 1, 1, 1));+ c.dc->FillEllipse(D2D1::Ellipse({ cx - 4, cy + 2.5f }, 5, 4.5f), c.br);+ c.dc->FillEllipse(D2D1::Ellipse({ cx + 1, cy }, 5.5f, 5.5f), c.br);+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 9, cy + 1.5f, cx + 9, cy + 7.5f), 3, 3), c.br);+ if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 2.5f, t.top - 2.5f, t.right + 2.5f, t.bottom + 2.5f), 9, 9), c.br, 3); }+ Text(c, names[k], D2D1::RectF(t.left - 22, rr.top + 46, t.right + 22, rr.top + 62), k == cur && c.noteBoldCenter ? c.noteBoldCenter : c.noteCenter, k == cur ? c.text : c.text2);+ }+ if (cur == 1) { // medido: bolinhas a 123,5 e 52,5 da borda, textos a 13 delas, centro a 85,5 do alto+ bool autoOn = Setting(L"estilo_escuro_auto", L"0") == L"1";+ float cy = rr.top + 85.5f;+ const wchar_t* labels[2] = { L"Sempre", L"Automático" };+ float xs[2] = { rr.right - 123.5f, rr.right - 52.5f };+ for (int k = 0; k < 2; k++) {+ bool on = (k == 1) == autoOn;+ D2D1_POINT_2F m{ xs[k], cy };+ if (on) {+ c.br->SetColor(c.accent); c.dc->FillEllipse(D2D1::Ellipse(m, 7, 7), c.br);+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 1)); c.dc->FillEllipse(D2D1::Ellipse(m, 2.8f, 2.8f), c.br);+ } else {+ c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.08f)); c.dc->FillEllipse(D2D1::Ellipse(m, 7, 7), c.br);+ }+ Text(c, labels[k], D2D1::RectF(m.x + 13, cy - 10, m.x + 80, cy + 10), c.body, c.text);+ }+ }+ };+ icons.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ const float s = 29.5f, pitch = 51.5f;+ for (int k = 0; k < 4; k++) {+ float x = rr.right - 13 - s - (3 - k) * pitch;+ if (pt.x >= x - 10 && pt.x <= x + s + 10 && pt.y >= rr.top + 8 && pt.y <= rr.top + 64) { SetSetting(L"estilo_icones", ESTILOS[k]); Rebuild(); }+ }+ if (Setting(L"estilo_icones", L"padrao") == L"escuro" && std::fabs(pt.y - (rr.top + 85.5f)) <= 10) {+ if (pt.x >= rr.right - 132 && pt.x < rr.right - 60) { SetSetting(L"estilo_escuro_auto", L"0"); Rebuild(); }+ else if (pt.x >= rr.right - 60) { SetSetting(L"estilo_escuro_auto", L"1"); Rebuild(); }+ }+ };+ // Cor das pastas: "Automática" segue a cor de destaque; as outras retingem as pastas comuns do Finder (as mesmas cores+ // de Personalizar Pasta, finder\pastacor.cpp), gravado em cor_pastas (-1 = automática)+ static const UINT32 GG_PASTAS[9] = { 0xFF453A, 0xFF9F0A, 0xFFD60A, 0x30D158, 0x64D2FF, 0x0A84FF, 0xBF5AF2, 0xFF375F, 0x8E8E93 };+ Row folder = Popup(L"Cor das pastas", { L"Automática", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Menta", L"Azul", L"Roxo", L"Rosa", L"Cinza" },+ [] { return std::clamp(_wtoi(Setting(L"cor_pastas", L"-1").c_str()) + 1, 0, 9); },+ [](int i) { SetSetting(L"cor_pastas", std::to_wstring(i - 1)); Rebuild(); });+ folder.gg = true; folder.height = 40;+ folder.dot = [](int i) { return i <= 0 ? Accent() : GGRgb(GG_PASTAS[std::clamp(i - 1, 0, 8)]); };+ p.groups.push_back(G({ icons, folder }));++ // ---- Janelas (barras de rolagem), Transparência e Efeitos e o tema do WacOS+ p.groups.push_back(G({ Popup(L"Mostrar barras de rolagem", { L"Ao rolar", L"Sempre" },+ [] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v ? 0 : 1; },+ [](int i) {+ DWORD v = i == 0 ? 1 : 0;+ RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", REG_DWORD, &v, sizeof(v));+ SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Accessibility", SMTO_ABORTIFHUNG, 200, nullptr);+ }) }, L"Janelas"));+ p.groups.push_back(G({ Link(L"Transparência e Efeitos", [] { Push(L"Transparência e Efeitos", TransparenciaEfeitos); }, 0xE790, C_BLUE) }));+ Row tema = TemaRow();+ tema.label = L"Estilo do WacOS";+ if (Setting(L"leopard", L"0") == L"1" && Setting(L"liquid_glass", L"0") != L"1") {+ // Leopard: o Aurora (o papel de parede padrão do 10.5) só como sugestão; trocar de tema nunca muda o papel de+ // parede do usuário (pedido dele), quem troca é este botão+ Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", UsarAurora, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");+ p.groups.push_back(G({ tema, aurora }));+ } else p.groups.push_back(G({ tema }));+ return p;+}++// ================= Aparência no Mac OS X Leopard+// O painel "Aparência" das Preferências do Sistema do 10.5: Aparência (Azul / Grafite: botões, menus e janelas), Cor+// de realce (a seleção do texto), barras de rolagem, a barra de menus translúcida (10.5.2) e o tema do WacOS.+Page AparenciaLeopard() {+ Page p;+ p.groups.push_back(G({+ Popup(L"Aparência", { L"Azul", L"Grafite" }, [] { return Setting(L"destaque", L"azul") == L"grafite" ? 1 : 0; },+ [](int i) { SetSetting(L"destaque", i == 1 ? L"grafite" : L"azul"); Rebuild(); }),+ Popup(L"Cor de realce", { L"Automática", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite" },+ [] { return std::clamp(_wtoi(Setting(L"realce_texto", L"0").c_str()), 0, 8); }, [](int i) { GGAplicaRealce(i); Rebuild(); }),+ Note(L"A aparência vale para os botões, menus e janelas."),+ }));+ p.groups.push_back(G({+ Popup(L"Mostrar barras de rolagem", { L"Ao rolar", L"Sempre" },+ [] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v ? 0 : 1; },+ [](int i) {+ DWORD v = i == 0 ? 1 : 0;+ RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", REG_DWORD, &v, sizeof(v));+ SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Accessibility", SMTO_ABORTIFHUNG, 200, nullptr);+ }),+ Toggle(L"Barra de menus translúcida", [] { return Setting(L"barra_translucida", L"1") == L"1"; },+ [](bool v) { SetSetting(L"barra_translucida", v ? L"1" : L"0"); Rebuild(); }),+ }));+ Row tema = TemaRow();+ tema.label = L"Estilo do WacOS";+ Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", UsarAurora, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");+ p.groups.push_back(G({ tema, aurora }));+ return p;+}++// ================= Aparência > Transparência e Efeitos+// O vidro do Shell (Dock, barra de menus, menus, Central de Controle, Spotlight e painéis): o do+// Sequoia, ou o Liquid Glass do macOS Tahoe (lente nas bordas, brilho especular, cantos redondos)+// em "Nítido" ou "Tingido", como no 26.1. Tudo vai para %APPDATA%\Shell\ajustes.txt e o Shell+// reaplica na hora (mensagem ShellAjustesMudaram).+Page TransparenciaEfeitos() {+ Page p;+ auto on = [](const wchar_t* k, const wchar_t* d) { return Setting(k, d) == L"1"; };+ auto num = [](const wchar_t* k, const wchar_t* d) { return (float)_wtof(Setting(k, d).c_str()); };+ bool liquid = on(L"liquid_glass", L"0"), reduce = on(L"reduzir_transparencia", L"0");+ // modo leve ligado (a mesma conta do src/shell/leve.cpp): o Shell não liga o vidro real e o vidro fica fosco+ // mesmo com o botão ligado (issue #31: parecia quebrado, "Reiniciar o Liquid Glass" não fazia nada)+ bool leveOn = [] {+ auto m = Setting(L"modo_leve", L"auto");+ if (m == L"1") return true;+ if (m == L"0") return false;+ MEMORYSTATUSEX ms{ sizeof(ms) }; GlobalMemoryStatusEx(&ms);+ SYSTEM_INFO si{}; GetNativeSystemInfo(&si);+ SYSTEM_POWER_STATUS ps{};+ bool bat = GetSystemPowerStatus(&ps) && ps.ACLineStatus == 0;+ return bat || ms.ullTotalPhys / (1024.0 * 1024 * 1024) <= 10.0 || si.dwNumberOfProcessors <= 4;+ }();++ // material: três miniaturas (papel de parede com um Dock de vidro em cima)+ Row mat; mat.kind = Kind::Custom; mat.height = 112;+ auto current = [] {+ if (Setting(L"liquid_glass", L"0") != L"1") return 0;+ return Setting(L"liquid_estilo", L"nitido") == L"tingido" ? 2 : 1;+ };+ mat.draw = [current](Ctx& c, D2D1_RECT_F rr) {+ Text(c, L"Material", D2D1::RectF(rr.left + 10, rr.top, rr.left + 160, rr.top + 38), c.body, c.text);+ const wchar_t* names[3] = { L"Sequoia", L"Nítido", L"Tingido" };+ int cur = current();+ float w = 92, h = 58, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;+ for (int k = 0; k < 3; k++, x += w + gap) {+ D2D1_RECT_F t = D2D1::RectF(x, rr.top + 12, x + w, rr.top + 12 + h);+ // papel de parede: degradê com duas manchas de cor+ ID2D1GradientStopCollection* gs = nullptr;+ D2D1_GRADIENT_STOP st[3] = { { 0, c.dark ? D2D1::ColorF(0.10f, 0.16f, 0.38f, 1) : D2D1::ColorF(0.38f, 0.62f, 0.98f, 1) },+ { 0.55f, c.dark ? D2D1::ColorF(0.30f, 0.12f, 0.40f, 1) : D2D1::ColorF(0.78f, 0.52f, 0.95f, 1) },+ { 1, c.dark ? D2D1::ColorF(0.55f, 0.20f, 0.25f, 1) : D2D1::ColorF(1.0f, 0.62f, 0.45f, 1) } };+ c.dc->CreateGradientStopCollection(st, 3, &gs);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (gs) c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ t.left, t.top }, { t.right, t.bottom }), gs, &lg);+ if (lg) { c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), lg); lg->Release(); }+ if (gs) gs->Release();+ c.br->SetColor(D2D1::ColorF(1.0f, 0.85f, 0.35f, 0.85f));+ c.dc->FillEllipse(D2D1::Ellipse({ t.left + 30, t.bottom - 14 }, 10, 10), c.br);+ c.br->SetColor(D2D1::ColorF(0.2f, 0.85f, 0.75f, 0.8f));+ c.dc->FillEllipse(D2D1::Ellipse({ t.right - 24, t.bottom - 20 }, 8, 8), c.br);+ // "Dock" de vidro+ D2D1_RECT_F d = D2D1::RectF(t.left + 12, t.bottom - 22, t.right - 12, t.bottom - 7);+ float rad = k == 0 ? 3.5f : 7.5f;+ float a = k == 0 ? 0.42f : k == 1 ? 0.16f : 0.62f;+ c.br->SetColor(c.dark ? D2D1::ColorF(0.13f, 0.14f, 0.15f, a + 0.1f) : D2D1::ColorF(1, 1, 1, a));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(d, rad, rad), c.br);+ if (k == 0) {+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.5f));+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(d, rad, rad), c.br, 0.6f);+ } else { // contorno especular (claro em cima à esquerda e embaixo à direita)+ D2D1_GRADIENT_STOP rs[3] = { { 0, D2D1::ColorF(1, 1, 1, 0.95f) }, { 0.5f, D2D1::ColorF(1, 1, 1, 0.15f) }, { 1, D2D1::ColorF(1, 1, 1, 0.7f) } };+ gs = nullptr; lg = nullptr;+ c.dc->CreateGradientStopCollection(rs, 3, &gs);+ if (gs) c.dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ d.left, d.top }, { d.right, d.bottom }), gs, &lg);+ if (lg) { c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(d.left + 0.5f, d.top + 0.5f, d.right - 0.5f, d.bottom - 0.5f), rad - 0.5f, rad - 0.5f), lg, 1.0f); lg->Release(); }+ if (gs) gs->Release();+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.22f));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(d.left + 3, d.top + 1.5f, d.right - 3, d.top + 4.5f), 1.5f, 1.5f), c.br);+ }+ const UINT32 col[4] = { 0x0A84FF, 0x34C759, 0xFF9500, 0xFF2D55 };+ for (int i = 0; i < 4; i++) { // ícones+ c.br->SetColor(D2D1::ColorF(((col[i] >> 16) & 255) / 255.f, ((col[i] >> 8) & 255) / 255.f, (col[i] & 255) / 255.f, 1));+ float ix = d.left + 7 + i * ((d.right - d.left - 14 - 9) / 3);+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(ix, d.top + 3, ix + 9, d.top + 12), 2.2f, 2.2f), c.br);+ }+ if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }+ Text(c, names[k], D2D1::RectF(t.left - 10, t.bottom + 6, t.right + 10, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);+ }+ };+ mat.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ float w = 92, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;+ for (int k = 0; k < 3; k++, x += w + gap) {+ if (pt.x < x - 6 || pt.x > x + w + 6) continue;+ if (k == 0) { SetSetting(L"liquid_glass", L"0"); SetSetting(L"golden_gate", L"0"); SetSetting(L"leopard", L"0"); } // Sequoia: sai do Golden Gate e do Leopard também+ else { SetSetting(L"liquid_estilo", k == 1 ? L"nitido" : L"tingido"); SetSetting(L"liquid_glass", L"1"); }+ Rebuild();+ }+ };+ Row lg = Toggle(L"Liquid Glass", [] { return Setting(L"liquid_glass", L"0") == L"1"; },+ [](bool v) { SetSetting(L"liquid_glass", v ? L"1" : L"0"); if (!v) SetSetting(L"golden_gate", L"0"); else SetSetting(L"leopard", L"0"); Rebuild(); },+ L"O vidro do macOS Tahoe: pouco fosco e mais vivo, com brilho nas bordas e cantos mais redondos.");+ lg.enabled = !reduce;+ // vidro real: a tela por baixo, com refração de verdade na borda (como o Tahoe); desligado, o vidro+ // fosco (aparece em gravações de outros programas, que não veem as peças do vidro real)+ Row real = Toggle(L"Vidro real (refração)", [] { return Setting(L"vidro_real", L"1") == L"1"; },+ [](bool v) { SetSetting(L"vidro_real", v ? L"1" : L"0"); Rebuild(); },+ L"O fundo aparece através do vidro e dobra nas bordas, com o brilho da luz na borda, como no Tahoe. Desligado, o vidro fica fosco.");+ real.enabled = liquid && !reduce && !leveOn;+ Row refr = Slider(L"Refração nas bordas", 0, 1, [num] { return num(L"liquid_refracao", L"0.6"); },+ [](float v) { wchar_t b[16]; swprintf_s(b, L"%.2f", v); SetSetting(L"liquid_refracao", b); }, L"Nenhum", L"Forte");+ refr.enabled = liquid && !reduce;+ refr.hasDef = true; refr.def = 0.6f;+ // (o vidro real é montado pelas janelas de trás e aparece nas gravações: não há mais o que trocar para gravar)+ Row redo = Button(L"Se o vidro ficar fosco, preto ou parado, refaz o Liquid Glass sem reiniciar o Shell.", L"Reiniciar o Liquid Glass", [] {+ static UINT msg = RegisterWindowMessageW(L"ShellReiniciarVidro");+ HWND sh = FindWindowExW(HWND_MESSAGE, nullptr, L"ShellMensagens", nullptr);+ if (!sh) sh = FindWindowW(L"ShellMensagens", nullptr);+ if (sh) PostMessageW(sh, msg, 0, 0);+ });+ redo.enabled = liquid && !reduce;+ if (liquid && !reduce && leveOn)+ p.groups.push_back(G({ mat, lg, real, Note(L"O Modo leve está ligado e deixa o vidro fosco. Para usar o vidro real, mude o Modo leve para Desligado, em Desempenho, mais abaixo."), refr, redo },+ L"Vidro", L"Vale para o Dock, a barra de menus, os menus, a Central de Controle, o Spotlight e os painéis do Shell."));+ else+ p.groups.push_back(G({ mat, lg, real, refr, redo }, L"Vidro", L"Vale para o Dock, a barra de menus, os menus, a Central de Controle, o Spotlight e os painéis do Shell."));++ Row red = Toggle(L"Reduzir transparência", [] { return Setting(L"reduzir_transparencia", L"0") == L"1"; },+ [](bool v) { SetSetting(L"reduzir_transparencia", v ? L"1" : L"0"); Rebuild(); },+ L"Deixa o vidro quase opaco (e desliga o Liquid Glass).");+ Row tint = Slider(L"Transparência do vidro", 0, 1, [num] { return num(L"vidro_tinta", L"0.5"); },+ [](float v) { wchar_t b[16]; swprintf_s(b, L"%.2f", v); SetSetting(L"vidro_tinta", b); }, L"Transparente", L"Opaco");+ tint.enabled = !reduce;+ tint.hasDef = true; tint.def = 0.5f;+ Row bar = Toggle(L"Mostrar fundo da barra de menus", [] { return Setting(L"barra_fundo", L"1") != L"0"; },+ [](bool v) { SetSetting(L"barra_fundo", v ? L"1" : L"0"); },+ L"Desligado, a barra fica sem fundo, só com o papel de parede atrás (como no Tahoe).");+ bar.enabled = !reduce && !liquid; // no Tahoe a barra nunca tem fundo, como no macOS 26+ // no Tahoe: a barra pode ter o vidro do Dock (barra_vidro; o Shell confere a cada segundo)+ Row barGlass = Toggle(L"Barra de menus de vidro (Liquid Glass)", [] { return Setting(L"barra_vidro", L"0") == L"1"; },+ [](bool v) { SetSetting(L"barra_vidro", v ? L"1" : L"0"); },+ L"O vidro do Dock atrás da barra de menus: as letras ficam legíveis em qualquer papel de parede.");+ barGlass.enabled = !reduce && liquid;+ // menus (de contexto, da barra de menus e os do Windows) com o vidro do Dock em vez do vidro tingido (menu_vidro)+ Row menuGlass = Toggle(L"Menus de vidro (Liquid Glass)", [] { return Setting(L"menu_vidro", L"0") == L"1"; },+ [](bool v) { SetSetting(L"menu_vidro", v ? L"1" : L"0"); },+ L"Os menus (clique direito, barra de menus e Dock) ficam com o vidro claro do Dock, com refração na borda.");+ menuGlass.enabled = !reduce && liquid;- // macOS 26: "Permitir tingir janelas com o papel de parede" (a barra lateral dos apps pega a cor dele)- Row wtint = Toggle(L"Permitir tingir janelas com o papel de parede", [] { return Setting(L"tingir_janelas", L"1") != L"0"; },- [](bool v) { SetSetting(L"tingir_janelas", v ? L"1" : L"0"); },- L"A barra lateral dos apps (Lembretes, Calendário, Contatos, Fotos, Música) ganha um pouco da cor do papel de parede. Vale ao abrir o app de novo.");+ // macOS 26: "Permitir tingir janelas com o papel de parede" (a barra lateral dos apps pega a cor dele)+ Row wtint = Toggle(L"Permitir tingir janelas com o papel de parede", [] { return Setting(L"tingir_janelas", L"1") != L"0"; },+ [](bool v) { SetSetting(L"tingir_janelas", v ? L"1" : L"0"); },+ L"A barra lateral dos apps (Lembretes, Calendário, Contatos, Fotos, Música) ganha um pouco da cor do papel de parede. Vale ao abrir o app de novo.");- p.groups.push_back(G({ red, tint, bar, wtint }, L"Transparência"));+ p.groups.push_back(G({ red, tint, bar, barGlass, menuGlass, wtint }, L"Transparência"));-- Row genie = Toggle(L"Efeito gênio ao minimizar", [] { return Setting(L"genio", L"1") == L"1"; },- [](bool v) { SetSetting(L"genio", v ? L"1" : L"0"); });- Row anim = Toggle(L"Animar aplicativos ao abrir", [] { return Setting(L"animar_abertura", L"1") == L"1"; },- [](bool v) { SetSetting(L"animar_abertura", v ? L"1" : L"0"); });- p.groups.push_back(G({ genie, anim }, L"Efeitos"));- return p;-}--// ================= Apple Intelligence e Siri → Copilot e Fala-Page Inteligencia() {- Page p;- p.groups.push_back(Plain(Hero(0xE720, C_PURPLE, L"Assistente e Fala", L"No Windows, o assistente é o Copilot e o reconhecimento de fala fica nos ajustes de Fala.")));- p.groups.push_back(G({ Uri(L"Copilot", L"ms-copilot:", 0xE99A, C_PURPLE), Uri(L"Fala", L"ms-settings:speech", 0xE720, C_GRAY) }));- return p;-}--// ================= Central de Controle (a nossa barra de menus)-Page CentralControle() {- Page p;- auto showHide = [](const wchar_t* key, const wchar_t* def) {- std::wstring k = key, d = def;- return std::make_pair(std::function<int()>([k, d] { return Setting(k.c_str(), d.c_str()) == L"1" ? 0 : 1; }),- std::function<void(int)>([k](int i) { SetSetting(k.c_str(), i == 0 ? L"1" : L"0"); }));- };- auto wifi = showHide(L"barra_wifi", L"1"), spot = showHide(L"barra_spotlight", L"1");- Row w = Popup(L"Wi‑Fi", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, wifi.first, wifi.second); w.icon = 0xE701; w.iconColor = C_BLUE;- Row s = Popup(L"Spotlight", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, spot.first, spot.second); s.icon = 0xE721; s.iconColor = C_GRAY;- // som e Bluetooth: fora da barra por padrão, como no Mac- auto som = showHide(L"barra_som", L"0"), bt = showHide(L"barra_bluetooth", L"0");- Row so = Popup(L"Som", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, som.first, som.second); so.icon = 0xE767; so.iconColor = C_PURPLE;- Row b = Popup(L"Bluetooth", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, bt.first, bt.second); b.icon = 0xE702; b.iconColor = C_BLUE;- p.groups.push_back(G({ w, b, so, s }, L"Módulos da Central de Controle", L"Estes módulos ficam na Central de Controle. Você pode escolher quando eles também aparecem na barra de menus."));- // ícones da bandeja: guardados (lista no botão direito da Central de Controle, como o Mac sem setinha),- // na setinha » ou todos na barra- Row tray = Popup(L"Ícones dos aplicativos", { L"Guardados (botão direito na Central de Controle)", L"Agrupados no menu »", L"Sempre na barra de menus" },- [] { return Setting(L"barra_icones_todos", L"0") == L"1" ? 2 : Setting(L"barra_seta", L"0") == L"1" ? 1 : 0; },- [](int i) { SetSetting(L"barra_icones_todos", i == 2 ? L"1" : L"0"); SetSetting(L"barra_seta", i == 1 ? L"1" : L"0"); });- tray.icon = 0xE71D; tray.iconColor = C_GRAY;++ Row genie = Toggle(L"Efeito gênio ao minimizar", [] { return Setting(L"genio", L"1") == L"1"; },+ [](bool v) { SetSetting(L"genio", v ? L"1" : L"0"); });+ Row anim = Toggle(L"Animar aplicativos ao abrir", [] { return Setting(L"animar_abertura", L"1") == L"1"; },+ [](bool v) { SetSetting(L"animar_abertura", v ? L"1" : L"0"); });+ p.groups.push_back(G({ genie, anim }, L"Efeitos"));++ // Modo leve (src/shell/leve.cpp): PC fraco ou notebook na bateria+ Row leve = Popup(L"Modo leve", { L"Automático", L"Ligado", L"Desligado" },+ [] { auto v = Setting(L"modo_leve", L"auto"); return v == L"1" ? 1 : v == L"0" ? 2 : 0; },+ [](int i) { SetSetting(L"modo_leve", i == 1 ? L"1" : i == 2 ? L"0" : L"auto"); Rebuild(); });+ p.groups.push_back(G({ leve, Note(L"Menos vidro e animações a 60 quadros por segundo, para PCs com vídeo integrado ou pouca memória. "+ L"No Automático, liga na bateria e em PCs com até 8 GB de memória ou 4 núcleos.") }, L"Desempenho"));+ return p;+}++// ================= Apple Intelligence e Siri → Copilot e Fala+// Siri com a chave do próprio usuário (issue #39): src/comum/siri.h. O Ajustes não tem campo de texto, então a chave e um+// modelo fora da lista entram pela área de transferência (copiar no site do provedor, "Colar").+static std::wstring TextoCopiado() {+ std::wstring t;+ if (!OpenClipboard(nullptr)) return t;+ if (HANDLE h = GetClipboardData(CF_UNICODETEXT)) { if (auto* p = (const wchar_t*)GlobalLock(h)) { t = p; GlobalUnlock(h); } }+ CloseClipboard();+ while (!t.empty() && iswspace(t.back())) t.pop_back();+ size_t i = 0; while (i < t.size() && iswspace(t[i])) i++;+ return t.substr(i);+}+// a lista de modelos do serviço (siri::ListaModelos) numa thread: guarda em siri_modelos_<n> e, se o modelo escolhido não está+// nela (saiu do ar), troca pelo preferido da lista+static std::atomic<int> g_siriBuscando{ 0 };+static std::wstring g_siriErro;+static void SiriBuscaModelos(int prov) {+ if (g_siriBuscando.exchange(prov)) return;+ Rebuild();+ std::thread([prov] {+ std::wstring erro;+ auto l = siri::ListaModelos(prov, erro);+ if (!l.empty()) {+ std::wstring junta; for (auto& m : l) junta += (junta.empty() ? L"" : L"|") + m;+ SetSetting((L"siri_modelos_" + std::to_wstring(prov)).c_str(), junta);+ std::wstring atual = Setting(L"siri_modelo", L"");+ if (_wtoi(Setting(L"siri_provedor", L"0").c_str()) == prov && std::find(l.begin(), l.end(), atual) == l.end()) SetSetting(L"siri_modelo", l[0]);+ g_siriErro.clear();+ } else g_siriErro = erro;+ g_siriBuscando = 0;+ aj::Rebuild();+ }).detach();+}+Page Inteligencia() {+ Page p;+ p.groups.push_back(Plain(Hero(0xE720, C_PURPLE, L"Siri", L"Pergunte pelo Spotlight: digite a pergunta e escolha \"Perguntar à Siri\". A Siri usa um serviço de IA com a sua própria chave, um modelo no próprio PC ou um app de IA que já está instalado.")));+ const auto& provs = siri::Provedores();+ int prov = std::clamp(_wtoi(Setting(L"siri_provedor", L"0").c_str()), 0, (int)provs.size() - 1);+ std::vector<std::wstring> nomes;+ for (auto& pv : provs) nomes.push_back(pv.nome);+ Row rp = Popup(L"Serviço", nomes, [prov] { return prov; }, [](int i) {+ SetSetting(L"siri_provedor", std::to_wstring(i));+ const auto& v = siri::Provedores();+ if (i <= 0 || i >= (int)v.size()) { Rebuild(); return; }+ // o modelo: o primeiro da última lista que o serviço deu, ou a sugestão+ std::wstring lista = Setting((L"siri_modelos_" + std::to_wstring(i)).c_str(), L"");+ std::wstring primeiro = lista.substr(0, lista.find(L'|'));+ SetSetting(L"siri_modelo", !primeiro.empty() ? primeiro : !v[i].modelos.empty() ? std::wstring(v[i].modelos[0]) : L"");+ // sem chave a pedir (local) ou com a chave já colada: busca a lista atual+ if (*v[i].caminhoModelos && (!v[i].precisaChave || !siri::LeChave(i).empty())) SiriBuscaModelos(i);+ Rebuild();+ });+ std::vector<Row> rows{ rp };+ std::wstring nota;+ if (prov > 0) {+ const auto& pv = provs[prov];+ if (pv.fmt == siri::F_CLI) {+ nota = std::wstring(Tr(L"Usa o app instalado neste PC, com a conta que já está entrada nele (sem chave aqui). As respostas demoram um pouco mais.")) + L" " + pv.site;+ } else {+ // a lista do serviço (a última que veio) ou as sugestões+ std::vector<std::wstring> ms;+ std::wstring lista = Setting((L"siri_modelos_" + std::to_wstring(prov)).c_str(), L"");+ for (size_t a = 0; a < lista.size();) {+ size_t b = lista.find(L'|', a); if (b == std::wstring::npos) b = lista.size();+ if (b > a) ms.push_back(lista.substr(a, b - a));+ a = b + 1;+ }+ if (ms.empty()) for (auto m : pv.modelos) ms.push_back(m);+ if (ms.size() > 60) ms.resize(60); // o OpenRouter tem centenas: os 60 primeiros (o preferido vem antes)+ std::wstring atual = Setting(L"siri_modelo", ms.empty() ? L"" : ms[0].c_str());+ if (!atual.empty() && std::find(ms.begin(), ms.end(), atual) == ms.end()) ms.insert(ms.begin(), atual);+ if (!ms.empty()) {+ int sel = (int)(std::find(ms.begin(), ms.end(), atual) - ms.begin());+ rows.push_back(Popup(L"Modelo", ms, [sel] { return sel; }, [ms](int i) { if (i >= 0 && i < (int)ms.size()) SetSetting(L"siri_modelo", ms[i]); Rebuild(); }));+ }+ std::wstring det = g_siriBuscando ? Tr(L"Buscando os modelos…")+ : !g_siriErro.empty() ? std::wstring(Tr(L"Não deu para buscar:")) + L" " + g_siriErro+ : Tr(L"Busca no serviço os modelos que a sua conta pode usar agora.");+ rows.push_back(Button(L"Lista de modelos", L"Atualizar", [prov] { SiriBuscaModelos(prov); }, det));+ if (pv.fmt == siri::F_GEMINI) // issue #42: respostas com a pesquisa do Google (o Gemini deixa pela própria API)+ rows.push_back(Toggle(L"Pesquisar na web", [] { return Setting(L"siri_web", L"1") != L"0"; }, [](bool v) { SetSetting(L"siri_web", v ? L"1" : L"0"); },+ L"Para notícias, clima e o que aconteceu hoje, o Gemini pesquisa no Google antes de responder."));+ rows.push_back(Button(L"Usar outro modelo", L"Colar nome", [] {+ std::wstring t = TextoCopiado();+ if (!t.empty() && t.size() < 120 && t.find_first_of(L" \r\n\t\"") == std::wstring::npos) SetSetting(L"siri_modelo", t);+ Rebuild();+ }, L"Copie o nome do modelo no site do serviço e cole aqui."));+ if (pv.precisaChave) {+ std::wstring k = siri::LeChave(prov);+ rows.push_back(Button(L"Chave da API", L"Colar chave", [prov] {+ std::wstring t = TextoCopiado();+ if (!t.empty() && t.size() < 400 && t.find_first_of(L" \r\n\t") == std::wstring::npos && siri::GravaChave(prov, t)) SiriBuscaModelos(prov);+ Rebuild();+ }, k.empty() ? Tr(L"Nenhuma chave. Copie a chave e clique em Colar chave.") : siri::ChaveMascarada(k)));+ if (!k.empty()) rows.push_back(Button(L"Apagar a chave deste PC", L"Apagar", [prov] { siri::GravaChave(prov, L""); Rebuild(); }));+ nota = std::wstring(Tr(L"Pegue a chave no site do serviço e use \"Colar chave\". A chave fica cifrada nesta conta do Windows, e as perguntas vão direto do PC para o serviço.")) + L" " + pv.site;+ } else nota = std::wstring(Tr(L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.")) + L" " + pv.site;+ }+ }+ p.groups.push_back(G(rows, L"Siri", nota));+ p.groups.push_back(Plain(Hero(0xE720, C_PURPLE, L"Assistente e Fala", L"No Windows, o assistente é o Copilot e o reconhecimento de fala fica nos ajustes de Fala.")));+ p.groups.push_back(G({ Uri(L"Copilot", L"ms-copilot:", 0xE99A, C_PURPLE), Uri(L"Fala", L"ms-settings:speech", 0xE720, C_GRAY) }));+ return p;+}++// ================= Central de Controle (a nossa barra de menus)+Page CentralControle() {+ Page p;+ auto showHide = [](const wchar_t* key, const wchar_t* def) {+ std::wstring k = key, d = def;+ return std::make_pair(std::function<int()>([k, d] { return Setting(k.c_str(), d.c_str()) == L"1" ? 0 : 1; }),+ std::function<void(int)>([k](int i) { SetSetting(k.c_str(), i == 0 ? L"1" : L"0"); }));+ };+ auto wifi = showHide(L"barra_wifi", L"1"), spot = showHide(L"barra_spotlight", L"1");+ Row w = Popup(L"Wi‑Fi", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, wifi.first, wifi.second); w.icon = 0xE701; w.iconColor = C_BLUE;+ Row s = Popup(L"Spotlight", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, spot.first, spot.second); s.icon = 0xE721; s.iconColor = C_GRAY;+ // som e Bluetooth: fora da barra por padrão, como no Mac+ auto som = showHide(L"barra_som", L"0"), bt = showHide(L"barra_bluetooth", L"0");+ Row so = Popup(L"Som", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, som.first, som.second); so.icon = 0xE767; so.iconColor = C_PURPLE;+ Row b = Popup(L"Bluetooth", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, bt.first, bt.second); b.icon = 0xE702; b.iconColor = C_BLUE;+ // a Siri no canto da barra (aparece com um serviço escolhido em Apple Intelligence e Siri)+ auto siriB = showHide(L"barra_siri", L"1");+ Row si = Popup(L"Siri", { L"Mostrar na Barra de Menus", L"Não Mostrar na Barra de Menus" }, siriB.first, siriB.second); si.icon = 0xE720; si.iconColor = C_PURPLE;+ p.groups.push_back(G({ w, b, so, s, si }, L"Módulos da Central de Controle", L"Estes módulos ficam na Central de Controle. Você pode escolher quando eles também aparecem na barra de menus."));+ // ícones da bandeja: guardados (lista no botão direito da Central de Controle, como o Mac sem setinha),+ // na setinha » ou todos na barra+ Row tray = Popup(L"Ícones dos aplicativos", { L"Guardados (botão direito na Central de Controle)", L"Agrupados no menu »", L"Sempre na barra de menus" },+ [] { return Setting(L"barra_icones_todos", L"0") == L"1" ? 2 : Setting(L"barra_seta", L"0") == L"1" ? 1 : 0; },+ [](int i) { SetSetting(L"barra_icones_todos", i == 2 ? L"1" : L"0"); SetSetting(L"barra_seta", i == 1 ? L"1" : L"0"); });+ tray.icon = 0xE71D; tray.iconColor = C_GRAY;- p.groups.push_back(G({ tray }, L"Barra de Menus", L"Ícones que os aplicativos põem na área de notificação do Windows."));+ // o vidro da barra também aqui, à vista (antes só em Aparência > Transparência e Efeitos); o mesmo barra_vidro+ Row barGlass = Toggle(L"Barra de menus de vidro (Liquid Glass)", [] { return Setting(L"barra_vidro", L"0") == L"1"; },+ [](bool v) { SetSetting(L"barra_vidro", v ? L"1" : L"0"); },+ L"O vidro do Dock atrás da barra de menus: as letras ficam legíveis em qualquer papel de parede.");+ barGlass.icon = 0xE790; barGlass.iconColor = C_BLUE;+ barGlass.enabled = Setting(L"liquid_glass", L"0") == L"1" && Setting(L"reduzir_transparencia", L"0") != L"1" && Setting(L"leopard", L"0") != L"1";+ p.groups.push_back(G({ tray, barGlass }, L"Barra de Menus", L"Ícones que os aplicativos põem na área de notificação do Windows."));- Row clock = Popup(L"Relógio", { L"Dia, data e hora", L"Só a hora" }, [] { return Setting(L"relogio_curto", L"0") == L"1" ? 1 : 0; },- [](int i) { SetSetting(L"relogio_curto", i == 1 ? L"1" : L"0"); });- clock.icon = 0xE787; clock.iconColor = C_GRAY;- // Reddit (dougnite, 20/11/2026): sem barra nos monitores secundários (o topo deles volta para as janelas)- Row todos = Toggle(L"Mostrar a barra de menus em todos os monitores", [] { return Setting(L"barra_todos_monitores", L"1") != L"0"; },- [](bool v) { SetSetting(L"barra_todos_monitores", v ? L"1" : L"0"); },- L"Desligado, a barra de menus fica só no monitor principal e os outros usam a tela inteira.");- todos.icon = 0xE7F4; todos.iconColor = C_GRAY;- // issue #8: a bolinha laranja (microfone) / verde (câmera) entre a Central de Controle e a data, como no macOS- Row priv = Toggle(L"Mostrar o uso do microfone e da câmera", [] { return Setting(L"barra_privacidade", L"1") != L"0"; },- [](bool v) { SetSetting(L"barra_privacidade", v ? L"1" : L"0"); },- L"Uma bolinha laranja (microfone) ou verde (câmera) aparece ao lado da data enquanto um app usa um deles.");- priv.icon = 0xE720; priv.iconColor = C_ORANGE;- p.groups.push_back(G({ clock, todos, priv }));- return p;-}--// ================= Ilha Dinâmica (issue #8: página própria; antes ficava no fim da Central de Controle)-Page IlhaDinamica() {- Page p;- // Ilha Dinâmica (src/shell/ilha.cpp): desligada por padrão; as outras opções só valem com ela ligada- auto on = [](const wchar_t* k, const wchar_t* d) { std::wstring kk = k, dd = d; return std::function<bool()>([kk, dd] { return Setting(kk.c_str(), dd.c_str()) == L"1"; }); };- auto set = [](const wchar_t* k) { std::wstring kk = k; return std::function<void(bool)>([kk](bool v) { SetSetting(kk.c_str(), v ? L"1" : L"0"); Rebuild(); }); };- std::vector<Row> ilha = { Toggle(L"Ilha Dinâmica", on(L"ilha", L"0"), set(L"ilha"),- L"Mostra no topo da tela a música tocando, timers, notificações, downloads, o volume e uma estante de arquivos. Passe o ponteiro sobre ela para abrir.") };- if (Setting(L"ilha", L"0") == L"1") {- // estilo: notch (entalhe grudado no topo), ilha (pílula sempre na barra) ou só quando acontece algo- Row est = Popup(L"Estilo", { L"Notch", L"Ilha", L"Só quando houver algo" },- [] { std::wstring v = Setting(L"ilha_estilo", L"notch"); return v == L"ilha" ? 1 : v == L"notificacao" ? 2 : 0; },- [](int i) { SetSetting(L"ilha_estilo", i == 1 ? L"ilha" : i == 2 ? L"notificacao" : L"notch"); });- ilha.push_back(est);- ilha.push_back(Toggle(L"Abrir ao passar o ponteiro", on(L"ilha_passar", L"1"), set(L"ilha_passar")));- ilha.push_back(Toggle(L"Mostrar notificações na ilha", on(L"ilha_notificacoes", L"1"), set(L"ilha_notificacoes")));- ilha.push_back(Toggle(L"Mostrar o volume na ilha", on(L"ilha_volume", L"1"), set(L"ilha_volume")));- ilha.push_back(Toggle(L"Avisar “Copiado” ao copiar", on(L"ilha_copiado", L"1"), set(L"ilha_copiado"),- L"Um aviso rápido na ilha quando você copia um texto, uma imagem ou arquivos."));- }- p.groups.push_back(G(ilha, L"Ilha Dinâmica"));- if (Setting(L"ilha", L"0") == L"1")- p.groups.push_back(G({ Note(L"Na ilha também ficam a bolinha laranja (microfone) ou verde (câmera) em uso, o timer (aba Timer: pausar, parar, ±1 minuto) e o histórico do que você copiou (aba Transferência).") }));- return p;-}--// ================= Personalizar o Dock / a Mesa (pedido de 20/11/2026, na linha do MyDockFinder)-// O Shell lê cada chave (dock.cpp ReadSettings, mesa.cpp LerMedidas, widgets.cpp SettingsChanged) assim que o-// ajustes.txt muda. Chave vazia = o padrão medido do Mac em cada tema.-static float NumSetting(const wchar_t* k, float def) { std::wstring v = Setting(k, L""); return v.empty() ? def : (float)_wtof(v.c_str()); }-static std::function<void(float)> SetNum(const wchar_t* k) { std::wstring kk = k; return [kk](float v) { SetSetting(kk.c_str(), std::to_wstring((int)std::lround(v))); }; }-static Row Flag(const std::wstring& label, const wchar_t* k, const wchar_t* def, const std::wstring& detail = L"") {- std::wstring kk = k, dd = def;- return Toggle(label, [kk, dd] { return Setting(kk.c_str(), dd.c_str()) != L"0"; }, [kk](bool on) { SetSetting(kk.c_str(), on ? L"1" : L"0"); }, detail);-}-static std::wstring IconesDockDir() {- PWSTR p = nullptr;- std::wstring d;- if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) { d = std::wstring(p) + L"\\Shell\\icones-dock"; CoTaskMemFree(p); }- return d;-}--Page PersonalizarDock() {- Page p;- bool tahoe = Setting(L"liquid_glass", L"0") == L"1";- Row esp = Slider(L"Espaço entre os ícones", 0, 32, [] { return NumSetting(L"dock_espaco", 0); }, SetNum(L"dock_espaco"), L"Juntos", L"Separados");- esp.hasDef = true; esp.def = 0;- Row marg = Slider(L"Distância da borda da tela", 0, 40, [] { return NumSetting(L"dock_margem", 5); }, SetNum(L"dock_margem"), L"Encostado", L"Longe");- marg.hasDef = true; marg.def = 5;- p.groups.push_back(G({ esp, marg }, L"Tamanho e Espaço"));- float raioDef = tahoe ? 61.f : 43.f, opacDef = tahoe ? 39.f : 45.f;- Row raio = Slider(L"Arredondamento dos cantos", 0, 100, [raioDef] { return NumSetting(L"dock_raio", raioDef); }, SetNum(L"dock_raio"), L"Reto", L"Pílula");- raio.hasDef = true; raio.def = raioDef;- static const wchar_t* cores[] = { L"auto", L"clara", L"escura", L"destaque" };- Row cor = Popup(L"Cor do vidro", { L"Automática", L"Clara", L"Escura", L"Cor de destaque" },- [] { std::wstring v = Setting(L"dock_cor", L"auto"); for (int i = 0; i < 4; i++) if (v == cores[i]) return i; return 0; },- [](int i) { SetSetting(L"dock_cor", cores[std::clamp(i, 0, 3)]); });- Row opac = Slider(L"Opacidade do vidro", 0, 100, [opacDef] { return NumSetting(L"dock_opacidade", opacDef); }, SetNum(L"dock_opacidade"), L"Transparente", L"Sólido");- opac.hasDef = true; opac.def = opacDef;- p.groups.push_back(G({ raio, cor, opac }, L"Fundo"));- Row ind = Popup(L"Indicador de app aberto", { L"Ponto", L"Traço" }, [] { return Setting(L"dock_indicador", L"ponto") == L"traco" ? 1 : 0; },- [](int i) { SetSetting(L"dock_indicador", i == 1 ? L"traco" : L"ponto"); });- p.groups.push_back(G({ Flag(L"Mostrar o Launchpad", L"dock_launchpad", L"1"), Flag(L"Mostrar a divisória", L"dock_separador", L"1"),- Flag(L"Mostrar o nome ao passar o ponteiro", L"dock_rotulos", L"1"), ind,- Flag(L"Mostrar indicadores de aplicativos abertos", L"indicadores", L"1"),- Flag(L"Animar aplicativos ao abrir", L"animar_abertura", L"1"),- Flag(L"Pular quando chega uma notificação", L"pulo_notificacao", L"1") }, L"Itens e Animações"));- p.groups.push_back(G({ Button(L"Ícones próprios", L"Abrir a Pasta…", [] {- std::wstring d = IconesDockDir();- if (d.empty()) return;- SHCreateDirectoryExW(nullptr, d.c_str(), nullptr);- ShellExecuteW(nullptr, L"open", d.c_str(), nullptr, nullptr, SW_SHOWNORMAL);- }, L"Ponha um PNG com o nome do .exe (chrome.png, discord.png) ou do app (Google Chrome.png) nesta pasta para trocar o ícone dele no Dock. Imagens de 512 × 512 com a margem do Mac ficam melhores.") }, L"Ícones"));- p.groups.push_back(Plain(Buttons({ { L"Restaurar o Padrão", [] {- for (auto k : { L"dock_espaco", L"dock_margem", L"dock_raio", L"dock_opacidade" }) SetSetting(k, L"");- SetSetting(L"dock_cor", L"auto"); SetSetting(L"dock_indicador", L"ponto");- for (auto k : { L"dock_launchpad", L"dock_separador", L"dock_rotulos" }) SetSetting(k, L"1");- Rebuild();- } } })));- return p;-}--Page PersonalizarMesa() {- Page p;- Row tam = Slider(L"Tamanho dos ícones", 16, 128, [] { return NumSetting(L"mesa_icone_tamanho", 64); }, SetNum(L"mesa_icone_tamanho"), L"Pequeno", L"Grande");- tam.hasDef = true; tam.def = 64;- Row esp = Slider(L"Espaço da grade", -20, 80, [] { return NumSetting(L"mesa_espaco", 0); }, SetNum(L"mesa_espaco"), L"Junto", L"Separado");- esp.hasDef = true; esp.def = 0;- Row txt = Slider(L"Tamanho do texto", 10, 16, [] { return NumSetting(L"mesa_texto", 12); }, SetNum(L"mesa_texto"), L"10", L"16");- txt.hasDef = true; txt.def = 12;- p.groups.push_back(G({ Flag(L"Mostrar ícones na mesa", L"mesa_icones", L"1"), tam, esp, txt,- Toggle(L"Alinhar à grade", [] { return Setting(L"mesa_grade", L"0") == L"1"; }, [](bool on) { SetSetting(L"mesa_grade", on ? L"1" : L"0"); }),- Toggle(L"Usar Pilhas", [] { return Setting(L"mesa_pilhas", L"0") == L"1"; }, [](bool on) { SetSetting(L"mesa_pilhas", on ? L"1" : L"0"); },- L"Agrupa os arquivos da mesa por tipo.") }, L"Ícones da Mesa"));- p.groups.push_back(G({ Flag(L"Tempo", L"widget.tempo.on", L"1"), Flag(L"Relógio", L"widget.relogio.on", L"1"), Flag(L"Calendário", L"widget.calendario.on", L"1"),- Flag(L"Relógio Mundial", L"widget.mundial.on", L"1"), Flag(L"Nascer do Sol", L"widget.sol.on", L"1") }, L"Widgets na Mesa"));- p.groups.push_back(Plain(Buttons({ { L"Restaurar o Padrão", [] {- for (auto k : { L"mesa_icone_tamanho", L"mesa_espaco", L"mesa_texto" }) SetSetting(k, L"");- Rebuild();- } } })));- return p;-}--// ================= Mesa e Dock-Page MesaDock() {- Page p;- auto num = [](const wchar_t* k, const wchar_t* d) { return (float)_wtof(Setting(k, d).c_str()); };- auto flag = [](const wchar_t* k, const wchar_t* d) { std::wstring kk = k, dd = d; return std::function<bool()>([kk, dd] { return Setting(kk.c_str(), dd.c_str()) == L"1"; }); };- auto setFlag = [](const wchar_t* k) { std::wstring kk = k; return std::function<void(bool)>([kk](bool on) { SetSetting(kk.c_str(), on ? L"1" : L"0"); }); };- Row size = Slider(L"Tamanho", 16, 128, [num] { return num(L"tamanho", L"48"); }, [](float v) { SetSetting(L"tamanho", std::to_wstring((int)std::lround(v))); }, L"Pequeno", L"Grande");- Row mag = Toggle(L"Ampliação", flag(L"ampliacao", L"0"), setFlag(L"ampliacao"));- Row magSize = Slider(L"Tamanho da ampliação", 16, 256, [num] { return num(L"ampliacao_tamanho", L"128"); },- [](float v) { SetSetting(L"ampliacao_tamanho", std::to_wstring((int)std::lround(v))); }, L"Pequeno", L"Grande");- magSize.enabled = Setting(L"ampliacao", L"0") == L"1";- size.hasDef = true; size.def = 48;- magSize.hasDef = true; magSize.def = 128;- // dock_posicao = baixo | esquerda | direita (o Dock do Leopard, a prateleira em perspectiva, fica sempre embaixo)- Row pos = Popup(L"Posição na tela", { L"Esquerda", L"Embaixo", L"Direita" }, [] {- std::wstring v = Setting(L"dock_posicao", L"baixo");- return v == L"esquerda" ? 0 : v == L"direita" ? 2 : 1;- }, [](int i) { SetSetting(L"dock_posicao", i == 0 ? L"esquerda" : i == 2 ? L"direita" : L"baixo"); });- // Monitor do Dock (dock_monitor = nome do monitor, ex. \\.\DISPLAY2; vazio = o principal). A barra de- // menus fica em todos; o Dock só neste.- std::vector<std::wstring> monDev{ L"" }, monName{ L"Tela principal" };- {- struct Ctx { std::vector<std::wstring>*dev, *name; } ctx{ &monDev, &monName };- EnumDisplayMonitors(nullptr, nullptr, [](HMONITOR hm, HDC, LPRECT, LPARAM p) -> BOOL {- auto* c = (Ctx*)p;- MONITORINFOEXW mi{}; mi.cbSize = sizeof(mi);- if (!GetMonitorInfoW(hm, &mi) || (mi.dwFlags & MONITORINFOF_PRIMARY)) return TRUE;- DISPLAY_DEVICEW dd{ sizeof(dd) };- std::wstring name = mi.szDevice;- if (name.rfind(L"\\\\.\\", 0) == 0) name = name.substr(4); // \\.\DISPLAY2 -> DISPLAY2- if (EnumDisplayDevicesW(mi.szDevice, 0, &dd, 0) && dd.DeviceString[0]) name += std::wstring(L" (") + dd.DeviceString + L")";- c->dev->push_back(mi.szDevice);- c->name->push_back(name);- return TRUE;- }, (LPARAM)&ctx);- }- Row monRow = Popup(L"Monitor do Dock", monName,- [monDev] { std::wstring v = Setting(L"dock_monitor", L""); for (int i = 0; i < (int)monDev.size(); i++) if (!_wcsicmp(v.c_str(), monDev[i].c_str())) return i; return 0; },- [monDev](int i) { SetSetting(L"dock_monitor", monDev[std::clamp(i, 0, (int)monDev.size() - 1)]); });- monRow.enabled = monDev.size() > 1;- // Inteligente: só esconde quando uma janela encosta no Dock (pedido de um usuário no Reddit)- Row hide = Popup(L"Ocultar o Dock", { L"Nunca", L"Automaticamente", L"Quando uma janela encostar nele" },- [] { std::wstring v = Setting(L"ocultar", L"0"); return v == L"1" ? 1 : v == L"inteligente" ? 2 : 0; },- [](int i) { SetSetting(L"ocultar", i == 1 ? L"1" : i == 2 ? L"inteligente" : L"0"); });- // issue #8 (macOS: "Minimizar janelas no ícone do aplicativo"): a janela minimizada vai para o ícone do app, sem a- // miniatura entre Downloads e a Lixeira; clicar no ícone traz de volta- Row minIcon = Toggle(L"Minimizar janelas no ícone do aplicativo", flag(L"dock_minimizar_no_icone", L"0"), setFlag(L"dock_minimizar_no_icone"));- Row anim = Toggle(L"Animar aplicativos ao abrir", flag(L"animar_abertura", L"1"), setFlag(L"animar_abertura"));- Row ind = Toggle(L"Mostrar indicadores de aplicativos abertos", flag(L"indicadores", L"1"), setFlag(L"indicadores"));- Row dl = Toggle(L"Mostrar a pasta Downloads no Dock", flag(L"dock_downloads", L"1"), setFlag(L"dock_downloads"));- Row pers = Link(L"Personalizar o Dock…", [] { Push(L"Personalizar o Dock", PersonalizarDock); });- p.groups.push_back(G({ size, mag, magSize, pos, monRow, hide, minIcon, anim, ind, dl, pers }, L"Dock"));- // como no macOS 15/26 (Mesa e Dock > Área de Trabalho e Organizador Visual)- // macOS 14+: "Mostrar Itens: Na Mesa" (o mesmo que o menu da mesa "Ocultar Ícones da Mesa")- Row icons = Toggle(L"Mostrar ícones na mesa", [] { return Setting(L"mesa_icones", L"1") != L"0"; }, [](bool v) { SetSetting(L"mesa_icones", v ? L"1" : L"0"); });- Row persMesa = Link(L"Personalizar a Mesa…", [] { Push(L"Personalizar a Mesa", PersonalizarMesa); });- p.groups.push_back(G({ icons, persMesa, Popup(L"Clicar no papel de parede para mostrar a mesa", { L"Sempre", L"Só no Organizador Visual", L"Nunca" },- [] { std::wstring v = Setting(L"clique_mostra_mesa", L"palco"); return v == L"1" ? 0 : v == L"0" ? 2 : 1; },- [](int i) { SetSetting(L"clique_mostra_mesa", i == 0 ? L"1" : i == 2 ? L"0" : L"palco"); }) }, L"Área de Trabalho"));- p.groups.push_back(G({ Toggle(L"Arrastar janelas para as bordas da tela para organizar", [] { return sys::SnapEnabled(); }, [](bool on) { sys::SetSnapEnabled(on); }),- // issue #4: como no Mac, o Finder fica no Alt+Tab mesmo sem janela; desligado, só com janela aberta- Toggle(L"Mostrar o Finder no Alt+Tab mesmo sem janelas", [] { return Setting(L"seletor_finder", L"1") != L"0"; },- [](bool v) { SetSetting(L"seletor_finder", v ? L"1" : L"0"); }),- Uri(L"Navegador padrão", L"ms-settings:defaultapps") }, L"Janelas"));- // Organizador Visual (Stage Manager): só o app da frente na tela, os outros numa faixa à esquerda- p.groups.push_back(G({ Toggle(L"Organizador Visual", flag(L"organizador", L"0"), setFlag(L"organizador")) }, L"",- L"Os outros apps ficam numa faixa à esquerda; clique numa miniatura para trazer o app."));- // Cantos Ativos (como no Mac): uma ação por canto da tela; o Shell lê canto_se/sd/ie/id- {- static const wchar_t* vals[] = { L"nada", L"mission", L"janelas", L"mesa", L"launchpad", L"notificacoes", L"central", L"spotlight", L"bloquear", L"tela", L"nota" };- static const std::vector<std::wstring> names = { L"Nada", L"Mission Control", L"Janelas do Aplicativo", L"Mesa", L"Launchpad", L"Central de Notificações",- L"Central de Controle", L"Spotlight", L"Bloquear Tela", L"Descansar a Tela", L"Nota Rápida" };- const int NV = (int)(sizeof(vals) / sizeof(vals[0]));- auto corner = [](const wchar_t* label, const wchar_t* key, const wchar_t* def) {- std::wstring k = key, d = def;- return Popup(label, names,- [k, d] { std::wstring v = Setting(k.c_str(), d.c_str()); for (int i = 0; i < NV; i++) if (v == vals[i]) return i; return 0; },- [k](int i) { SetSetting(k.c_str(), vals[std::clamp(i, 0, NV - 1)]); });- };- p.groups.push_back(G({ corner(L"Canto superior esquerdo", L"canto_se", L"nada"), corner(L"Canto superior direito", L"canto_sd", L"nada"),- corner(L"Canto inferior esquerdo", L"canto_ie", L"nada"), corner(L"Canto inferior direito", L"canto_id", L"nota"),- Note(L"Leve o ponteiro até um canto da tela para fazer a ação. Não funciona arrastando nem com um app em tela cheia.") },- L"Cantos Ativos"));- }- return p;-}--// ================= Telas-static bool g_allRes; // Telas: "Mostrar todas as resoluções"--Page Telas() {- Page p;- DISPLAY_DEVICEW dd{ sizeof(dd) }, mon{ sizeof(mon) };- std::wstring name = L"Tela";- for (DWORD k = 0; EnumDisplayDevicesW(nullptr, k, &dd, 0); k++)- if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { if (EnumDisplayDevicesW(dd.DeviceName, 0, &mon, 0) && mon.DeviceString[0]) name = mon.DeviceString; break; }- auto mode = sys::CurrentResolution();- std::wstring wall = sys::Wallpaper();- // monitor com a imagem de fundo na tela e o pé, como no macOS 26; nome embaixo- Row head; head.kind = Kind::Custom; head.height = 150;- head.draw = [name, mode, wall](Ctx& c, D2D1_RECT_F rr) {- float cx = (rr.left + rr.right) / 2;- float ar = mode.h ? (float)mode.w / mode.h : 1.6f;- float h = 78, w = std::min(220.f, h * ar);- D2D1_RECT_F scr = D2D1::RectF(cx - w / 2, rr.top + 14, cx + w / 2, rr.top + 14 + h);- c.br->SetColor(D2D1::ColorF(0.08f, 0.08f, 0.09f, 1));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(scr, 5, 5), c.br);- D2D1_RECT_F in = D2D1::RectF(scr.left + 3, scr.top + 3, scr.right - 3, scr.bottom - 3);- if (ID2D1Bitmap* b = BitmapFromFile(wall, 480)) {- auto s2 = b->GetSize();- float k = std::max((in.right - in.left) / s2.width, (in.bottom - in.top) / s2.height);- float dw = s2.width * k, dh = s2.height * k, mx = (in.left + in.right) / 2, my = (in.top + in.bottom) / 2;- c.dc->PushAxisAlignedClip(in, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);- c.dc->DrawBitmap(b, D2D1::RectF(mx - dw / 2, my - dh / 2, mx + dw / 2, my + dh / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);- c.dc->PopAxisAlignedClip();- } else { c.br->SetColor(c.accent); c.dc->FillRectangle(in, c.br); }- c.br->SetColor(D2D1::ColorF(0.55f, 0.55f, 0.57f, 1)); // pé- c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 22, scr.bottom, cx + 22, scr.bottom + 6), 1.5f, 1.5f), c.br);- Text(c, name, D2D1::RectF(rr.left, scr.bottom + 14, rr.right, scr.bottom + 34), c.center, c.text);- // setinha embaixo do nome (a tela escolhida), como no Mac- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.10f) : D2D1::ColorF(0, 0, 0, 0.08f));- c.dc->FillRectangle(D2D1::RectF(rr.left - 20, rr.bottom - 1, rr.right + 20, rr.bottom), c.br);- };- p.groups.push_back(Plain(head));-- // resoluções numa lista dentro da caixa (a atual destacada); "Mostrar todas" abre as de outras proporções- auto res = sys::Resolutions();- std::vector<sys::Mode> shown;- float curAr = mode.h ? (float)mode.w / mode.h : 0;- for (auto& m : res) {- bool dup = false;- for (auto& o : shown) if (o.w == m.w && o.h == m.h) dup = true;- if (dup) continue;- if (!g_allRes && m.h && std::fabs((float)m.w / m.h - curAr) > 0.02f) continue;- shown.push_back(m);- }- std::sort(shown.begin(), shown.end(), [](const sys::Mode& a, const sys::Mode& b) { return a.w * a.h > b.w * b.h; });- if (!g_allRes && shown.size() > 6) { // as 6 em volta da atual- int ci = 0;- for (int k = 0; k < (int)shown.size(); k++) if (shown[k].w == mode.w && shown[k].h == mode.h) ci = k;- int from = std::clamp(ci - 2, 0, (int)shown.size() - 6);- shown = std::vector<sys::Mode>(shown.begin() + from, shown.begin() + from + 6);- }- Group rg = G({});- if (!shown.empty()) {- Row list; list.kind = Kind::Custom; list.height = 8 + shown.size() * 34.f;- list.draw = [shown, mode](Ctx& c, D2D1_RECT_F rr) {- for (size_t k = 0; k < shown.size(); k++) {- D2D1_RECT_F r = D2D1::RectF(rr.left + 8, rr.top + 4 + k * 34, rr.right - 8, rr.top + 4 + (k + 1) * 34);- bool cur = shown[k].w == mode.w && shown[k].h == mode.h;- if (cur) { c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.08f)); c.dc->FillRoundedRectangle(D2D1::RoundedRect(r, 6, 6), c.br); }- else if (k > 0 && !(shown[k - 1].w == mode.w && shown[k - 1].h == mode.h)) {- c.br->SetColor(c.line); c.dc->FillRectangle(D2D1::RectF(r.left + 10, r.top - 0.5f, r.right - 10, r.top + 0.5f), c.br);- }- Text(c, std::to_wstring(shown[k].w) + L" × " + std::to_wstring(shown[k].h), D2D1::RectF(r.left + 10, r.top, r.right - 10, r.bottom), c.body, c.text);- }- };- list.clickAt = [shown](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- int k = (int)((pt.y - rr.top - 4) / 34);- if (k >= 0 && k < (int)shown.size()) { sys::SetResolution(shown[k]); Rebuild(); }- };- rg.rows.push_back(list);- }- rg.rows.push_back(Toggle(L"Mostrar todas as resoluções", [] { return g_allRes; }, [](bool on) { g_allRes = on; Rebuild(); }));- p.groups.push_back(rg);-- float b = sys::Brightness();- if (b >= 0) p.groups.push_back(G({ Slider(L"Brilho", 0, 1, [] { return std::max(0.f, sys::Brightness()); }, [](float v) { sys::SetBrightness(v); },- std::wstring(1, (wchar_t)0xE706), std::wstring(1, (wchar_t)0xE706)) }));- auto rates = sys::RefreshRates();- if (rates.size() > 1) {- std::vector<std::wstring> ol;- int cr = sys::RefreshRate(), ci = 0;- for (int k = 0; k < (int)rates.size(); k++) { ol.push_back(std::to_wstring(rates[k]) + L" Hertz"); if (rates[k] == cr) ci = k; }- p.groups.push_back(G({ Popup(L"Taxa de atualização", ol, [ci] { return ci; }, [rates](int k) { sys::SetRefreshRate(rates[k]); }) }));- }- p.groups.push_back(G({ Link(L"Escala", [] { OpenUri(L"ms-settings:display"); }, 0, 0, [] { return Fmt(L"%d%%", (int)std::lround(sys::ScaleFactor() * 100)); }) }));- p.groups.push_back(Plain(Buttons({ { L"Avançado…", [] { OpenUri(L"ms-settings:display-advanced"); } }, { L"Night Shift…", [] { OpenUri(L"ms-settings:nightlight"); } } })));- return p;-}--// ================= Protetor de Tela-const wchar_t* SAVER_FILES[] = { L"", L"scrnsave.scr", L"Bubbles.scr", L"Ribbons.scr", L"Mystify.scr", L"PhotoScreensaver.scr", L"ssText3d.scr" };-const wchar_t* SAVER_NAMES[] = { L"Nenhum", L"Em Branco", L"Bolhas", L"Fitas", L"Mistificar", L"Fotos", L"Texto 3D" };--Page Protetor() {- Page p;- std::vector<std::wstring> names(std::begin(SAVER_NAMES), std::end(SAVER_NAMES));- p.groups.push_back(G({- Popup(L"Protetor de tela", names,- [] {- wchar_t buf[MAX_PATH] = {}; DWORD cb = sizeof(buf);- RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"SCRNSAVE.EXE", RRF_RT_REG_SZ, nullptr, buf, &cb);- std::wstring f = PathFindFileNameW(buf);- for (int i = 1; i < 7; i++) if (_wcsicmp(f.c_str(), SAVER_FILES[i]) == 0) return i;- return 0;- },- [](int i) {- wchar_t sysdir[MAX_PATH]; GetSystemDirectoryW(sysdir, MAX_PATH);- if (i == 0) { RegDeleteKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"SCRNSAVE.EXE"); SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, FALSE, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); return; }- std::wstring path = std::wstring(sysdir) + L"\\" + SAVER_FILES[i];- RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"SCRNSAVE.EXE", REG_SZ, path.c_str(), (DWORD)((path.size() + 1) * 2));- SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, TRUE, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);- }),- Popup(L"Iniciar o protetor de tela quando inativo", MinuteLabels(L"Após "),- [] { UINT s = 0; SystemParametersInfoW(SPI_GETSCREENSAVETIMEOUT, 0, &s, 0); BOOL on = FALSE; SystemParametersInfoW(SPI_GETSCREENSAVEACTIVE, 0, &on, 0); return MinuteIndex(on ? (int)(s / 60) : 0); },- [](int i) { if (MINUTES[i]) SystemParametersInfoW(SPI_SETSCREENSAVETIMEOUT, MINUTES[i] * 60, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);- else SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, FALSE, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); }),- }));- p.groups.push_back(Plain(Buttons({ { L"Pré-visualizar", [] {- wchar_t buf[MAX_PATH] = {}; DWORD cb = sizeof(buf);- if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"SCRNSAVE.EXE", RRF_RT_REG_SZ, nullptr, buf, &cb) == ERROR_SUCCESS)- ShellExecuteW(nullptr, L"open", buf, L"/s", nullptr, SW_SHOWNORMAL);- } } })));- return p;-}--// ================= Spotlight-Page Spotlight() {- Page p;- p.groups.push_back(G({ Uri(L"Permissões de Pesquisa", L"ms-settings:search-permissions", 0xE721, C_GRAY),- Uri(L"Pesquisa no Windows (Indexação)", L"ms-settings:cortana-windowssearch", 0xE8B7, C_BLUE) },- L"Resultados da Pesquisa", L"O Spotlight usa o índice de pesquisa do Windows para achar arquivos."));- return p;-}--// ================= Imagem de Fundo-const wchar_t* FIT_NAMES[] = { L"Centralizar", L"Lado a Lado", L"Esticar", L"Ajustar à Tela", L"Preencher Tela", L"Estender" };--static bool g_allPhotos; // Imagem de Fundo: "Mostrar Todas"--void AddPhoto() {- IFileOpenDialog* d = nullptr;- if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&d)))) return;- COMDLG_FILTERSPEC spec[] = { { L"Imagens", L"*.jpg;*.jpeg;*.png;*.bmp" } };- d->SetFileTypes(1, spec);- if (SUCCEEDED(d->Show(Window()))) {- IShellItem* it = nullptr;- if (SUCCEEDED(d->GetResult(&it))) {- PWSTR path = nullptr;- if (SUCCEEDED(it->GetDisplayName(SIGDN_FILESYSPATH, &path))) { sys::SetWallpaper(path); CoTaskMemFree(path); }- it->Release();- }- }- d->Release();- Rebuild();-}--Page Fundo() {- Page p;- std::wstring cur = sys::Wallpaper();- // como no macOS 26: a imagem atual à esquerda; à direita, numa caixa, o nome e o ajuste (menu), e embaixo- // os botões- Row head; head.kind = Kind::Custom; head.height = 128;- auto layout = [](D2D1_RECT_F rr, D2D1_RECT_F& t, D2D1_RECT_F& box, D2D1_RECT_F& b1, D2D1_RECT_F& b2) {- t = D2D1::RectF(rr.left, rr.top + 6, rr.left + 190, rr.top + 6 + 112);- box = D2D1::RectF(t.right + 16, rr.top + 6, rr.right, rr.top + 6 + 50);- // botões embaixo da caixa, alinhados à direita dela (sem passar por cima da imagem em janela estreita)- float bw = std::min(146.f, (box.right - box.left - 10) / 2);- b2 = D2D1::RectF(box.right - bw, box.bottom + 12, box.right, box.bottom + 38);- b1 = D2D1::RectF(b2.left - 10 - bw, box.bottom + 12, b2.left - 10, box.bottom + 38);- };- head.draw = [cur, layout](Ctx& c, D2D1_RECT_F rr) {- D2D1_RECT_F t, box, b1, b2; layout(rr, t, box, b1, b2);- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.08f) : D2D1::ColorF(0, 0, 0, 0.06f));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 8, 8), c.br);- if (ID2D1Bitmap* b = BitmapFromFile(cur, 400)) {- auto s2 = b->GetSize();- float k = std::max((t.right - t.left) / s2.width, (t.bottom - t.top) / s2.height);- float w = s2.width * k, h = s2.height * k, cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;- ID2D1Factory* f = nullptr; c.dc->GetFactory(&f);- ID2D1RoundedRectangleGeometry* rg = nullptr; f->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 8, 8), &rg);- c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);- c.dc->DrawBitmap(b, D2D1::RectF(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);- c.dc->PopLayer();- rg->Release(); f->Release();- }- c.br->SetColor(c.group);- c.dc->FillRoundedRectangle(D2D1::RoundedRect(box, 12, 12), c.br);- std::wstring n = PathFindFileNameW(cur.c_str());- size_t dot = n.rfind(L'.'); if (dot != std::wstring::npos) n = n.substr(0, dot);- std::wstring fit = FIT_NAMES[std::clamp(sys::WallpaperFit(), 0, 5)];- float fw = 0;- IDWriteTextLayout* tl = nullptr;- if (SUCCEEDED(gfx::dw->CreateTextLayout(fit.c_str(), (UINT32)fit.size(), c.body, 400, 30, &tl))) { DWRITE_TEXT_METRICS m{}; tl->GetMetrics(&m); fw = m.width; tl->Release(); }- Text(c, n.empty() ? L"Imagem de fundo" : n, D2D1::RectF(box.left + 12, box.top, box.right - fw - 50, box.bottom), c.body, c.text);- Text(c, fit, D2D1::RectF(box.right - 38 - fw, box.top, box.right - 30, box.bottom), c.body, c.text);- PopupBadge(c, box.right - 18, (box.top + box.bottom) / 2);- ButtonFace(c, b1, L"Protetor de Tela…");- ButtonFace(c, b2, L"Adicionar Foto…");- };- head.clickAt = [layout](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- D2D1_RECT_F t, box, b1, b2; layout(rr, t, box, b1, b2);- auto in = [&](D2D1_RECT_F r) { return pt.x >= r.left && pt.x < r.right && pt.y >= r.top && pt.y < r.bottom; };- if (in(box)) {- int k = Menu(D2D1::RectF(box.right - 160, box.top, box.right, box.bottom), std::vector<std::wstring>(std::begin(FIT_NAMES), std::end(FIT_NAMES)), sys::WallpaperFit());- if (k >= 0) { sys::SetWallpaperFit(k); Rebuild(); }- } else if (in(b1)) Push(L"Protetor de Tela", Protetor);- else if (in(b2)) AddPhoto();- };- p.groups.push_back(Plain(head));- // seções como no Ajustes do macOS 26: Papéis de Parede Dinâmicos (um por versão do sistema, do mais novo- // ao mais antigo; "Mostrar Todas" abre todos), Suas Fotos (com "Adicionar Foto…" primeiro), os Aerials por- // categoria (Paisagem, Cidades, Debaixo d'Água, Terra) e Mac. Os do sistema ficam em- // Pictures\Wallpapers macOS\<versão> e os Aerials em Pictures\Wallpapers macOS\Aerials\<categoria>.- struct Item { std::wstring path, label; };- struct Sec { std::wstring title; std::vector<Item> items; };- static std::vector<Sec> secs;- static DWORD at = 0;- if (secs.empty() || GetTickCount() - at > 30000) {- secs.clear();- at = GetTickCount();- // na pasta Pictures do perfil (fora do OneDrive: são ~2 GB que não precisam ir para a nuvem); se não- // existir, na pasta Imagens do Windows- std::wstring macDir;- wchar_t prof[MAX_PATH];- if (GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) {- std::wstring d = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS";- if (GetFileAttributesW(d.c_str()) != INVALID_FILE_ATTRIBUTES) macDir = d;- }- PWSTR pics = nullptr;- if (macDir.empty() && SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Pictures, 0, nullptr, &pics))) { macDir = std::wstring(pics) + L"\\Wallpapers macOS"; CoTaskMemFree(pics); }- auto list = [](const std::wstring& dir) {- std::vector<std::wstring> files;- WIN32_FIND_DATAW fd;- HANDLE h = FindFirstFileW((dir + L"\\*").c_str(), &fd);- if (h != INVALID_HANDLE_VALUE) {- do {- if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;- std::wstring ext = PathFindExtensionW(fd.cFileName);- for (auto& ch : ext) ch = towlower(ch);- if (ext == L".jpg" || ext == L".jpeg" || ext == L".png") files.push_back(dir + L"\\" + fd.cFileName);- } while (FindNextFileW(h, &fd));- FindClose(h);- }- std::sort(files.begin(), files.end());- return files;- };- auto stem = [](const std::wstring& f) {- std::wstring n = PathFindFileNameW(f.c_str());- size_t dot = n.rfind(L'.');- return dot == std::wstring::npos ? n : n.substr(0, dot);- };- // dinâmicos: o primeiro de cada versão vem antes (a fileira fechada mostra Tahoe, Sequoia, Sonoma…)- static const wchar_t* VERS[] = { L"Tahoe", L"macOS 27", L"Sequoia", L"Sonoma", L"Ventura", L"Monterey", L"Big Sur", L"Catalina", L"Mojave",- L"High Sierra", L"Sierra", L"El Capitan", L"Yosemite", L"Mavericks", L"Mountain Lion", L"Lion",- L"Snow Leopard", L"Leopard", L"Tiger", L"Panther", L"Jaguar", L"Cheetah" };- Sec dyn{ L"Papéis de Parede Dinâmicos", {} };- std::vector<Item> rest;- for (auto* v : VERS) {- auto files = list(macDir + L"\\" + v);- for (size_t k = 0; k < files.size(); k++) (k == 0 ? dyn.items : rest).push_back({ files[k], v });- }- dyn.items.insert(dyn.items.end(), rest.begin(), rest.end());- if (!dyn.items.empty()) secs.push_back(dyn);- // suas fotos: as outras pastas de papel de parede (sem as do macOS); "Adicionar Foto…" é o primeiro quadro- Sec mine{ L"Suas Fotos", { { L"*adicionar*", L"Adicionar Foto…" } } };- for (auto& f : sys::WallpaperChoices())- if (macDir.empty() || _wcsnicmp(f.c_str(), macDir.c_str(), macDir.size())) mine.items.push_back({ f, stem(f) });- secs.push_back(mine);- for (auto* c : { L"Paisagem", L"Cidades", L"Debaixo d'Água", L"Terra" }) {- Sec a{ c, {} };- for (auto& f : list(macDir + L"\\Aerials\\" + c)) a.items.push_back({ f, stem(f) });- if (!a.items.empty()) secs.push_back(a);- }- Sec mac{ L"Mac", {} };- for (auto& f : list(macDir + L"\\Mac")) { // nome do arquivo do site sem resolução e número- std::wstring n = stem(f), nice;- std::vector<std::wstring> parts; std::wstring cur2;- for (wchar_t ch : n) { if (ch == L'-' || ch == L'_') { if (!cur2.empty()) parts.push_back(cur2); cur2.clear(); } else cur2 += ch; }- if (!cur2.empty()) parts.push_back(cur2);- while (!parts.empty() && iswdigit(parts.back()[0])) parts.pop_back();- for (size_t k = 0; k < parts.size() && k < 3; k++) {- std::wstring w2 = parts[k];- if (w2 == L"macos") w2 = L"macOS"; else if (w2 == L"imac") w2 = L"iMac"; else if (w2 == L"macbook") w2 = L"MacBook"; else if (!w2.empty()) w2[0] = towupper(w2[0]);- nice += (nice.empty() ? L"" : L" ") + w2;- }- mac.items.push_back({ f, nice });- }- if (!mac.items.empty()) secs.push_back(mac);- }- static std::set<std::wstring> openSecs; // seções abertas ("Mostrar Todas")- const float TW = 104, TH = 64, LABEL = 20, GAP = 12, HEAD = 30;- for (size_t si = 0; si < secs.size(); si++) {- std::wstring title = secs[si].title;- const std::vector<Item>* items = &secs[si].items;- int perRow = 4;- bool open = openSecs.count(title) > 0;- size_t count = open ? items->size() : std::min<size_t>(items->size(), perRow);- Row grid; grid.kind = Kind::Custom;- grid.height = HEAD + ((float)((count + perRow - 1) / perRow)) * (TH + LABEL + GAP) + 10;- grid.draw = [cur, TW, TH, LABEL, GAP, HEAD, count, title, items, open](Ctx& c, D2D1_RECT_F rr) {- Text(c, title, D2D1::RectF(rr.left + 2, rr.top, rr.right - 160, rr.top + 24), c.bold, c.text);- if (items->size() > 4) {- c.body->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_TRAILING);- Text(c, open ? std::wstring(L"Mostrar Menos") : Fmt(L"Mostrar Todas (%d)", (int)items->size()), D2D1::RectF(rr.right - 200, rr.top, rr.right, rr.top + 24), c.body, c.text2);- c.body->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);- }- rr.top += HEAD;- int perRow = std::max(1, (int)((rr.right - rr.left + GAP) / (TW + GAP)));- float tw = (rr.right - rr.left - (perRow - 1) * GAP) / perRow, th = tw * TH / TW;- for (size_t i = 0; i < count; i++) {- float x = rr.left + (i % perRow) * (tw + GAP), y = rr.top + (i / perRow) * (th + LABEL + GAP);- D2D1_RECT_F t = D2D1::RectF(x, y, x + tw, y + th);- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.06f) : D2D1::ColorF(0, 0, 0, 0.05f));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), c.br);- const Item& it = (*items)[i];- if (it.path == L"*adicionar*") { // quadro "Adicionar Foto…": foto com um + no meio- float cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;- c.br->SetColor(c.text2);- c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 13, cy - 10, cx + 11, cy + 8), 3, 3), c.br, 1.5f);- c.dc->FillEllipse(D2D1::Ellipse({ cx + 11, cy + 8 }, 7, 7), c.br);- c.br->SetColor(c.dark ? D2D1::ColorF(0.2f, 0.2f, 0.21f, 1) : D2D1::ColorF(1, 1, 1, 1));- c.dc->FillRectangle(D2D1::RectF(cx + 10.2f, cy + 4.5f, cx + 11.8f, cy + 11.5f), c.br);- c.dc->FillRectangle(D2D1::RectF(cx + 7.5f, cy + 7.2f, cx + 14.5f, cy + 8.8f), c.br);- Text(c, it.label, D2D1::RectF(t.left, t.bottom + 3, t.right, t.bottom + LABEL), c.noteCenter, c.text);- continue;- }- if (ID2D1Bitmap* b = BitmapFromFile(it.path, 256)) {- auto s2 = b->GetSize();- float k = std::max(tw / s2.width, th / s2.height);- float w = s2.width * k, h = s2.height * k, cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;- ID2D1Factory* fac = nullptr; c.dc->GetFactory(&fac);- ID2D1RoundedRectangleGeometry* rg = nullptr; fac->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 6, 6), &rg);- c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);- c.dc->DrawBitmap(b, D2D1::RectF(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);- c.dc->PopLayer();- rg->Release(); fac->Release();- }- if (_wcsicmp(it.path.c_str(), cur.c_str()) == 0) {- c.br->SetColor(c.accent);- c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 2.5f, t.top - 2.5f, t.right + 2.5f, t.bottom + 2.5f), 8, 8), c.br, 2.5f);- }- Text(c, it.label, D2D1::RectF(t.left, t.bottom + 3, t.right, t.bottom + LABEL), c.noteCenter, c.text);- }- };- grid.clickAt = [TW, TH, LABEL, GAP, HEAD, count, title, items](D2D1_POINT_2F pt, D2D1_RECT_F rr) {- if (pt.y < rr.top + HEAD) {- if (pt.x > rr.right - 200 && items->size() > 4) { if (openSecs.count(title)) openSecs.erase(title); else openSecs.insert(title); Rebuild(); }- return;- }- rr.top += HEAD;- int perRow = std::max(1, (int)((rr.right - rr.left + GAP) / (TW + GAP)));- float tw = (rr.right - rr.left - (perRow - 1) * GAP) / perRow, th = tw * TH / TW;- int col = (int)((pt.x - rr.left) / (tw + GAP)), row = (int)((pt.y - rr.top) / (th + LABEL + GAP));- size_t i = (size_t)row * perRow + col;- if (col < 0 || col >= perRow || i >= count) return;- if ((*items)[i].path == L"*adicionar*") { AddPhoto(); return; }- sys::SetWallpaper((*items)[i].path);- Rebuild();- };- Group g; g.box = false; g.rows.push_back(grid);- p.groups.push_back(g);- }- return p;-}--// ================= Notificações-Page Notificacoes() {- Page p;- const wchar_t* key = L"Software\\Microsoft\\Windows\\CurrentVersion\\PushNotifications";- p.groups.push_back(G({ Toggle(L"Permitir notificações",- [key] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, key, L"ToastEnabled", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v != 0; },- [key](bool on) { DWORD v = on; RegSetKeyValueW(HKEY_CURRENT_USER, key, L"ToastEnabled", REG_DWORD, &v, sizeof(v)); },- L"Desligado, os aplicativos não mostram avisos (pode ser preciso reiniciar a sessão).") }));- p.groups.push_back(G({ Uri(L"Notificações por Aplicativo", L"ms-settings:notifications", 0xEA8F, C_RED) }, L"Notificações dos Aplicativos"));- // banners e Central de Notificações do WacOS (notificacoes.cpp)- Row dur = Slider(L"Tempo do banner na tela", 2, 30, [] { return NumSetting(L"notif_duracao", 5); }, SetNum(L"notif_duracao"), L"2 s", L"30 s");- dur.hasDef = true; dur.def = 5;- p.groups.push_back(G({ Flag(L"Banners do Mac", L"banners_mac", L"1", L"Os avisos dos aplicativos aparecem no canto de cima, no visual do Mac."), dur,- Flag(L"Calendário na Central de Notificações", L"central_calendario", L"1"),- Flag(L"Relógio na Central de Notificações", L"central_relogio", L"1") }, L"Central de Notificações"));- return p;-}--// ================= Som-int g_soundTab = 0;-Page Som() {- Page p;- p.groups.push_back(G({ Link(L"Sons de alerta", [] { ShellExecuteW(nullptr, L"open", L"control.exe", L"mmsys.cpl,,2", nullptr, SW_SHOWNORMAL); }) }, L"Efeitos Sonoros"));- Row tabs; tabs.kind = Kind::Custom; tabs.height = 44;- tabs.draw = [](Ctx& c, D2D1_RECT_F rr) {- float w = 160, cx = (rr.left + rr.right) / 2;- D2D1_RECT_F seg = D2D1::RectF(cx - w / 2, rr.top + 10, cx + w / 2, rr.top + 34);- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.08f) : D2D1::ColorF(0, 0, 0, 0.06f));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(seg, 6, 6), c.br);- D2D1_RECT_F on = g_soundTab == 0 ? D2D1::RectF(seg.left + 2, seg.top + 2, cx - 1, seg.bottom - 2) : D2D1::RectF(cx + 1, seg.top + 2, seg.right - 2, seg.bottom - 2);- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.22f) : D2D1::ColorF(1, 1, 1, 1));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(on, 5, 5), c.br);- Text(c, L"Saída", D2D1::RectF(seg.left, seg.top, cx, seg.bottom), c.center, c.text);- Text(c, L"Entrada", D2D1::RectF(cx, seg.top, seg.right, seg.bottom), c.center, c.text);- };- tabs.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) { g_soundTab = pt.x < (rr.left + rr.right) / 2 ? 0 : 1; Rebuild(); };- Group io = G({ tabs }, L"Saída e Entrada");- bool out = g_soundTab == 0;- for (auto& d : sys::AudioDevices(out)) {- Row r; r.kind = Kind::Custom; r.height = 34;- std::wstring id = d.id, name = d.name; bool def = d.isDefault;- r.draw = [name, def](Ctx& c, D2D1_RECT_F rr) {- D2D1_RECT_F b = D2D1::RectF(rr.left + 6, rr.top + 2, rr.right - 6, rr.bottom - 2);- if (def) { c.br->SetColor(c.accent); c.dc->FillRoundedRectangle(D2D1::RoundedRect(b, 5, 5), c.br); }- Text(c, name, D2D1::RectF(b.left + 10, b.top, b.right - 10, b.bottom), c.body, def ? D2D1::ColorF(1, 1, 1, 1) : c.text);- };- r.clickAt = [id](D2D1_POINT_2F, D2D1_RECT_F) { sys::SetDefaultAudio(id); Rebuild(); };- io.rows.push_back(r);- }- if (out) {- Row vol = Slider(L"Volume de saída", 0, 1, [] { return sys::Volume(); }, [](float v) { sys::SetVolume(v); }, std::wstring(1, (wchar_t)0xE993), std::wstring(1, (wchar_t)0xE995));- Row mute = Toggle(L"Mudo", [] { return sys::Muted(); }, [](bool m) { sys::SetMuted(m); });- io.rows.push_back(vol);- io.rows.push_back(mute);- } else if (sys::InputVolume() >= 0) {- io.rows.push_back(Slider(L"Volume de entrada", 0, 1, [] { return std::max(0.f, sys::InputVolume()); }, [](float v) { sys::SetInputVolume(v); },- std::wstring(1, (wchar_t)0xE720), std::wstring(1, (wchar_t)0xE720)));- }- p.groups.push_back(io);- p.groups.push_back(Plain(Buttons({ { L"Mais Ajustes de Som…", [] { OpenUri(L"ms-settings:sound"); } } })));- return p;-}--// ================= Foco, Tempo de Uso-Page Foco() {- Page p;- p.groups.push_back(Plain(Hero(0xE708, C_INDIGO, L"Foco", L"O Foco silencia notificações enquanto você trabalha. No Windows ele se chama Não Incomodar e Sessões de Foco.")));- p.groups.push_back(G({ Uri(L"Não Incomodar", L"ms-settings:notifications", 0xE708, C_INDIGO), Uri(L"Sessões de Foco", L"ms-clock:", 0xE916, C_INDIGO) }));- return p;-}-Page TempoUso() {- Page p;- p.groups.push_back(Plain(Hero(0xE916, C_INDIGO, L"Tempo de Uso", L"O tempo de uso e os limites ficam no Microsoft Family Safety.")));- p.groups.push_back(G({ Uri(L"Família e Limites", L"ms-settings:family-group", 0xE716, C_INDIGO), Uri(L"Histórico de Atividades", L"ms-settings:privacy-activityhistory", 0xE81C, C_GRAY) }));- return p;-}--// ================= Tela Bloqueada-// ---- Fundo da tela de bloqueio: imagem ou vídeo escolhido aqui.-// Guardado em %APPDATA%\Shell\bloqueio\fundo.jpg (+ fundo.mp4 no vídeo; o .jpg é o 1º quadro, usado no vidro do-// relógio e enquanto o vídeo carrega). Ajustes bloqueio_fundo / bloqueio_video. Quando a tela de logon do Windows-// é a do projeto (AuthUX, pasta C:\Windows\Web\Screen\macOS), os dois vão também para lá como-// personalizado.jpg / personalizado.mp4: a pasta é só de administradores, então o Windows pede a confirmação.-namespace lockbg {-const wchar_t* AUTHUX = L"C:\\Windows\\Web\\Screen\\macOS";-std::wstring Dir() {- PWSTR p = nullptr; std::wstring d;- if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) { d = std::wstring(p) + L"\\Shell\\bloqueio"; CoTaskMemFree(p); }- SHCreateDirectoryExW(nullptr, d.c_str(), nullptr);- return d;-}-bool Exists(const std::wstring& f) { return !f.empty() && GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES; }--// grava um HBITMAP ou um arquivo de imagem como JPEG (WIC)-bool SaveJpeg(IWICImagingFactory* wic, IWICBitmapSource* src, const std::wstring& out) {- IWICStream* st = nullptr; IWICBitmapEncoder* enc = nullptr; IWICBitmapFrameEncode* fr = nullptr; IPropertyBag2* bag = nullptr;- IWICFormatConverter* cv = nullptr;- bool ok = false;- if (SUCCEEDED(wic->CreateStream(&st)) && SUCCEEDED(st->InitializeFromFilename(out.c_str(), GENERIC_WRITE)) &&- SUCCEEDED(wic->CreateEncoder(GUID_ContainerFormatJpeg, nullptr, &enc)) && SUCCEEDED(enc->Initialize(st, WICBitmapEncoderNoCache)) &&- SUCCEEDED(enc->CreateNewFrame(&fr, &bag))) {- PROPBAG2 opt{}; wchar_t nome[] = L"ImageQuality"; opt.pstrName = nome;- VARIANT v; VariantInit(&v); v.vt = VT_R4; v.fltVal = 0.92f;- bag->Write(1, &opt, &v);- if (SUCCEEDED(fr->Initialize(bag)) && SUCCEEDED(wic->CreateFormatConverter(&cv)) &&- SUCCEEDED(cv->Initialize(src, GUID_WICPixelFormat24bppBGR, WICBitmapDitherTypeNone, nullptr, 0, WICBitmapPaletteTypeCustom))) {- UINT w = 0, h = 0; cv->GetSize(&w, &h);- WICPixelFormatGUID pf = GUID_WICPixelFormat24bppBGR;- ok = SUCCEEDED(fr->SetSize(w, h)) && SUCCEEDED(fr->SetPixelFormat(&pf)) && SUCCEEDED(fr->WriteSource(cv, nullptr)) &&- SUCCEEDED(fr->Commit()) && SUCCEEDED(enc->Commit());- }- }- for (IUnknown* u : { (IUnknown*)cv, (IUnknown*)bag, (IUnknown*)fr, (IUnknown*)enc, (IUnknown*)st }) if (u) u->Release();- if (!ok) DeleteFileW(out.c_str());- return ok;-}-bool ImageToJpeg(const std::wstring& in, const std::wstring& out) {- IWICImagingFactory* wic = nullptr; IWICBitmapDecoder* dec = nullptr; IWICBitmapFrameDecode* fr = nullptr;- bool ok = SUCCEEDED(CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&wic))) &&- SUCCEEDED(wic->CreateDecoderFromFilename(in.c_str(), nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &dec)) &&- SUCCEEDED(dec->GetFrame(0, &fr)) && SaveJpeg(wic, fr, out);- for (IUnknown* u : { (IUnknown*)fr, (IUnknown*)dec, (IUnknown*)wic }) if (u) u->Release();- return ok;-}-// Um quadro do vídeo (a 1 s do começo), decodificado do MESMO jeito que a tela de logon toca o vídeo-// (Media Foundation, SourceReader convertendo para RGB32). Se aqui não decodifica (HEVC sem a extensão, AV1, arquivo-// quebrado...), lá a tela ficaria preta: o vídeo é recusado. A miniatura do Windows não serve para isso (ela existe-// mesmo quando o vídeo não toca, e o primeiro quadro costuma ser preto).-bool VideoFrameToJpeg(const std::wstring& in, const std::wstring& out) {- if (FAILED(MFStartup(MF_VERSION, MFSTARTUP_LITE))) return false;- IMFAttributes* at = nullptr; IMFSourceReader* rd = nullptr; IMFMediaType* mt = nullptr; IMFMediaType* cur = nullptr;- IMFSample* smp = nullptr; IMFMediaBuffer* buf = nullptr; IMF2DBuffer* b2 = nullptr;- IWICImagingFactory* wic = nullptr; IWICBitmap* bmp = nullptr;- bool ok = false;- const DWORD V = (DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM;- do {- if (FAILED(MFCreateAttributes(&at, 1)) || FAILED(at->SetUINT32(MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING, TRUE))) break;- if (FAILED(MFCreateSourceReaderFromURL(in.c_str(), at, &rd))) break;- if (FAILED(MFCreateMediaType(&mt)) || FAILED(mt->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video)) || FAILED(mt->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32))) break;- if (FAILED(rd->SetCurrentMediaType(V, nullptr, mt))) break; // sem decodificador para este vídeo- UINT32 w = 0, h = 0;- if (FAILED(rd->GetCurrentMediaType(V, &cur)) || FAILED(MFGetAttributeSize(cur, MF_MT_FRAME_SIZE, &w, &h)) || !w || !h) break;- PROPVARIANT pos; PropVariantInit(&pos); pos.vt = VT_I8; pos.hVal.QuadPart = 10000000; // 1 s- rd->SetCurrentPosition(GUID_NULL, pos);- for (int n = 0; n < 60 && !smp; n++) {- DWORD flags = 0; LONGLONG ts = 0;- if (FAILED(rd->ReadSample(V, 0, nullptr, &flags, &ts, &smp))) break;- if (flags & MF_SOURCE_READERF_ENDOFSTREAM) { // vídeo com menos de 1 s: do começo- if (smp) break;- pos.hVal.QuadPart = 0; rd->SetCurrentPosition(GUID_NULL, pos);- }- }- if (!smp || FAILED(smp->ConvertToContiguousBuffer(&buf))) break;- std::vector<BYTE> px((size_t)w * h * 4);- BYTE* scan = nullptr; LONG pitch = 0;- if (SUCCEEDED(buf->QueryInterface(IID_PPV_ARGS(&b2))) && SUCCEEDED(b2->Lock2D(&scan, &pitch))) {- for (UINT32 y = 0; y < h; y++) memcpy(&px[(size_t)y * w * 4], scan + (LONG_PTR)y * pitch, (size_t)w * 4);- b2->Unlock2D();- } else {- BYTE* d = nullptr; DWORD len = 0;- if (FAILED(buf->Lock(&d, nullptr, &len)) || len < px.size()) break;- memcpy(px.data(), d, px.size());- buf->Unlock();- }- bool algo = false; // quadro todo preto = não decodificou de verdade- for (size_t k = 0; k < px.size() && !algo; k += 4 * 97) algo = px[k] > 12 || px[k + 1] > 12 || px[k + 2] > 12;- if (!algo) break;- if (FAILED(CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&wic)))) break;- if (FAILED(wic->CreateBitmapFromMemory(w, h, GUID_WICPixelFormat32bppBGR, w * 4, (UINT)px.size(), px.data(), &bmp))) break;- ok = SaveJpeg(wic, bmp, out);- } while (false);- for (IUnknown* u : { (IUnknown*)bmp, (IUnknown*)wic, (IUnknown*)b2, (IUnknown*)buf, (IUnknown*)smp, (IUnknown*)cur, (IUnknown*)mt, (IUnknown*)rd, (IUnknown*)at }) if (u) u->Release();- MFShutdown();- return ok;-}-// leva (ou tira) o fundo personalizado da pasta da tela de logon do projeto; pede administrador (UAC)-void Publish(const std::wstring& jpg, const std::wstring& mp4) {- if (!Exists(AUTHUX)) return;- std::wstring d = AUTHUX, cmd = L"/c ";- if (jpg.empty()) cmd += L"del /q \"" + d + L"\\personalizado.jpg\" \"" + d + L"\\personalizado.mp4\"";- else {- cmd += L"copy /y \"" + jpg + L"\" \"" + d + L"\\personalizado.jpg\"";- if (mp4.empty()) cmd += L" & del /q \"" + d + L"\\personalizado.mp4\"";- else cmd += L" & copy /y \"" + mp4 + L"\" \"" + d + L"\\personalizado.mp4\"";- }- ShellExecuteW(Window(), L"runas", L"cmd.exe", cmd.c_str(), nullptr, SW_HIDE);-}-void Default() {- SetSetting(L"bloqueio_fundo", L"");- SetSetting(L"bloqueio_video", L"");- Publish(L"", L"");- Rebuild();-}-void Pick(bool video) {- IFileOpenDialog* d = nullptr;- if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&d)))) return;- COMDLG_FILTERSPEC img[] = { { L"Imagens", L"*.jpg;*.jpeg;*.png;*.bmp;*.heic;*.webp" } };- COMDLG_FILTERSPEC vid[] = { { L"Vídeos", L"*.mp4;*.mov;*.m4v" } };- d->SetFileTypes(1, video ? vid : img);- std::wstring in;- if (SUCCEEDED(d->Show(Window()))) {- IShellItem* it = nullptr;- if (SUCCEEDED(d->GetResult(&it))) {- PWSTR path = nullptr;- if (SUCCEEDED(it->GetDisplayName(SIGDN_FILESYSPATH, &path))) { in = path; CoTaskMemFree(path); }- it->Release();- }- }- d->Release();- if (in.empty()) return;- // nome novo a cada escolha (a miniatura da página é guardada pelo caminho); as antigas saem- std::wstring dir = Dir(), jpg = dir + L"\\fundo-" + std::to_wstring(GetTickCount64()) + L".jpg", mp4 = dir + L"\\fundo.mp4";-- bool ok;- // o vídeo só é aceito se decodifica aqui (senão a tela de bloqueio ficaria preta); nada é trocado em caso de erro- if (video) ok = VideoFrameToJpeg(in, jpg) && CopyFileW(in.c_str(), mp4.c_str(), FALSE);- else { ok = ImageToJpeg(in, jpg); if (ok) DeleteFileW(mp4.c_str()); }- if (!ok) {- DeleteFileW(jpg.c_str());- MessageBoxW(Window(), video ? Tr(L"Este vídeo não pode ser usado: o Windows não consegue reproduzir o formato dele. Use um vídeo MP4 em H.264.") : Tr(L"Não foi possível usar esta imagem."), Tr(L"Tela Bloqueada"), MB_ICONWARNING);- return;- }- { // as imagens antigas saem (menos a nova)- WIN32_FIND_DATAW fd; HANDLE h = FindFirstFileW((dir + L"\\fundo-*.jpg").c_str(), &fd);- if (h != INVALID_HANDLE_VALUE) { do { std::wstring f = dir + L"\\" + fd.cFileName; if (_wcsicmp(f.c_str(), jpg.c_str())) DeleteFileW(f.c_str()); } while (FindNextFileW(h, &fd)); FindClose(h); }- }- SetSetting(L"bloqueio_fundo", jpg);- SetSetting(L"bloqueio_video", video ? mp4 : L"");- SetSetting(L"bloqueio_fundo_nome", PathFindFileNameW(in.c_str()));- Publish(jpg, video ? mp4 : L"");- Rebuild();-}-} // namespace lockbg--Page TelaBloqueada() {- Page p;- { // a imagem atual à esquerda; à direita o nome e o tipo; embaixo os botões- std::wstring jpg = Setting(L"bloqueio_fundo", L""), mp4 = Setting(L"bloqueio_video", L"");- bool custom = lockbg::Exists(jpg);- bool video = custom && lockbg::Exists(mp4);- std::wstring shown = custom ? jpg : sys::Wallpaper();- std::wstring name = custom ? Setting(L"bloqueio_fundo_nome", L"") : Tr(L"Padrão (a imagem de fundo da mesa)");- std::wstring kind = !custom ? L"" : video ? Tr(L"Vídeo") : Tr(L"Imagem");- Row head; head.kind = Kind::Custom; head.height = 124;- head.draw = [shown, name, kind](Ctx& c, D2D1_RECT_F rr) {- D2D1_RECT_F t = D2D1::RectF(rr.left, rr.top + 6, rr.left + 190, rr.top + 6 + 112);- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.08f) : D2D1::ColorF(0, 0, 0, 0.06f));- c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 8, 8), c.br);- if (ID2D1Bitmap* b = BitmapFromFile(shown, 400)) {- auto s2 = b->GetSize();- float k = std::max((t.right - t.left) / s2.width, (t.bottom - t.top) / s2.height);- float w = s2.width * k, h = s2.height * k, cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;- ID2D1Factory* f = nullptr; c.dc->GetFactory(&f);- ID2D1RoundedRectangleGeometry* rg = nullptr; f->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 8, 8), &rg);- if (rg) {- c.dc->PushLayer(D2D1::LayerParameters1(D2D1::InfiniteRect(), rg), nullptr);- c.dc->DrawBitmap(b, D2D1::RectF(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);- c.dc->PopLayer();- rg->Release();- }- if (f) f->Release();- }- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.92f) : D2D1::ColorF(0, 0, 0, 0.86f));- c.dc->DrawTextW(name.c_str(), (UINT32)name.size(), c.body, D2D1::RectF(t.right + 16, rr.top + 40, rr.right, rr.top + 60), c.br);- if (!kind.empty()) {- c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.55f) : D2D1::ColorF(0, 0, 0, 0.5f));- c.dc->DrawTextW(kind.c_str(), (UINT32)kind.size(), c.note, D2D1::RectF(t.right + 16, rr.top + 62, rr.right, rr.top + 80), c.br);- }- };- p.groups.push_back(G({ head }, L"Imagem de Fundo da Tela Bloqueada"));- std::vector<std::pair<std::wstring, std::function<void()>>> bs = {- { L"Escolher Imagem…", [] { lockbg::Pick(false); } }, { L"Escolher Vídeo…", [] { lockbg::Pick(true); } } };- if (custom) bs.insert(bs.begin(), { L"Usar o Padrão", [] { lockbg::Default(); } });- p.groups.push_back(Plain(Buttons(bs)));- }- p.groups.push_back(G({- Popup(L"Desligar a tela quando inativo", MinuteLabels(L"Após "), [] { return MinuteIndex(sys::DisplayOffMinutes()); }, [](int i) { sys::SetDisplayOffMinutes(MINUTES[i]); }),- Toggle(L"Exigir senha ao sair do protetor de tela",- [] { wchar_t v[8] = L"0"; DWORD cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"ScreenSaverIsSecure", RRF_RT_REG_SZ, nullptr, v, &cb); return v[0] == L'1'; },- [](bool on) { const wchar_t* v = on ? L"1" : L"0"; RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"ScreenSaverIsSecure", REG_SZ, v, 4); }),- }));- return p;-}--// ================= Privacidade e Segurança-Page Privacidade() {- Page p;- p.groups.push_back(G({ Uri(L"Serviços de Localização", L"ms-settings:privacy-location", 0xE707, C_BLUE),- Uri(L"Câmera", L"ms-settings:privacy-webcam", 0xE722, C_GRAY),- Uri(L"Microfone", L"ms-settings:privacy-microphone", 0xE720, C_ORANGE),- Uri(L"Contatos", L"ms-settings:privacy-contacts", 0xE77B, C_GRAY),- Uri(L"Calendários", L"ms-settings:privacy-calendar", 0xE787, C_RED),- Uri(L"Fotos", L"ms-settings:privacy-pictures", 0xE8B9, C_PINK),- Uri(L"Arquivos e Pastas", L"ms-settings:privacy-documents", 0xE8B7, C_BLUE),- Uri(L"Acesso Total ao Disco", L"ms-settings:privacy-broadfilesystemaccess", 0xEDA2, C_GRAY) }, L"Privacidade"));- p.groups.push_back(G({ Uri(L"Análise e Melhorias", L"ms-settings:privacy-feedback", 0xE9D9, C_BLUE),- Uri(L"Publicidade", L"ms-settings:privacy-general", 0xE789, C_BLUE) }));- p.groups.push_back(G({ Uri(L"Segurança do Windows", L"windowsdefender:", 0xE83D, C_BLUE),- Uri(L"Encontrar Meu Dispositivo", L"ms-settings:findmydevice", 0xE707, C_GREEN) }, L"Segurança"));- return p;-}--// ================= Touch ID e Senha → Windows Hello-Page Senha() {- Page p;- p.groups.push_back(Plain(Hero(0xE928, C_PINK, L"Windows Hello e Senha", L"Digital, rosto, PIN e a senha de início de sessão.")));- p.groups.push_back(G({ Uri(L"Opções de Início de Sessão", L"ms-settings:signinoptions", 0xE928, C_PINK),- Uri(L"Configurar Digital", L"ms-settings:signinoptions-launchfingerprintenrollment", 0xE928, C_PINK),- Uri(L"Configurar Rosto", L"ms-settings:signinoptions-launchfaceenrollment", 0xE77B, C_GRAY) }));- return p;-}--// ================= Usuários e Grupos-Page Usuarios() {- Page p;- const sys::Info& inf = sys::About();- Group g = G({});- for (auto& u : sys::LocalUsers()) {- Row r = Value(u, _wcsicmp(u.c_str(), inf.user.c_str()) == 0 ? L"Você" : L"");- r.icon = 0xE77B; r.iconColor = C_GRAY;- g.rows.push_back(r);- }- if (g.rows.empty()) g.rows.push_back(Value(inf.fullName, L"Você"));- p.groups.push_back(g);- p.groups.push_back(Plain(Buttons({ { L"Adicionar Usuário…", [] { OpenUri(L"ms-settings:otherusers"); } } })));- return p;-}--Page ContasInternet() {- Page p;- p.groups.push_back(G({ Uri(L"E-mail e Contas", L"ms-settings:emailandaccounts", L'@', C_BLUE), Uri(L"Contas de Trabalho ou Escola", L"ms-settings:workplace", 0xE821, C_GRAY) }));- return p;-}-Page Jogos() {- Page p;- p.groups.push_back(G({ Uri(L"Barra de Jogo", L"ms-settings:gaming-gamebar", 0xE7FC, C_GREEN), Uri(L"Capturas", L"ms-settings:gaming-gamedvr", 0xE714, C_GRAY),- Uri(L"Modo de Jogo", L"ms-settings:gaming-gamemode", 0xE945, C_GREEN) }));- return p;-}-Page Nuvem() {- Page p;- p.groups.push_back(Plain(Hero(0xE753, C_CYAN, L"OneDrive", L"No Windows, a nuvem dos seus arquivos e fotos é o OneDrive.")));- p.groups.push_back(G({ Uri(L"Backup do Windows", L"ms-settings:backup", 0xE753, C_CYAN) }));- return p;-}--// ================= Teclado, Mouse, Trackpad, Impressoras-// Captura de Tela: onde as capturas vão (issue #8, 21/11/2026: "não encontrei a opção na configuração"). O app de-// captura guarda as opções em %APPDATA%\Shell\captura.txt (destino=0 Mesa, 1 Documentos, 2 Área de Transferência,-// 3 Imagens › Capturas de Tela (o padrão), 4 Outro Local com outro=<pasta>); aqui lê e grava só essas duas linhas.-static std::wstring CapturaTxt() {- PWSTR p = nullptr; std::wstring d;- if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) { d = std::wstring(p) + L"\\Shell\\captura.txt"; CoTaskMemFree(p); }- return d;-}-static std::vector<std::wstring> CapturaLinhas() {- std::vector<std::wstring> v;- FILE* f = nullptr;- if (_wfopen_s(&f, CapturaTxt().c_str(), L"r, ccs=UTF-8") || !f) return v;- wchar_t line[1024];- while (fgetws(line, 1024, f)) {- std::wstring l = line;- while (!l.empty() && (l.back() == L'\n' || l.back() == L'\r')) l.pop_back();- if (!l.empty() && l[0] == 0xFEFF) l.erase(0, 1);- if (!l.empty()) v.push_back(l);- }- fclose(f);- return v;-}-static std::wstring CapturaValor(const wchar_t* key, const wchar_t* def) {- std::wstring k = std::wstring(key) + L"=";- for (auto& l : CapturaLinhas()) if (l.rfind(k, 0) == 0) return l.substr(k.size());- return def;-}-static void CapturaGravar(int dest, const std::wstring* outro) {- auto v = CapturaLinhas();- v.erase(std::remove_if(v.begin(), v.end(), [&](const std::wstring& l) { return l.rfind(L"destino=", 0) == 0 || (outro && l.rfind(L"outro=", 0) == 0); }), v.end());- v.push_back(L"destino=" + std::to_wstring(dest));- if (outro) v.push_back(L"outro=" + *outro);- std::wstring path = CapturaTxt();- SHCreateDirectoryExW(nullptr, path.substr(0, path.find_last_of(L'\\')).c_str(), nullptr);- FILE* f = nullptr;- if (_wfopen_s(&f, path.c_str(), L"w, ccs=UTF-8") || !f) return;- for (auto& l : v) fwprintf(f, L"%ls\n", l.c_str());- fclose(f);-}-static bool EscolherPastaCaptura(std::wstring& out) {- IFileOpenDialog* d = nullptr;- if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&d)))) return false;- DWORD o = 0; d->GetOptions(&o); d->SetOptions(o | FOS_PICKFOLDERS | FOS_FORCEFILESYSTEM);- d->SetTitle(Tr(L"Salvar Capturas de Tela em"));- bool ok = false;- if (SUCCEEDED(d->Show(Window()))) {- IShellItem* it = nullptr;- if (SUCCEEDED(d->GetResult(&it))) {- PWSTR p = nullptr;- if (SUCCEEDED(it->GetDisplayName(SIGDN_FILESYSPATH, &p))) { out = p; CoTaskMemFree(p); ok = true; }- it->Release();- }- }- d->Release();- return ok;-}--Page Teclado() {- Page p;- {- // ordem do menu: Mesa, Documentos, Imagens › Capturas de Tela, Área de Transferência, Outro Local- static const int kDest[5] = { 0, 1, 3, 2, 4 };- std::wstring outro = CapturaValor(L"outro", L"");- std::wstring outroNome = outro.empty() ? std::wstring(Tr(L"Outro Local…")) : std::wstring(PathFindFileNameW(outro.c_str()));- p.groups.push_back(G({ Popup(L"Salvar em", { L"Mesa", L"Documentos", L"Imagens › Capturas de Tela", L"Área de Transferência", outroNome },- [] {- int d = _wtoi(CapturaValor(L"destino", L"3").c_str());- for (int i = 0; i < 5; i++) if (kDest[i] == d) return i;- return 2;- },- [](int i) {- int d = kDest[std::clamp(i, 0, 4)];- if (d == 4) {- std::wstring pasta;- if (!EscolherPastaCaptura(pasta)) { Rebuild(); return; }- CapturaGravar(4, &pasta);- } else CapturaGravar(d, nullptr);- Rebuild();- }),- Note(L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.") },- L"Capturas de Tela"));- }- p.groups.push_back(G({- Slider(L"Repetição de tecla", 0, 31, [] { return (float)sys::KeyRepeat(); }, [](float v) { sys::SetKeyRepeat((int)std::lround(v)); }, L"Lenta", L"Rápida"),- Slider(L"Atraso até repetir", 0, 3, [] { return (float)(3 - sys::KeyDelay()); }, [](float v) { sys::SetKeyDelay(3 - (int)std::lround(v)); }, L"Longo", L"Curto"),- }));- p.groups.push_back(G({ Uri(L"Fontes de Entrada", L"ms-settings:keyboard", 0xE765, C_GRAY), Uri(L"Ditado", L"ms-settings:speech", 0xE720, C_GRAY),- Uri(L"Digitação", L"ms-settings:typing", 0xE765, C_GRAY) }, L"Entrada de Texto"));- p.groups.push_back(G({ Toggle(L"Atalhos do Mac para apps", [] { return Setting(L"atalhos_mac", L"1") == L"1"; },- [](bool on) { SetSetting(L"atalhos_mac", on ? L"1" : L"0"); }),- Note(L"Win+Q encerra o app, Win+H oculta o app e Win+W fecha a janela, como Command no Mac. Desligado, esses atalhos voltam ao Windows.") },- L"Atalhos"));- return p;-}-Page Mouse() {- Page p;- p.groups.push_back(G({- Slider(L"Velocidade de rastreamento", 1, 20, [] { return (float)sys::MouseSpeed(); }, [](float v) { sys::SetMouseSpeed((int)std::lround(v)); }, L"Lenta", L"Rápida"),- Slider(L"Velocidade do clique duplo", 200, 900, [] { return (float)(1100 - sys::DoubleClickMs()); }, [](float v) { sys::SetDoubleClickMs(1100 - (int)std::lround(v)); }, L"Lenta", L"Rápida"),- Slider(L"Velocidade de rolagem", 1, 20, [] { return (float)sys::WheelLines(); }, [](float v) { sys::SetWheelLines((int)std::lround(v)); }, L"Lenta", L"Rápida"),- Popup(L"Clique secundário", { L"Clicar no Lado Direito", L"Clicar no Lado Esquerdo" }, [] { return sys::ButtonsSwapped() ? 1 : 0; }, [](int i) { sys::SetButtonsSwapped(i == 1); }),- }));- p.groups.push_back(Plain(Buttons({ { L"Avançado…", [] { OpenUri(L"ms-settings:mousetouchpad"); } } })));- return p;-}-Page Trackpad() {- Page p;- p.groups.push_back(G({ Uri(L"Toque e Gestos", L"ms-settings:devices-touchpad", 0xEFA5, C_GRAY) }));- return p;-}-Page Impressoras() {- Page p;- auto list = sys::Printers();- if (!list.empty()) {- std::vector<std::wstring> opts = list;- p.groups.push_back(G({ Popup(L"Impressora padrão", opts, [list] { auto d = sys::DefaultPrinter(); for (int i = 0; i < (int)list.size(); i++) if (list[i] == d) return i; return -1; },- [list](int i) { sys::SetPrinterDefault(list[i]); }) }));- Group g = G({}, L"Impressoras");- for (auto& n : list) { Row r = Value(n, L""); r.icon = 0xE749; r.iconColor = C_GRAY; g.rows.push_back(r); }- p.groups.push_back(g);- } else p.groups.push_back(G({ Note(L"Nenhuma impressora.") }));- p.groups.push_back(Plain(Buttons({ { L"Adicionar Impressora, Scanner ou Fax…", [] { OpenUri(L"ms-settings:printers"); } } })));- return p;-}--} // namespace--std::vector<SideItem>& SidebarItems() {- static std::vector<SideItem> items;- if (!items.empty()) return items;- bool battery = sys::HasBattery(nullptr, nullptr);- items = {- { L"Wi‑Fi", 0xE701, C_BLUE, WiFi, 0, L"wifi rede sem fio internet", L"wifi" },- { L"Bluetooth", 0xE702, C_BLUE, Bluetooth, 0, L"fone mouse teclado dispositivos", L"bluetooth" },- { L"Rede", 0xE774, C_BLUE, Rede, 0, L"ethernet internet ip firewall vpn proxy", L"rede" },- { battery ? L"Bateria" : L"Energia", (wchar_t)(battery ? 0xE83F : 0xE945), C_GREEN, Energia, 0, L"energia bateria repouso suspender modo desempenho", L"energia" },- { L"Geral", 0xE713, C_GRAY, Geral, 1, L"sobre atualização armazenamento data hora idioma início", L"geral" },- { L"Acessibilidade", 0xE776, C_BLUE, Acessibilidade, 1, L"narrador lupa legendas", L"acessibilidade" },- { L"Aparência", 1, 0x1C1C1E, Aparencia, 1, L"tema escuro claro destaque cor", L"aparencia" },- { L"Apple Intelligence e Siri", 0xE720, C_PURPLE, Inteligencia, 1, L"copilot fala voz assistente", L"inteligencia" },- { L"Central de Controle", 0xE9E9, C_GRAY, CentralControle, 1, L"barra de menus relógio ícones microfone câmera", L"central" },- { L"Ilha Dinâmica", 0xE7F4, 0x1C1C1E, IlhaDinamica, 1, L"notch ilha dinâmica música timer copiado estante", L"ilha" },- { L"Mesa e Dock", 0xE7F4, 0x1C1C1E, MesaDock, 1, L"dock tamanho ampliação ocultar janelas", L"dock" },- { L"Telas", 0xE706, C_BLUE, Telas, 1, L"monitor brilho resolução escala night shift", L"telas" },- { L"Protetor de Tela", 0xE8B9, C_CYAN, Protetor, 1, L"proteção de tela", L"protetor" },- { L"Spotlight", 0xE721, C_GRAY, Spotlight, 1, L"pesquisa busca índice", L"spotlight" },- { L"Imagem de Fundo", 0xE771, C_TEAL, Fundo, 1, L"papel de parede wallpaper", L"fundo" },- { L"Notificações", 0xEA8F, C_RED, Notificacoes, 2, L"avisos alertas", L"notificacoes" },- { L"Som", 0xE767, C_PINK, Som, 2, L"volume saída entrada alto-falante microfone", L"som" },- { L"Foco", 0xE708, C_INDIGO, Foco, 2, L"não incomodar", L"foco" },- { L"Tempo de Uso", 0xE916, C_INDIGO, TempoUso, 2, L"família limites", L"tempo" },- { L"Tela Bloqueada", 0xE72E, 0x1C1C1E, TelaBloqueada, 3, L"bloqueio senha protetor", L"bloqueio" },- { L"Privacidade e Segurança", 0xE8D7, C_BLUE, Privacidade, 3, L"localização câmera microfone permissões segurança", L"privacidade" },- { L"Touch ID e Senha", 0xE928, C_PINK, Senha, 3, L"windows hello digital pin senha", L"senha" },- { L"Usuários e Grupos", 0xE716, C_BLUE, Usuarios, 3, L"contas usuários", L"usuarios" },- { L"Contas de Internet", L'@', C_BLUE, ContasInternet, 4, L"email e-mail contas", L"contas" },- { L"Game Center", 0xE7FC, C_GREEN, Jogos, 4, L"jogos xbox", L"jogos" },- { L"iCloud", 0xE753, C_CYAN, Nuvem, 4, L"onedrive nuvem backup", L"nuvem" },- { L"Teclado", 0xE765, C_GRAY, Teclado, 5, L"repetição teclas digitação", L"teclado" },- { L"Mouse", 0xE962, C_GRAY, Mouse, 5, L"rastreamento clique rolagem", L"mouse" },- { L"Trackpad", 0xEFA5, C_GRAY, Trackpad, 5, L"touchpad gestos", L"trackpad" },- { L"Impressoras e Scanners", 0xE749, C_GRAY, Impressoras, 5, L"imprimir scanner", L"impressoras" },- { L"Conta", 0xE77B, C_GRAY, Conta, 9, L"conta usuário perfil", L"conta" },- };- return items;-}--// SF Symbol usado no Ajustes do Sequoia para cada item (nome do .svg em icones\simbolos)-std::wstring SymbolFor(const std::wstring& label) {- static const std::map<std::wstring, std::wstring> m = {- { L"Wi‑Fi", L"wifi" }, { L"Rede", L"globe" }, { L"Energia", L"bolt.fill" }, { L"Bateria", L"battery.100percent" },- { L"Geral", L"gearshape.fill" }, { L"Acessibilidade", L"accessibility" }, { L"Aparência", L"circle.lefthalf.filled" },- { L"Apple Intelligence e Siri", L"apple.intelligence" }, { L"Assistente e Fala", L"apple.intelligence" }, { L"Central de Controle", L"switch.2" },- { L"Ilha Dinâmica", L"menubar.dock.rectangle" }, { L"Mostrar o uso do microfone e da câmera", L"microphone.fill" },- { L"Mesa e Dock", L"dock.rectangle" }, { L"Telas", L"sun.max.fill" }, { L"Protetor de Tela", L"photo.on.rectangle.angled" },- { L"Spotlight", L"magnifyingglass" }, { L"Imagem de Fundo", L"camera.macro" }, { L"Notificações", L"bell.badge.fill" },- { L"Som", L"speaker.wave.3.fill" }, { L"Foco", L"moon.fill" }, { L"Tempo de Uso", L"hourglass" }, { L"Tela Bloqueada", L"lock.fill" },- { L"Privacidade e Segurança", L"hand.raised.fill" }, { L"Touch ID e Senha", L"touchid" }, { L"Windows Hello e Senha", L"touchid" },- { L"Usuários e Grupos", L"person.2.fill" }, { L"Contas de Internet", L"at" }, { L"Game Center", L"gamecontroller.fill" },- { L"iCloud", L"icloud.fill" }, { L"OneDrive", L"icloud.fill" }, { L"Teclado", L"keyboard.fill" }, { L"Mouse", L"computermouse.fill" },- { L"Trackpad", L"rectangle.and.hand.point.up.left.fill" }, { L"Impressoras e Scanners", L"printer.fill" },- // linhas das páginas- { L"Sobre", L"desktopcomputer" }, { L"Atualização de Software", L"gear.badge" }, { L"Armazenamento", L"internaldrive.fill" },- { L"Compartilhamento por Proximidade", L"airplay.audio" }, { L"Itens de Início", L"list.bullet" }, { L"Idioma e Região", L"globe" },- { L"Data e Hora", L"calendar.badge.clock" }, { L"Compartilhamento", L"square.and.arrow.up.fill" },- { L"Histórico de Arquivos", L"clock.arrow.trianglehead.counterclockwise.rotate.90" }, { L"Transferir ou Redefinir", L"arrow.counterclockwise" },- { L"Narrador", L"person.wave.2.fill" }, { L"Lupa", L"plus.magnifyingglass" }, { L"Tela", L"display" }, { L"Tamanho do Texto", L"textformat.size" },- { L"Filtros de Cor", L"camera.filters" }, { L"Áudio", L"speaker.wave.2.fill" }, { L"Legendas", L"captions.bubble.fill" },- { L"Controle por Voz", L"microphone.fill" }, { L"Ponteiro do Mouse", L"cursorarrow.rays" },- { L"Transparência e Efeitos", L"sparkles" }, { L"Copilot", L"apple.intelligence" }, { L"Fala", L"microphone.fill" },- { L"Spotlight ", L"magnifyingglass" }, { L"Ícones dos aplicativos", L"square.grid.2x2.fill" }, { L"Relógio", L"clock.arrow.trianglehead.counterclockwise.rotate.90" },- { L"Firewall", L"shield.lefthalf.filled" }, { L"VPN", L"network" }, { L"Proxies", L"network" },- { L"Informações Pessoais", L"person.fill" }, { L"Início de Sessão e Segurança", L"lock.shield.fill" }, { L"E-mail e Contas", L"at" },- { L"Família", L"person.2.fill" }, { L"Backup do Windows (OneDrive)", L"icloud.fill" }, { L"Backup do Windows", L"icloud.fill" },- { L"Serviços de Localização", L"location.fill" }, { L"Câmera", L"camera.fill" }, { L"Microfone", L"microphone.fill" },- { L"Contatos", L"person.crop.circle" }, { L"Calendários", L"calendar" }, { L"Fotos", L"photo.fill" }, { L"Arquivos e Pastas", L"folder.fill" },- { L"Acesso Total ao Disco", L"externaldrive.fill" }, { L"Análise e Melhorias", L"chart.bar.fill" }, { L"Publicidade", L"megaphone.fill" },- { L"Segurança do Windows", L"lock.shield.fill" }, { L"Encontrar Meu Dispositivo", L"location.circle.fill" },- { L"Opções de Início de Sessão", L"touchid" }, { L"Configurar Digital", L"touchid" }, { L"Configurar Rosto", L"faceid" },- { L"Imagem e Mensagem da Tela de Bloqueio", L"lock.rectangle.fill" }, { L"Notificações por Aplicativo", L"bell.badge.fill" },- { L"Não Incomodar", L"moon.fill" }, { L"Sessões de Foco", L"timer" }, { L"Família e Limites", L"hourglass" },- { L"Histórico de Atividades", L"clock.arrow.trianglehead.counterclockwise.rotate.90" },- { L"Contas de Trabalho ou Escola", L"briefcase.fill" }, { L"Barra de Jogo", L"gamecontroller.fill" }, { L"Capturas", L"record.circle.fill" },- { L"Modo de Jogo", L"bolt.fill" }, { L"Fontes de Entrada", L"keyboard.fill" }, { L"Ditado", L"microphone.fill" }, { L"Digitação", L"keyboard" },- { L"Toque e Gestos", L"rectangle.and.hand.point.up.left.fill" },- };- auto it = m.find(label);- if (it != m.end()) return it->second;- return L"";-}--// --pagina=atualizacao (o aviso de versão nova do Shell): Geral > Atualização de Software-void OpenUpdatePage() { aj::Push(L"Atualização de Software", Atualizacao); }--int SidebarIndexFor(const std::wstring& idOrUri) {- auto& items = SidebarItems();- std::wstring id = idOrUri;- // links ms-settings: → página equivalente- static const std::pair<const wchar_t*, const wchar_t*> uris[] = {- { L"ms-settings:network-wifi", L"wifi" }, { L"ms-settings:bluetooth", L"bluetooth" }, { L"ms-settings:network", L"rede" },- { L"ms-settings:powersleep", L"energia" }, { L"ms-settings:batterysaver", L"energia" }, { L"ms-settings:about", L"geral" },- { L"ms-settings:easeofaccess", L"acessibilidade" }, { L"ms-settings:colors", L"aparencia" }, { L"ms-settings:personalization-colors", L"aparencia" },- { L"ms-settings:taskbar", L"dock" }, { L"ms-settings:display", L"telas" }, { L"ms-settings:lockscreen", L"bloqueio" },- { L"ms-settings:personalization-background", L"fundo" }, { L"ms-settings:personalization", L"fundo" }, { L"ms-settings:notifications", L"notificacoes" },- { L"ms-settings:sound", L"som" }, { L"ms-settings:quiethours", L"foco" }, { L"ms-settings:privacy", L"privacidade" },- { L"ms-settings:signinoptions", L"senha" }, { L"ms-settings:otherusers", L"usuarios" }, { L"ms-settings:yourinfo", L"conta" },- { L"ms-settings:emailandaccounts", L"contas" }, { L"ms-settings:gaming", L"jogos" }, { L"ms-settings:typing", L"teclado" },- { L"ms-settings:keyboard", L"teclado" }, { L"ms-settings:mousetouchpad", L"mouse" }, { L"ms-settings:devices-touchpad", L"trackpad" },- { L"ms-settings:printers", L"impressoras" }, { L"ms-settings:dateandtime", L"geral" }, { L"ms-settings:windowsupdate", L"geral" },- { L"ms-settings:storagesense", L"geral" }, { L"ms-settings:search", L"spotlight" } };- if (id.rfind(L"ms-settings:", 0) == 0) {- std::wstring best;- size_t len = 0;- for (auto& [u, pid] : uris) { size_t n = wcslen(u); if (id.compare(0, n, u) == 0 && n > len) { len = n; best = pid; } }- id = best.empty() ? L"geral" : best;- }- for (int i = 0; i < (int)items.size(); i++) if (items[i].id == id) return i;- return -1;-}+ Row clock = Popup(L"Relógio", { L"Dia, data e hora", L"Só a hora" }, [] { return Setting(L"relogio_curto", L"0") == L"1" ? 1 : 0; },+ [](int i) { SetSetting(L"relogio_curto", i == 1 ? L"1" : L"0"); });+ clock.icon = 0xE787; clock.iconColor = C_GRAY;+ // issue #43: 24 horas ou 12 horas (AM/PM); Automático segue o formato de hora do Windows+ Row formato = Popup(L"Formato da hora", { L"Automático", L"24 horas", L"12 horas (AM/PM)" },+ [] { auto v = Setting(L"relogio_formato", L"auto"); return v == L"24" ? 1 : v == L"12" ? 2 : 0; },+ [](int i) { SetSetting(L"relogio_formato", i == 1 ? L"24" : i == 2 ? L"12" : L"auto"); });+ formato.icon = 0xE916; formato.iconColor = C_GRAY;+ // issue #38: os segundos no relógio da barra+ Row segundos = Toggle(L"Mostrar os segundos", [] { return Setting(L"relogio_segundos", L"0") == L"1"; },+ [](bool v) { SetSetting(L"relogio_segundos", v ? L"1" : L"0"); });+ segundos.icon = 0xE916; segundos.iconColor = C_GRAY;+ // Reddit (dougnite, 20/11/2026): sem barra nos monitores secundários (o topo deles volta para as janelas)+ Row todos = Toggle(L"Mostrar a barra de menus em todos os monitores", [] { return Setting(L"barra_todos_monitores", L"1") != L"0"; },+ [](bool v) { SetSetting(L"barra_todos_monitores", v ? L"1" : L"0"); },+ L"Desligado, a barra de menus fica só no monitor principal e os outros usam a tela inteira.");+ todos.icon = 0xE7F4; todos.iconColor = C_GRAY;+ // issue #8: a bolinha laranja (microfone) / verde (câmera) entre a Central de Controle e a data, como no macOS+ Row priv = Toggle(L"Mostrar o uso do microfone e da câmera", [] { return Setting(L"barra_privacidade", L"1") != L"0"; },+ [](bool v) { SetSetting(L"barra_privacidade", v ? L"1" : L"0"); },+ L"Uma bolinha laranja (microfone) ou verde (câmera) aparece ao lado da data enquanto um app usa um deles.");+ priv.icon = 0xE720; priv.iconColor = C_ORANGE;+ // issue #29: sem barra em cima, junto do Dock+ Row baixo = Toggle(L"Barra de menus embaixo, junto do Dock", [] { return Setting(L"barra_embaixo", L"0") == L"1"; },+ [](bool v) { SetSetting(L"barra_embaixo", v ? L"1" : L"0"); },+ L"Os menus ficam à esquerda do Dock e os ícones e o relógio à direita. Precisa do Dock embaixo, no monitor principal; não vale no tema Leopard.");+ baixo.icon = 0xE90E; baixo.iconColor = C_GRAY;+ // issue #40: como no Mac, a barra some e as janelas usam o topo da tela; aparece com o ponteiro no topo+ Row ocultar = Toggle(L"Ocultar e mostrar a barra de menus automaticamente", [] { return Setting(L"barra_ocultar", L"0") == L"1"; },+ [](bool v) { SetSetting(L"barra_ocultar", v ? L"1" : L"0"); },+ L"As janelas usam a tela inteira. Leve o ponteiro até o topo da tela para a barra aparecer.");+ ocultar.icon = 0xE8A7; ocultar.iconColor = C_GRAY;+ p.groups.push_back(G({ clock, formato, segundos, ocultar, baixo, todos, priv }));+ return p;+}++// ================= Ilha Dinâmica (issue #8: página própria; antes ficava no fim da Central de Controle)+Page IlhaDinamica() {+ Page p;+ // Ilha Dinâmica (src/shell/ilha.cpp): desligada por padrão; as outras opções só valem com ela ligada+ auto on = [](const wchar_t* k, const wchar_t* d) { std::wstring kk = k, dd = d; return std::function<bool()>([kk, dd] { return Setting(kk.c_str(), dd.c_str()) == L"1"; }); };+ auto set = [](const wchar_t* k) { std::wstring kk = k; return std::function<void(bool)>([kk](bool v) { SetSetting(kk.c_str(), v ? L"1" : L"0"); Rebuild(); }); };+ std::vector<Row> ilha = { Toggle(L"Ilha Dinâmica", on(L"ilha", L"0"), set(L"ilha"),+ L"Mostra no topo da tela a música tocando, timers, notificações, downloads, o volume e uma estante de arquivos. Passe o ponteiro sobre ela para abrir.") };+ if (Setting(L"ilha", L"0") == L"1") {+ // estilo: notch (entalhe grudado no topo), ilha (pílula sempre na barra) ou só quando acontece algo+ Row est = Popup(L"Estilo", { L"Notch", L"Ilha", L"Só quando houver algo" },+ [] { std::wstring v = Setting(L"ilha_estilo", L"notch"); return v == L"ilha" ? 1 : v == L"notificacao" ? 2 : 0; },+ [](int i) { SetSetting(L"ilha_estilo", i == 1 ? L"ilha" : i == 2 ? L"notificacao" : L"notch"); });+ ilha.push_back(est);+ ilha.push_back(Toggle(L"Abrir ao passar o ponteiro", on(L"ilha_passar", L"1"), set(L"ilha_passar")));+ ilha.push_back(Toggle(L"Mostrar notificações na ilha", on(L"ilha_notificacoes", L"1"), set(L"ilha_notificacoes")));+ ilha.push_back(Toggle(L"Mostrar o volume na ilha", on(L"ilha_volume", L"1"), set(L"ilha_volume")));+ ilha.push_back(Toggle(L"Avisar “Copiado” ao copiar", on(L"ilha_copiado", L"1"), set(L"ilha_copiado"),+ L"Um aviso rápido na ilha quando você copia um texto, uma imagem ou arquivos."));+ }+ // issue #40: com a ilha desligada (ou no estilo "Só quando houver algo"), aparece na Estante ao arrastar um arquivo até o topo+ if (Setting(L"ilha", L"0") != L"1" || Setting(L"ilha_estilo", L"notch") == L"notificacao")+ ilha.push_back(Toggle(L"Mostrar ao arrastar arquivos", on(L"ilha_arrastar", L"1"), set(L"ilha_arrastar"),+ L"Arraste um arquivo até o topo da tela e a ilha aparece aberta na Estante, mesmo quando ela não fica à mostra."));+ p.groups.push_back(G(ilha, L"Ilha Dinâmica"));+ if (Setting(L"ilha", L"0") == L"1")+ p.groups.push_back(G({ Note(L"Na ilha também ficam a bolinha laranja (microfone) ou verde (câmera) em uso, o timer (aba Timer: pausar, parar, ±1 minuto) e o histórico do que você copiou (aba Transferência).") }));+ return p;+}++// ================= Personalizar o Dock / a Mesa (pedido de 20/11/2026, na linha do MyDockFinder)+// O Shell lê cada chave (dock.cpp ReadSettings, mesa.cpp LerMedidas, widgets.cpp SettingsChanged) assim que o+// ajustes.txt muda. Chave vazia = o padrão medido do Mac em cada tema.+static float NumSetting(const wchar_t* k, float def) { std::wstring v = Setting(k, L""); return v.empty() ? def : (float)_wtof(v.c_str()); }+static std::function<void(float)> SetNum(const wchar_t* k) { std::wstring kk = k; return [kk](float v) { SetSetting(kk.c_str(), std::to_wstring((int)std::lround(v))); }; }+static Row Flag(const std::wstring& label, const wchar_t* k, const wchar_t* def, const std::wstring& detail = L"") {+ std::wstring kk = k, dd = def;+ return Toggle(label, [kk, dd] { return Setting(kk.c_str(), dd.c_str()) != L"0"; }, [kk](bool on) { SetSetting(kk.c_str(), on ? L"1" : L"0"); }, detail);+}+static std::wstring IconesDockDir() {+ PWSTR p = nullptr;+ std::wstring d;+ if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) { d = std::wstring(p) + L"\\Shell\\icones-dock"; CoTaskMemFree(p); }+ return d;+}++Page PersonalizarDock() {+ Page p;+ bool tahoe = Setting(L"liquid_glass", L"0") == L"1";+ Row esp = Slider(L"Espaço entre os ícones", 0, 32, [] { return NumSetting(L"dock_espaco", 0); }, SetNum(L"dock_espaco"), L"Juntos", L"Separados");+ esp.hasDef = true; esp.def = 0;+ Row marg = Slider(L"Distância da borda da tela", 0, 40, [] { return NumSetting(L"dock_margem", 5); }, SetNum(L"dock_margem"), L"Encostado", L"Longe");+ marg.hasDef = true; marg.def = 5;+ // no Mac a janela maximizada encosta no Dock; quem quiser um respiro entre os dois escolhe aqui (issue #8)+ Row folga = Slider(L"Espaço acima das janelas maximizadas", 0, 24, [] { return NumSetting(L"dock_folga", 0); }, SetNum(L"dock_folga"), L"Encostado", L"Longe");+ folga.hasDef = true; folga.def = 0;+ p.groups.push_back(G({ esp, marg, folga }, L"Tamanho e Espaço"));+ float raioDef = tahoe ? 61.f : 43.f, opacDef = tahoe ? 39.f : 45.f;+ Row raio = Slider(L"Arredondamento dos cantos", 0, 100, [raioDef] { return NumSetting(L"dock_raio", raioDef); }, SetNum(L"dock_raio"), L"Reto", L"Pílula");+ raio.hasDef = true; raio.def = raioDef;+ static const wchar_t* cores[] = { L"auto", L"clara", L"escura", L"destaque" };+ Row cor = Popup(L"Cor do vidro", { L"Automática", L"Clara", L"Escura", L"Cor de destaque" },+ [] { std::wstring v = Setting(L"dock_cor", L"auto"); for (int i = 0; i < 4; i++) if (v == cores[i]) return i; return 0; },+ [](int i) { SetSetting(L"dock_cor", cores[std::clamp(i, 0, 3)]); });+ Row opac = Slider(L"Opacidade do vidro", 0, 100, [opacDef] { return NumSetting(L"dock_opacidade", opacDef); }, SetNum(L"dock_opacidade"), L"Transparente", L"Sólido");+ opac.hasDef = true; opac.def = opacDef;+ p.groups.push_back(G({ raio, cor, opac }, L"Fundo"));+ Row ind = Popup(L"Indicador de app aberto", { L"Ponto", L"Traço" }, [] { return Setting(L"dock_indicador", L"ponto") == L"traco" ? 1 : 0; },+ [](int i) { SetSetting(L"dock_indicador", i == 1 ? L"traco" : L"ponto"); });+ // issue #40: ícones do Launchpad menores (a grade continua a mesma)+ Row lpIcones = Popup(L"Tamanho dos ícones do Launchpad", { L"Grande", L"Médio", L"Pequeno" },+ [] { double v = _wtof(Setting(L"launchpad_icones", L"1").c_str()); return v < 0.78 ? 2 : v < 0.93 ? 1 : 0; },+ [](int i) { SetSetting(L"launchpad_icones", i == 2 ? L"0.7" : i == 1 ? L"0.85" : L"1"); });+ p.groups.push_back(G({ Flag(L"Mostrar o Launchpad", L"dock_launchpad", L"1"), lpIcones, Flag(L"Mostrar a divisória", L"dock_separador", L"1"),+ Flag(L"Mostrar o nome ao passar o ponteiro", L"dock_rotulos", L"1"), ind,+ Flag(L"Mostrar indicadores de aplicativos abertos", L"indicadores", L"1"),+ Flag(L"Animar aplicativos ao abrir", L"animar_abertura", L"1"),+ Flag(L"Pular quando chega uma notificação", L"pulo_notificacao", L"1") }, L"Itens e Animações"));+ p.groups.push_back(G({ Button(L"Ícones próprios", L"Abrir a Pasta…", [] {+ std::wstring d = IconesDockDir();+ if (d.empty()) return;+ SHCreateDirectoryExW(nullptr, d.c_str(), nullptr);+ ShellExecuteW(nullptr, L"open", d.c_str(), nullptr, nullptr, SW_SHOWNORMAL);+ }, L"Ponha um PNG com o nome do .exe (chrome.png, discord.png) ou do app (Google Chrome.png) nesta pasta para trocar o ícone dele no Dock. Imagens de 512 × 512 com a margem do Mac ficam melhores.") }, L"Ícones"));+ p.groups.push_back(Plain(Buttons({ { L"Restaurar o Padrão", [] {+ for (auto k : { L"dock_espaco", L"dock_margem", L"dock_folga", L"dock_raio", L"dock_opacidade" }) SetSetting(k, L"");+ SetSetting(L"dock_cor", L"auto"); SetSetting(L"dock_indicador", L"ponto");+ for (auto k : { L"dock_launchpad", L"dock_separador", L"dock_rotulos" }) SetSetting(k, L"1");+ Rebuild();+ } } })));+ return p;+}++Page PersonalizarMesa() {+ Page p;+ Row tam = Slider(L"Tamanho dos ícones", 16, 128, [] { return NumSetting(L"mesa_icone_tamanho", 64); }, SetNum(L"mesa_icone_tamanho"), L"Pequeno", L"Grande");+ tam.hasDef = true; tam.def = 64;+ Row esp = Slider(L"Espaço da grade", -20, 80, [] { return NumSetting(L"mesa_espaco", 0); }, SetNum(L"mesa_espaco"), L"Junto", L"Separado");+ esp.hasDef = true; esp.def = 0;+ Row txt = Slider(L"Tamanho do texto", 10, 16, [] { return NumSetting(L"mesa_texto", 12); }, SetNum(L"mesa_texto"), L"10", L"16");+ txt.hasDef = true; txt.def = 12;+ p.groups.push_back(G({ Flag(L"Mostrar ícones na mesa", L"mesa_icones", L"1"), tam, esp, txt,+ Toggle(L"Alinhar à grade", [] { return Setting(L"mesa_grade", L"0") == L"1"; }, [](bool on) { SetSetting(L"mesa_grade", on ? L"1" : L"0"); }),+ Toggle(L"Usar Pilhas", [] { return Setting(L"mesa_pilhas", L"0") == L"1"; }, [](bool on) { SetSetting(L"mesa_pilhas", on ? L"1" : L"0"); },+ L"Agrupa os arquivos da mesa por tipo.") }, L"Ícones da Mesa"));+ p.groups.push_back(G({ Flag(L"Tempo", L"widget.tempo.on", L"1"), Flag(L"Relógio", L"widget.relogio.on", L"1"), Flag(L"Calendário", L"widget.calendario.on", L"1"),+ Flag(L"Relógio Mundial", L"widget.mundial.on", L"1"), Flag(L"Nascer do Sol", L"widget.sol.on", L"1") }, L"Widgets na Mesa"));+ p.groups.push_back(Plain(Buttons({ { L"Restaurar o Padrão", [] {+ for (auto k : { L"mesa_icone_tamanho", L"mesa_espaco", L"mesa_texto" }) SetSetting(k, L"");+ Rebuild();+ } } })));+ return p;+}++// ================= Mesa e Dock+Page MesaDock() {+ Page p;+ auto num = [](const wchar_t* k, const wchar_t* d) { return (float)_wtof(Setting(k, d).c_str()); };+ auto flag = [](const wchar_t* k, const wchar_t* d) { std::wstring kk = k, dd = d; return std::function<bool()>([kk, dd] { return Setting(kk.c_str(), dd.c_str()) == L"1"; }); };+ auto setFlag = [](const wchar_t* k) { std::wstring kk = k; return std::function<void(bool)>([kk](bool on) { SetSetting(kk.c_str(), on ? L"1" : L"0"); }); };+ Row size = Slider(L"Tamanho", 16, 128, [num] { return num(L"tamanho", L"48"); }, [](float v) { SetSetting(L"tamanho", std::to_wstring((int)std::lround(v))); }, L"Pequeno", L"Grande");+ Row mag = Toggle(L"Ampliação", flag(L"ampliacao", L"0"), setFlag(L"ampliacao"));+ Row magSize = Slider(L"Tamanho da ampliação", 16, 256, [num] { return num(L"ampliacao_tamanho", L"128"); },+ [](float v) { SetSetting(L"ampliacao_tamanho", std::to_wstring((int)std::lround(v))); }, L"Pequeno", L"Grande");+ magSize.enabled = Setting(L"ampliacao", L"0") == L"1";+ size.hasDef = true; size.def = 48;+ magSize.hasDef = true; magSize.def = 128;+ // dock_posicao = baixo | esquerda | direita (o Dock do Leopard, a prateleira em perspectiva, fica sempre embaixo)+ Row pos = Popup(L"Posição na tela", { L"Esquerda", L"Embaixo", L"Direita" }, [] {+ std::wstring v = Setting(L"dock_posicao", L"baixo");+ return v == L"esquerda" ? 0 : v == L"direita" ? 2 : 1;+ }, [](int i) { SetSetting(L"dock_posicao", i == 0 ? L"esquerda" : i == 2 ? L"direita" : L"baixo"); });+ // Monitor do Dock (dock_monitor = nome do monitor, ex. \\.\DISPLAY2; vazio = o principal). A barra de+ // menus fica em todos; o Dock só neste.+ std::vector<std::wstring> monDev{ L"" }, monName{ L"Tela principal" };+ {+ struct Ctx { std::vector<std::wstring>*dev, *name; } ctx{ &monDev, &monName };+ EnumDisplayMonitors(nullptr, nullptr, [](HMONITOR hm, HDC, LPRECT, LPARAM p) -> BOOL {+ auto* c = (Ctx*)p;+ MONITORINFOEXW mi{}; mi.cbSize = sizeof(mi);+ if (!GetMonitorInfoW(hm, &mi) || (mi.dwFlags & MONITORINFOF_PRIMARY)) return TRUE;+ DISPLAY_DEVICEW dd{ sizeof(dd) };+ std::wstring name = mi.szDevice;+ if (name.rfind(L"\\\\.\\", 0) == 0) name = name.substr(4); // \\.\DISPLAY2 -> DISPLAY2+ if (EnumDisplayDevicesW(mi.szDevice, 0, &dd, 0) && dd.DeviceString[0]) name += std::wstring(L" (") + dd.DeviceString + L")";+ c->dev->push_back(mi.szDevice);+ c->name->push_back(name);+ return TRUE;+ }, (LPARAM)&ctx);+ }+ Row monRow = Popup(L"Monitor do Dock", monName,+ [monDev] { std::wstring v = Setting(L"dock_monitor", L""); for (int i = 0; i < (int)monDev.size(); i++) if (!_wcsicmp(v.c_str(), monDev[i].c_str())) return i; return 0; },+ [monDev](int i) { SetSetting(L"dock_monitor", monDev[std::clamp(i, 0, (int)monDev.size() - 1)]); });+ monRow.enabled = monDev.size() > 1;+ // Inteligente: só esconde quando uma janela encosta no Dock (pedido de um usuário no Reddit)+ Row hide = Popup(L"Ocultar o Dock", { L"Nunca", L"Automaticamente", L"Quando uma janela encostar nele" },+ [] { std::wstring v = Setting(L"ocultar", L"0"); return v == L"1" ? 1 : v == L"inteligente" ? 2 : 0; },+ [](int i) { SetSetting(L"ocultar", i == 1 ? L"1" : i == 2 ? L"inteligente" : L"0"); });+ // issue #8 (macOS: "Minimizar janelas no ícone do aplicativo"): a janela minimizada vai para o ícone do app, sem a+ // miniatura entre Downloads e a Lixeira; clicar no ícone traz de volta+ Row minIcon = Toggle(L"Minimizar janelas no ícone do aplicativo", flag(L"dock_minimizar_no_icone", L"0"), setFlag(L"dock_minimizar_no_icone"));+ Row anim = Toggle(L"Animar aplicativos ao abrir", flag(L"animar_abertura", L"1"), setFlag(L"animar_abertura"));+ Row ind = Toggle(L"Mostrar indicadores de aplicativos abertos", flag(L"indicadores", L"1"), setFlag(L"indicadores"));+ Row dl = Toggle(L"Mostrar a pasta Downloads no Dock", flag(L"dock_downloads", L"1"), setFlag(L"dock_downloads"));+ Row pers = Link(L"Personalizar o Dock…", [] { Push(L"Personalizar o Dock", PersonalizarDock); });+ p.groups.push_back(G({ size, mag, magSize, pos, monRow, hide, minIcon, anim, ind, dl, pers }, L"Dock"));+ // como no macOS 15/26 (Mesa e Dock > Área de Trabalho e Organizador Visual)+ // macOS 14+: "Mostrar Itens: Na Mesa" (o mesmo que o menu da mesa "Ocultar Ícones da Mesa")+ Row icons = Toggle(L"Mostrar ícones na mesa", [] { return Setting(L"mesa_icones", L"1") != L"0"; }, [](bool v) { SetSetting(L"mesa_icones", v ? L"1" : L"0"); });+ Row persMesa = Link(L"Personalizar a Mesa…", [] { Push(L"Personalizar a Mesa", PersonalizarMesa); });+ p.groups.push_back(G({ icons, persMesa, Popup(L"Clicar no papel de parede para mostrar a mesa", { L"Sempre", L"Só no Organizador Visual", L"Nunca" },+ [] { std::wstring v = Setting(L"clique_mostra_mesa", L"palco"); return v == L"1" ? 0 : v == L"0" ? 2 : 1; },+ [](int i) { SetSetting(L"clique_mostra_mesa", i == 0 ? L"1" : i == 2 ? L"0" : L"palco"); }) }, L"Área de Trabalho"));+ p.groups.push_back(G({ Toggle(L"Arrastar janelas para as bordas da tela para organizar", [] { return sys::SnapEnabled(); },+ [](bool on) { sys::SetSnapEnabled(on); if (on && Setting(L"encaixe_windows", L"0") == L"1") SystemParametersInfoW(0x0083, TRUE, nullptr, 0); }),+ // o Snap do Windows no lugar do nosso: arrastar um app maximizado (Chrome, Discord) o desmaximiza (PR #14)+ Toggle(L"Usar o encaixe do Windows (Snap)", [] { return Setting(L"encaixe_windows", L"0") == L"1"; },+ [](bool v) {+ SetSetting(L"encaixe_windows", v ? L"1" : L"0");+ // na hora, sem reiniciar o Shell (0x0083 = SPI_SETWINARRANGING, só nesta sessão)+ if (v && sys::SnapEnabled()) SystemParametersInfoW(0x0083, TRUE, nullptr, 0);+ else if (!v && FindWindowW(L"ShellMensagens", nullptr)) SystemParametersInfoW(0x0083, FALSE, nullptr, 0);+ }),+ // issue #4: como no Mac, o Finder fica no Alt+Tab mesmo sem janela; desligado, só com janela aberta+ Toggle(L"Mostrar o Finder no Alt+Tab mesmo sem janelas", [] { return Setting(L"seletor_finder", L"1") != L"0"; },+ [](bool v) { SetSetting(L"seletor_finder", v ? L"1" : L"0"); }),+ Uri(L"Navegador padrão", L"ms-settings:defaultapps") }, L"Janelas"));+ // Organizador Visual (Stage Manager): só o app da frente na tela, os outros numa faixa à esquerda+ p.groups.push_back(G({ Toggle(L"Organizador Visual", flag(L"organizador", L"0"), setFlag(L"organizador")) }, L"",+ L"Os outros apps ficam numa faixa à esquerda; clique numa miniatura para trazer o app."));+ // Cantos Ativos (como no Mac): uma ação por canto da tela; o Shell lê canto_se/sd/ie/id+ {+ static const wchar_t* vals[] = { L"nada", L"mission", L"janelas", L"mesa", L"launchpad", L"notificacoes", L"central", L"spotlight", L"bloquear", L"tela", L"nota" };+ static const std::vector<std::wstring> names = { L"Nada", L"Mission Control", L"Janelas do Aplicativo", L"Mesa", L"Launchpad", L"Central de Notificações",+ L"Central de Controle", L"Spotlight", L"Bloquear Tela", L"Descansar a Tela", L"Nota Rápida" };+ const int NV = (int)(sizeof(vals) / sizeof(vals[0]));+ auto corner = [](const wchar_t* label, const wchar_t* key, const wchar_t* def) {+ std::wstring k = key, d = def;+ return Popup(label, names,+ [k, d] { std::wstring v = Setting(k.c_str(), d.c_str()); for (int i = 0; i < NV; i++) if (v == vals[i]) return i; return 0; },+ [k](int i) { SetSetting(k.c_str(), vals[std::clamp(i, 0, NV - 1)]); });+ };+ p.groups.push_back(G({ corner(L"Canto superior esquerdo", L"canto_se", L"nada"), corner(L"Canto superior direito", L"canto_sd", L"nada"),+ corner(L"Canto inferior esquerdo", L"canto_ie", L"nada"), corner(L"Canto inferior direito", L"canto_id", L"nota"),+ Note(L"Leve o ponteiro até um canto da tela para fazer a ação. Não funciona arrastando nem com um app em tela cheia.") },+ L"Cantos Ativos"));+ }+ return p;+}++// ================= Telas+static bool g_allRes; // Telas: "Mostrar todas as resoluções"++Page Telas() {+ Page p;+ DISPLAY_DEVICEW dd{ sizeof(dd) }, mon{ sizeof(mon) };+ std::wstring name = L"Tela";+ for (DWORD k = 0; EnumDisplayDevicesW(nullptr, k, &dd, 0); k++)+ if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { if (EnumDisplayDevicesW(dd.DeviceName, 0, &mon, 0) && mon.DeviceString[0]) name = mon.DeviceString; break; }+ auto mode = sys::CurrentResolution();+ std::wstring wall = sys::Wallpaper();+ // monitor com a imagem de fundo na tela e o pé, como no macOS 26; nome embaixo+ Row head; head.kind = Kind::Custom; head.height = 150;+ head.draw = [name, mode, wall](Ctx& c, D2D1_RECT_F rr) {+ float cx = (rr.left + rr.right) / 2;+ float ar = mode.h ? (float)mode.w / mode.h : 1.6f;+ float h = 78, w = std::min(220.f, h * ar);+ D2D1_RECT_F scr = D2D1::RectF(cx - w / 2, rr.top + 14, cx + w / 2, rr.top + 14 + h);+ c.br->SetColor(D2D1::ColorF(0.08f, 0.08f, 0.09f, 1));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(scr, 5, 5), c.br);+ D2D1_RECT_F in = D2D1::RectF(scr.left + 3, scr.top + 3, scr.right - 3, scr.bottom - 3);+ if (ID2D1Bitmap* b = BitmapFromFile(wall, 480)) {+ auto s2 = b->GetSize();+ float k = std::max((in.right - in.left) / s2.width, (in.bottom - in.top) / s2.height);+ float dw = s2.width * k, dh = s2.height * k, mx = (in.left + in.right) / 2, my = (in.top + in.bottom) / 2;+ c.dc->PushAxisAlignedClip(in, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);+ c.dc->DrawBitmap(b, D2D1::RectF(mx - dw / 2, my - dh / 2, mx + dw / 2, my + dh / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);+ c.dc->PopAxisAlignedClip();+ } else { c.br->SetColor(c.accent); c.dc->FillRectangle(in, c.br); }+ c.br->SetColor(D2D1::ColorF(0.55f, 0.55f, 0.57f, 1)); // pé+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 22, scr.bottom, cx + 22, scr.bottom + 6), 1.5f, 1.5f), c.br);+ Text(c, name, D2D1::RectF(rr.left, scr.bottom + 14, rr.right, scr.bottom + 34), c.center, c.text);+ // setinha embaixo do nome (a tela escolhida), como no Mac+ c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.10f) : D2D1::ColorF(0, 0, 0, 0.08f));+ c.dc->FillRectangle(D2D1::RectF(rr.left - 20, rr.bottom - 1, rr.right + 20, rr.bottom), c.br);+ };+ p.groups.push_back(Plain(head));++ // resoluções numa lista dentro da caixa (a atual destacada); "Mostrar todas" abre as de outras proporções+ auto res = sys::Resolutions();+ std::vector<sys::Mode> shown;+ float curAr = mode.h ? (float)mode.w / mode.h : 0;+ for (auto& m : res) {+ bool dup = false;+ for (auto& o : shown) if (o.w == m.w && o.h == m.h) dup = true;+ if (dup) continue;+ if (!g_allRes && m.h && std::fabs((float)m.w / m.h - curAr) > 0.02f) continue;+ shown.push_back(m);+ }+ std::sort(shown.begin(), shown.end(), [](const sys::Mode& a, const sys::Mode& b) { return a.w * a.h > b.w * b.h; });+ if (!g_allRes && shown.size() > 6) { // as 6 em volta da atual+ int ci = 0;+ for (int k = 0; k < (int)shown.size(); k++) if (shown[k].w == mode.w && shown[k].h == mode.h) ci = k;+ int from = std::clamp(ci - 2, 0, (int)shown.size() - 6);+ shown = std::vector<sys::Mode>(shown.begin() + from, shown.begin() + from + 6);+ }+ Group rg = G({});+ if (!shown.empty()) {+ Row list; list.kind = Kind::Custom; list.height = 8 + shown.size() * 34.f;+ list.draw = [shown, mode](Ctx& c, D2D1_RECT_F rr) {+ for (size_t k = 0; k < shown.size(); k++) {+ D2D1_RECT_F r = D2D1::RectF(rr.left + 8, rr.top + 4 + k * 34, rr.right - 8, rr.top + 4 + (k + 1) * 34);+ bool cur = shown[k].w == mode.w && shown[k].h == mode.h;+ if (cur) { c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.08f)); c.dc->FillRoundedRectangle(D2D1::RoundedRect(r, 6, 6), c.br); }+ else if (k > 0 && !(shown[k - 1].w == mode.w && shown[k - 1].h == mode.h)) {+ c.br->SetColor(c.line); c.dc->FillRectangle(D2D1::RectF(r.left + 10, r.top - 0.5f, r.right - 10, r.top + 0.5f), c.br);+ }+ Text(c, std::to_wstring(shown[k].w) + L" × " + std::to_wstring(shown[k].h), D2D1::RectF(r.left + 10, r.top, r.right - 10, r.bottom), c.body, c.text);+ }+ };+ list.clickAt = [shown](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ int k = (int)((pt.y - rr.top - 4) / 34);+ if (k >= 0 && k < (int)shown.size()) { sys::SetResolution(shown[k]); Rebuild(); }+ };+ rg.rows.push_back(list);+ }+ rg.rows.push_back(Toggle(L"Mostrar todas as resoluções", [] { return g_allRes; }, [](bool on) { g_allRes = on; Rebuild(); }));+ p.groups.push_back(rg);++ float b = sys::Brightness();+ if (b >= 0) p.groups.push_back(G({ Slider(L"Brilho", 0, 1, [] { return std::max(0.f, sys::Brightness()); }, [](float v) { sys::SetBrightness(v); },+ std::wstring(1, (wchar_t)0xE706), std::wstring(1, (wchar_t)0xE706)) }));+ auto rates = sys::RefreshRates();+ if (rates.size() > 1) {+ std::vector<std::wstring> ol;+ int cr = sys::RefreshRate(), ci = 0;+ for (int k = 0; k < (int)rates.size(); k++) { ol.push_back(std::to_wstring(rates[k]) + L" Hertz"); if (rates[k] == cr) ci = k; }+ p.groups.push_back(G({ Popup(L"Taxa de atualização", ol, [ci] { return ci; }, [rates](int k) { sys::SetRefreshRate(rates[k]); }) }));+ }+ p.groups.push_back(G({ Link(L"Escala", [] { OpenUri(L"ms-settings:display"); }, 0, 0, [] { return Fmt(L"%d%%", (int)std::lround(sys::ScaleFactor() * 100)); }) }));+ p.groups.push_back(Plain(Buttons({ { L"Avançado…", [] { OpenUri(L"ms-settings:display-advanced"); } }, { L"Night Shift…", [] { OpenUri(L"ms-settings:nightlight"); } } })));+ return p;+}++// ================= Protetor de Tela+const wchar_t* SAVER_FILES[] = { L"", L"scrnsave.scr", L"Bubbles.scr", L"Ribbons.scr", L"Mystify.scr", L"PhotoScreensaver.scr", L"ssText3d.scr" };+const wchar_t* SAVER_NAMES[] = { L"Nenhum", L"Em Branco", L"Bolhas", L"Fitas", L"Mistificar", L"Fotos", L"Texto 3D" };++Page Protetor() {+ Page p;+ std::vector<std::wstring> names(std::begin(SAVER_NAMES), std::end(SAVER_NAMES));+ p.groups.push_back(G({+ Popup(L"Protetor de tela", names,+ [] {+ wchar_t buf[MAX_PATH] = {}; DWORD cb = sizeof(buf);+ RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"SCRNSAVE.EXE", RRF_RT_REG_SZ, nullptr, buf, &cb);+ std::wstring f = PathFindFileNameW(buf);+ for (int i = 1; i < 7; i++) if (_wcsicmp(f.c_str(), SAVER_FILES[i]) == 0) return i;+ return 0;+ },+ [](int i) {+ wchar_t sysdir[MAX_PATH]; GetSystemDirectoryW(sysdir, MAX_PATH);+ if (i == 0) { RegDeleteKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"SCRNSAVE.EXE"); SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, FALSE, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); return; }+ std::wstring path = std::wstring(sysdir) + L"\\" + SAVER_FILES[i];+ RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"SCRNSAVE.EXE", REG_SZ, path.c_str(), (DWORD)((path.size() + 1) * 2));+ SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, TRUE, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);+ }),+ Popup(L"Iniciar o protetor de tela quando inativo", MinuteLabels(L"Após "),+ [] { UINT s = 0; SystemParametersInfoW(SPI_GETSCREENSAVETIMEOUT, 0, &s, 0); BOOL on = FALSE; SystemParametersInfoW(SPI_GETSCREENSAVEACTIVE, 0, &on, 0); return MinuteIndex(on ? (int)(s / 60) : 0); },+ [](int i) { if (MINUTES[i]) SystemParametersInfoW(SPI_SETSCREENSAVETIMEOUT, MINUTES[i] * 60, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);+ else SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, FALSE, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); }),+ }));+ p.groups.push_back(Plain(Buttons({ { L"Pré-visualizar", [] {+ wchar_t buf[MAX_PATH] = {}; DWORD cb = sizeof(buf);+ if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"SCRNSAVE.EXE", RRF_RT_REG_SZ, nullptr, buf, &cb) == ERROR_SUCCESS)+ ShellExecuteW(nullptr, L"open", buf, L"/s", nullptr, SW_SHOWNORMAL);+ } } })));+ return p;+}++// ================= Spotlight+Page Spotlight() {+ Page p;+ p.groups.push_back(G({ Uri(L"Permissões de Pesquisa", L"ms-settings:search-permissions", 0xE721, C_GRAY),+ Uri(L"Pesquisa no Windows (Indexação)", L"ms-settings:cortana-windowssearch", 0xE8B7, C_BLUE) },+ L"Resultados da Pesquisa", L"O Spotlight usa o índice de pesquisa do Windows para achar arquivos."));+ return p;+}++// ================= Imagem de Fundo+const wchar_t* FIT_NAMES[] = { L"Centralizar", L"Lado a Lado", L"Esticar", L"Ajustar à Tela", L"Preencher Tela", L"Estender" };++static bool g_allPhotos; // Imagem de Fundo: "Mostrar Todas"++void AddPhoto() {+ IFileOpenDialog* d = nullptr;+ if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&d)))) return;+ COMDLG_FILTERSPEC spec[] = { { Tr(L"Imagens"), L"*.jpg;*.jpeg;*.png;*.bmp" } };+ d->SetFileTypes(1, spec);+ if (SUCCEEDED(d->Show(Window()))) {+ IShellItem* it = nullptr;+ if (SUCCEEDED(d->GetResult(&it))) {+ PWSTR path = nullptr;+ if (SUCCEEDED(it->GetDisplayName(SIGDN_FILESYSPATH, &path))) { sys::SetWallpaper(path); CoTaskMemFree(path); }+ it->Release();+ }+ }+ d->Release();+ Rebuild();+}++Page Fundo() {+ Page p;+ std::wstring cur = sys::Wallpaper();+ // como no macOS 26: a imagem atual à esquerda; à direita, numa caixa, o nome e o ajuste (menu), e embaixo+ // os botões+ Row head; head.kind = Kind::Custom; head.height = 128;+ auto layout = [](D2D1_RECT_F rr, D2D1_RECT_F& t, D2D1_RECT_F& box, D2D1_RECT_F& b1, D2D1_RECT_F& b2) {+ t = D2D1::RectF(rr.left, rr.top + 6, rr.left + 190, rr.top + 6 + 112);+ box = D2D1::RectF(t.right + 16, rr.top + 6, rr.right, rr.top + 6 + 50);+ // botões embaixo da caixa, alinhados à direita dela (sem passar por cima da imagem em janela estreita)+ float bw = std::min(146.f, (box.right - box.left - 10) / 2);+ b2 = D2D1::RectF(box.right - bw, box.bottom + 12, box.right, box.bottom + 38);+ b1 = D2D1::RectF(b2.left - 10 - bw, box.bottom + 12, b2.left - 10, box.bottom + 38);+ };+ head.draw = [cur, layout](Ctx& c, D2D1_RECT_F rr) {+ D2D1_RECT_F t, box, b1, b2; layout(rr, t, box, b1, b2);+ c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.08f) : D2D1::ColorF(0, 0, 0, 0.06f));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 8, 8), c.br);+ if (ID2D1Bitmap* b = BitmapFromFile(cur, 400)) {+ auto s2 = b->GetSize();+ float k = std::max((t.right - t.left) / s2.width, (t.bottom - t.top) / s2.height);+ float w = s2.width * k, h = s2.height * k, cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;+ ID2D1Factory* f = nullptr; c.dc->GetFactory(&f);+ ID2D1RoundedRectangleGeometry* rg = nullptr; f->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 8, 8), &rg);+ c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);+ c.dc->DrawBitmap(b, D2D1::RectF(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);+ c.dc->PopLayer();+ rg->Release(); f->Release();+ }+ c.br->SetColor(c.group);+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(box, 12, 12), c.br);+ std::wstring n = PathFindFileNameW(cur.c_str());+ size_t dot = n.rfind(L'.'); if (dot != std::wstring::npos) n = n.substr(0, dot);+ std::wstring fit = FIT_NAMES[std::clamp(sys::WallpaperFit(), 0, 5)];+ float fw = 0;+ IDWriteTextLayout* tl = nullptr;+ if (SUCCEEDED(gfx::dw->CreateTextLayout(fit.c_str(), (UINT32)fit.size(), c.body, 400, 30, &tl))) { DWRITE_TEXT_METRICS m{}; tl->GetMetrics(&m); fw = m.width; tl->Release(); }+ Text(c, n.empty() ? L"Imagem de fundo" : n, D2D1::RectF(box.left + 12, box.top, box.right - fw - 50, box.bottom), c.body, c.text);+ Text(c, fit, D2D1::RectF(box.right - 38 - fw, box.top, box.right - 30, box.bottom), c.body, c.text);+ PopupBadge(c, box.right - 18, (box.top + box.bottom) / 2);+ ButtonFace(c, b1, L"Protetor de Tela…");+ ButtonFace(c, b2, L"Adicionar Foto…");+ };+ head.clickAt = [layout](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ D2D1_RECT_F t, box, b1, b2; layout(rr, t, box, b1, b2);+ auto in = [&](D2D1_RECT_F r) { return pt.x >= r.left && pt.x < r.right && pt.y >= r.top && pt.y < r.bottom; };+ if (in(box)) {+ int k = Menu(D2D1::RectF(box.right - 160, box.top, box.right, box.bottom), std::vector<std::wstring>(std::begin(FIT_NAMES), std::end(FIT_NAMES)), sys::WallpaperFit());+ if (k >= 0) { sys::SetWallpaperFit(k); Rebuild(); }+ } else if (in(b1)) Push(L"Protetor de Tela", Protetor);+ else if (in(b2)) AddPhoto();+ };+ p.groups.push_back(Plain(head));+ // seções como no Ajustes do macOS 26: Papéis de Parede Dinâmicos (um por versão do sistema, do mais novo+ // ao mais antigo; "Mostrar Todas" abre todos), Suas Fotos (com "Adicionar Foto…" primeiro), os Aerials por+ // categoria (Paisagem, Cidades, Debaixo d'Água, Terra) e Mac. Os do sistema ficam em+ // Pictures\Wallpapers macOS\<versão> e os Aerials em Pictures\Wallpapers macOS\Aerials\<categoria>.+ struct Item { std::wstring path, label; };+ struct Sec { std::wstring title; std::vector<Item> items; };+ static std::vector<Sec> secs;+ static DWORD at = 0;+ if (secs.empty() || GetTickCount() - at > 30000) {+ secs.clear();+ at = GetTickCount();+ // na pasta Pictures do perfil (fora do OneDrive: são ~2 GB que não precisam ir para a nuvem); se não+ // existir, na pasta Imagens do Windows+ std::wstring macDir;+ wchar_t prof[MAX_PATH];+ if (GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) {+ std::wstring d = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS";+ if (GetFileAttributesW(d.c_str()) != INVALID_FILE_ATTRIBUTES) macDir = d;+ }+ PWSTR pics = nullptr;+ if (macDir.empty() && SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Pictures, 0, nullptr, &pics))) { macDir = std::wstring(pics) + L"\\Wallpapers macOS"; CoTaskMemFree(pics); }+ auto list = [](const std::wstring& dir) {+ std::vector<std::wstring> files;+ WIN32_FIND_DATAW fd;+ HANDLE h = FindFirstFileW((dir + L"\\*").c_str(), &fd);+ if (h != INVALID_HANDLE_VALUE) {+ do {+ if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue;+ std::wstring ext = PathFindExtensionW(fd.cFileName);+ for (auto& ch : ext) ch = towlower(ch);+ if (ext == L".jpg" || ext == L".jpeg" || ext == L".png") files.push_back(dir + L"\\" + fd.cFileName);+ } while (FindNextFileW(h, &fd));+ FindClose(h);+ }+ std::sort(files.begin(), files.end());+ return files;+ };+ auto stem = [](const std::wstring& f) {+ std::wstring n = PathFindFileNameW(f.c_str());+ size_t dot = n.rfind(L'.');+ return dot == std::wstring::npos ? n : n.substr(0, dot);+ };+ // dinâmicos: o primeiro de cada versão vem antes (a fileira fechada mostra Tahoe, Sequoia, Sonoma…)+ static const wchar_t* VERS[] = { L"Tahoe", L"macOS 27", L"Sequoia", L"Sonoma", L"Ventura", L"Monterey", L"Big Sur", L"Catalina", L"Mojave",+ L"High Sierra", L"Sierra", L"El Capitan", L"Yosemite", L"Mavericks", L"Mountain Lion", L"Lion",+ L"Snow Leopard", L"Leopard", L"Tiger", L"Panther", L"Jaguar", L"Cheetah" };+ Sec dyn{ L"Papéis de Parede Dinâmicos", {} };+ std::vector<Item> rest;+ for (auto* v : VERS) {+ auto files = list(macDir + L"\\" + v);+ for (size_t k = 0; k < files.size(); k++) (k == 0 ? dyn.items : rest).push_back({ files[k], v });+ }+ dyn.items.insert(dyn.items.end(), rest.begin(), rest.end());+ if (!dyn.items.empty()) secs.push_back(dyn);+ // suas fotos: as outras pastas de papel de parede (sem as do macOS); "Adicionar Foto…" é o primeiro quadro+ Sec mine{ L"Suas Fotos", { { L"*adicionar*", L"Adicionar Foto…" } } };+ for (auto& f : sys::WallpaperChoices())+ if (macDir.empty() || _wcsnicmp(f.c_str(), macDir.c_str(), macDir.size())) mine.items.push_back({ f, stem(f) });+ secs.push_back(mine);+ for (auto* c : { L"Paisagem", L"Cidades", L"Debaixo d'Água", L"Terra" }) {+ Sec a{ c, {} };+ for (auto& f : list(macDir + L"\\Aerials\\" + c)) a.items.push_back({ f, stem(f) });+ if (!a.items.empty()) secs.push_back(a);+ }+ Sec mac{ L"Mac", {} };+ for (auto& f : list(macDir + L"\\Mac")) { // nome do arquivo do site sem resolução e número+ std::wstring n = stem(f), nice;+ std::vector<std::wstring> parts; std::wstring cur2;+ for (wchar_t ch : n) { if (ch == L'-' || ch == L'_') { if (!cur2.empty()) parts.push_back(cur2); cur2.clear(); } else cur2 += ch; }+ if (!cur2.empty()) parts.push_back(cur2);+ while (!parts.empty() && iswdigit(parts.back()[0])) parts.pop_back();+ for (size_t k = 0; k < parts.size() && k < 3; k++) {+ std::wstring w2 = parts[k];+ if (w2 == L"macos") w2 = L"macOS"; else if (w2 == L"imac") w2 = L"iMac"; else if (w2 == L"macbook") w2 = L"MacBook"; else if (!w2.empty()) w2[0] = towupper(w2[0]);+ nice += (nice.empty() ? L"" : L" ") + w2;+ }+ mac.items.push_back({ f, nice });+ }+ if (!mac.items.empty()) secs.push_back(mac);+ }+ static std::set<std::wstring> openSecs; // seções abertas ("Mostrar Todas")+ const float TW = 104, TH = 64, LABEL = 20, GAP = 12, HEAD = 30;+ for (size_t si = 0; si < secs.size(); si++) {+ std::wstring title = secs[si].title;+ const std::vector<Item>* items = &secs[si].items;+ int perRow = 4;+ bool open = openSecs.count(title) > 0;+ size_t count = open ? items->size() : std::min<size_t>(items->size(), perRow);+ Row grid; grid.kind = Kind::Custom;+ grid.height = HEAD + ((float)((count + perRow - 1) / perRow)) * (TH + LABEL + GAP) + 10;+ grid.draw = [cur, TW, TH, LABEL, GAP, HEAD, count, title, items, open](Ctx& c, D2D1_RECT_F rr) {+ Text(c, title, D2D1::RectF(rr.left + 2, rr.top, rr.right - 160, rr.top + 24), c.bold, c.text);+ if (items->size() > 4) {+ c.body->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_TRAILING);+ Text(c, open ? std::wstring(L"Mostrar Menos") : Fmt(L"Mostrar Todas (%d)", (int)items->size()), D2D1::RectF(rr.right - 200, rr.top, rr.right, rr.top + 24), c.body, c.text2);+ c.body->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);+ }+ rr.top += HEAD;+ int perRow = std::max(1, (int)((rr.right - rr.left + GAP) / (TW + GAP)));+ float tw = (rr.right - rr.left - (perRow - 1) * GAP) / perRow, th = tw * TH / TW;+ for (size_t i = 0; i < count; i++) {+ float x = rr.left + (i % perRow) * (tw + GAP), y = rr.top + (i / perRow) * (th + LABEL + GAP);+ D2D1_RECT_F t = D2D1::RectF(x, y, x + tw, y + th);+ c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.06f) : D2D1::ColorF(0, 0, 0, 0.05f));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(t, 6, 6), c.br);+ const Item& it = (*items)[i];+ if (it.path == L"*adicionar*") { // quadro "Adicionar Foto…": foto com um + no meio+ float cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;+ c.br->SetColor(c.text2);+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 13, cy - 10, cx + 11, cy + 8), 3, 3), c.br, 1.5f);+ c.dc->FillEllipse(D2D1::Ellipse({ cx + 11, cy + 8 }, 7, 7), c.br);+ c.br->SetColor(c.dark ? D2D1::ColorF(0.2f, 0.2f, 0.21f, 1) : D2D1::ColorF(1, 1, 1, 1));+ c.dc->FillRectangle(D2D1::RectF(cx + 10.2f, cy + 4.5f, cx + 11.8f, cy + 11.5f), c.br);+ c.dc->FillRectangle(D2D1::RectF(cx + 7.5f, cy + 7.2f, cx + 14.5f, cy + 8.8f), c.br);+ Text(c, it.label, D2D1::RectF(t.left, t.bottom + 3, t.right, t.bottom + LABEL), c.noteCenter, c.text);+ continue;+ }+ if (ID2D1Bitmap* b = BitmapFromFile(it.path, 256)) {+ auto s2 = b->GetSize();+ float k = std::max(tw / s2.width, th / s2.height);+ float w = s2.width * k, h = s2.height * k, cx = (t.left + t.right) / 2, cy = (t.top + t.bottom) / 2;+ ID2D1Factory* fac = nullptr; c.dc->GetFactory(&fac);+ ID2D1RoundedRectangleGeometry* rg = nullptr; fac->CreateRoundedRectangleGeometry(D2D1::RoundedRect(t, 6, 6), &rg);+ c.dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);+ c.dc->DrawBitmap(b, D2D1::RectF(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);+ c.dc->PopLayer();+ rg->Release(); fac->Release();+ }+ if (_wcsicmp(it.path.c_str(), cur.c_str()) == 0) {+ c.br->SetColor(c.accent);+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 2.5f, t.top - 2.5f, t.right + 2.5f, t.bottom + 2.5f), 8, 8), c.br, 2.5f);+ }+ Text(c, it.label, D2D1::RectF(t.left, t.bottom + 3, t.right, t.bottom + LABEL), c.noteCenter, c.text);+ }+ };+ grid.clickAt = [TW, TH, LABEL, GAP, HEAD, count, title, items](D2D1_POINT_2F pt, D2D1_RECT_F rr) {+ if (pt.y < rr.top + HEAD) {+ if (pt.x > rr.right - 200 && items->size() > 4) { if (openSecs.count(title)) openSecs.erase(title); else openSecs.insert(title); Rebuild(); }+ return;+ }+ rr.top += HEAD;+ int perRow = std::max(1, (int)((rr.right - rr.left + GAP) / (TW + GAP)));+ float tw = (rr.right - rr.left - (perRow - 1) * GAP) / perRow, th = tw * TH / TW;+ int col = (int)((pt.x - rr.left) / (tw + GAP)), row = (int)((pt.y - rr.top) / (th + LABEL + GAP));+ size_t i = (size_t)row * perRow + col;+ if (col < 0 || col >= perRow || i >= count) return;+ if ((*items)[i].path == L"*adicionar*") { AddPhoto(); return; }+ sys::SetWallpaper((*items)[i].path);+ Rebuild();+ };+ Group g; g.box = false; g.rows.push_back(grid);+ p.groups.push_back(g);+ }+ return p;+}++// ================= Notificações+Page Notificacoes() {+ Page p;+ const wchar_t* key = L"Software\\Microsoft\\Windows\\CurrentVersion\\PushNotifications";+ p.groups.push_back(G({ Toggle(L"Permitir notificações",+ [key] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, key, L"ToastEnabled", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v != 0; },+ [key](bool on) { DWORD v = on; RegSetKeyValueW(HKEY_CURRENT_USER, key, L"ToastEnabled", REG_DWORD, &v, sizeof(v)); },+ L"Desligado, os aplicativos não mostram avisos (pode ser preciso reiniciar a sessão).") }));+ p.groups.push_back(G({ Uri(L"Notificações por Aplicativo", L"ms-settings:notifications", 0xEA8F, C_RED) }, L"Notificações dos Aplicativos"));+ // banners e Central de Notificações do WacOS (notificacoes.cpp)+ Row dur = Slider(L"Tempo do banner na tela", 2, 30, [] { return NumSetting(L"notif_duracao", 5); }, SetNum(L"notif_duracao"), L"2 s", L"30 s");+ dur.hasDef = true; dur.def = 5;+ p.groups.push_back(G({ Flag(L"Banners do Mac", L"banners_mac", L"1", L"Os avisos dos aplicativos aparecem no canto de cima, no visual do Mac."), dur,+ Flag(L"Calendário na Central de Notificações", L"central_calendario", L"1"),+ Flag(L"Relógio na Central de Notificações", L"central_relogio", L"1") }, L"Central de Notificações"));+ return p;+}++// ================= Som+int g_soundTab = 0;+Page Som() {+ Page p;+ p.groups.push_back(G({ Link(L"Sons de alerta", [] { ShellExecuteW(nullptr, L"open", L"control.exe", L"mmsys.cpl,,2", nullptr, SW_SHOWNORMAL); }) }, L"Efeitos Sonoros"));+ Row tabs; tabs.kind = Kind::Custom; tabs.height = 44;+ tabs.draw = [](Ctx& c, D2D1_RECT_F rr) {+ float w = 160, cx = (rr.left + rr.right) / 2;+ D2D1_RECT_F seg = D2D1::RectF(cx - w / 2, rr.top + 10, cx + w / 2, rr.top + 34);+ c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.08f) : D2D1::ColorF(0, 0, 0, 0.06f));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(seg, 6, 6), c.br);+ D2D1_RECT_F on = g_soundTab == 0 ? D2D1::RectF(seg.left + 2, seg.top + 2, cx - 1, seg.bottom - 2) : D2D1::RectF(cx + 1, seg.top + 2, seg.right - 2, seg.bottom - 2);+ c.br->SetColor(c.dark ? D2D1::ColorF(1, 1, 1, 0.22f) : D2D1::ColorF(1, 1, 1, 1));+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(on, 5, 5), c.br);+ Text(c, L"Saída", D2D1::RectF(seg.left, seg.top, cx, seg.bottom), c.center, c.text);+ Text(c, L"Entrada", D2D1::RectF(cx, seg.top, seg.right, seg.bottom), c.center, c.text);+ };+ tabs.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) { g_soundTab = pt.x < (rr.left + rr.right) / 2 ? 0 : 1; Rebuild(); };+ Group io = G({ tabs }, L"Saída e Entrada");+ bool out = g_soundTab == 0;+ for (auto& d : sys::AudioDevices(out)) {+ Row r; r.kind = Kind::Custom; r.height = 34;+ std::wstring id = d.id, name = d.name; bool def = d.isDefault;+ r.draw = [name, def](Ctx& c, D2D1_RECT_F rr) {+ D2D1_RECT_F b = D2D1::RectF(rr.left + 6, rr.top + 2, rr.right - 6, rr.bottom - 2);+ if (def) { c.br->SetColor(c.accent); c.dc->FillRoundedRectangle(D2D1::RoundedRect(b, 5, 5), c.br); }+ Text(c, name, D2D1::RectF(b.left + 10, b.top, b.right - 10, b.bottom), c.body, def ? D2D1::ColorF(1, 1, 1, 1) : c.text);+ };+ r.clickAt = [id](D2D1_POINT_2F, D2D1_RECT_F) { sys::SetDefaultAudio(id); Rebuild(); };+ io.rows.push_back(r);+ }+ if (out) {+ Row vol = Slider(L"Volume de saída", 0, 1, [] { return sys::Volume(); }, [](float v) { sys::SetVolume(v); }, std::wstring(1, (wchar_t)0xE993), std::wstring(1, (wchar_t)0xE995));+ Row mute = Toggle(L"Mudo", [] { return sys::Muted(); }, [](bool m) { sys::SetMuted(m); });+ io.rows.push_back(vol);+ io.rows.push_back(mute);+ } else if (sys::InputVolume() >= 0) {+ io.rows.push_back(Slider(L"Volume de entrada", 0, 1, [] { return std::max(0.f, sys::InputVolume()); }, [](float v) { sys::SetInputVolume(v); },+ std::wstring(1, (wchar_t)0xE720), std::wstring(1, (wchar_t)0xE720)));+ }+ p.groups.push_back(io);+ p.groups.push_back(Plain(Buttons({ { L"Mais Ajustes de Som…", [] { OpenUri(L"ms-settings:sound"); } } })));+ return p;+}++// ================= Foco, Tempo de Uso+Page Foco() {+ Page p;+ p.groups.push_back(Plain(Hero(0xE708, C_INDIGO, L"Foco", L"O Foco silencia notificações enquanto você trabalha. No Windows ele se chama Não Incomodar e Sessões de Foco.")));+ p.groups.push_back(G({ Uri(L"Não Incomodar", L"ms-settings:notifications", 0xE708, C_INDIGO), Uri(L"Sessões de Foco", L"ms-clock:", 0xE916, C_INDIGO) }));+ return p;+}+Page TempoUso() {+ Page p;+ p.groups.push_back(Plain(Hero(0xE916, C_INDIGO, L"Tempo de Uso", L"O tempo de uso e os limites ficam no Microsoft Family Safety.")));+ p.groups.push_back(G({ Uri(L"Família e Limites", L"ms-settings:family-group", 0xE716, C_INDIGO), Uri(L"Histórico de Atividades", L"ms-settings:privacy-activityhistory", 0xE81C, C_GRAY) }));+ return p;+}++// ================= Tela Bloqueada+Page TelaBloqueada() {+ Page p;+ // a imagem de fundo da tela de bloqueio do WacOS saiu junto com ela (21/11/2026); fica o que é do Windows+ p.groups.push_back(G({+ Popup(L"Desligar a tela quando inativo", MinuteLabels(L"Após "), [] { return MinuteIndex(sys::DisplayOffMinutes()); }, [](int i) { sys::SetDisplayOffMinutes(MINUTES[i]); }),+ Toggle(L"Exigir senha ao sair do protetor de tela",+ [] { wchar_t v[8] = L"0"; DWORD cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"ScreenSaverIsSecure", RRF_RT_REG_SZ, nullptr, v, &cb); return v[0] == L'1'; },+ [](bool on) { const wchar_t* v = on ? L"1" : L"0"; RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"ScreenSaverIsSecure", REG_SZ, v, 4); }),+ }));+ return p;+}++// ================= Privacidade e Segurança+Page Privacidade() {+ Page p;+ p.groups.push_back(G({ Uri(L"Serviços de Localização", L"ms-settings:privacy-location", 0xE707, C_BLUE),+ Uri(L"Câmera", L"ms-settings:privacy-webcam", 0xE722, C_GRAY),+ Uri(L"Microfone", L"ms-settings:privacy-microphone", 0xE720, C_ORANGE),+ Uri(L"Contatos", L"ms-settings:privacy-contacts", 0xE77B, C_GRAY),+ Uri(L"Calendários", L"ms-settings:privacy-calendar", 0xE787, C_RED),+ Uri(L"Fotos", L"ms-settings:privacy-pictures", 0xE8B9, C_PINK),+ Uri(L"Arquivos e Pastas", L"ms-settings:privacy-documents", 0xE8B7, C_BLUE),+ Uri(L"Acesso Total ao Disco", L"ms-settings:privacy-broadfilesystemaccess", 0xEDA2, C_GRAY) }, L"Privacidade"));+ p.groups.push_back(G({ Uri(L"Análise e Melhorias", L"ms-settings:privacy-feedback", 0xE9D9, C_BLUE),+ Uri(L"Publicidade", L"ms-settings:privacy-general", 0xE789, C_BLUE) }));+ p.groups.push_back(G({ Uri(L"Segurança do Windows", L"windowsdefender:", 0xE83D, C_BLUE),+ Uri(L"Encontrar Meu Dispositivo", L"ms-settings:findmydevice", 0xE707, C_GREEN) }, L"Segurança"));+ return p;+}++// ================= Touch ID e Senha → Windows Hello+Page Senha() {+ Page p;+ p.groups.push_back(Plain(Hero(0xE928, C_PINK, L"Windows Hello e Senha", L"Digital, rosto, PIN e a senha de início de sessão.")));+ p.groups.push_back(G({ Uri(L"Opções de Início de Sessão", L"ms-settings:signinoptions", 0xE928, C_PINK),+ Uri(L"Configurar Digital", L"ms-settings:signinoptions-launchfingerprintenrollment", 0xE928, C_PINK),+ Uri(L"Configurar Rosto", L"ms-settings:signinoptions-launchfaceenrollment", 0xE77B, C_GRAY) }));+ return p;+}++// ================= Usuários e Grupos+Page Usuarios() {+ Page p;+ const sys::Info& inf = sys::About();+ Group g = G({});+ for (auto& u : sys::LocalUsers()) {+ Row r = Value(u, _wcsicmp(u.c_str(), inf.user.c_str()) == 0 ? L"Você" : L"");+ r.icon = 0xE77B; r.iconColor = C_GRAY;+ g.rows.push_back(r);+ }+ if (g.rows.empty()) g.rows.push_back(Value(inf.fullName, L"Você"));+ p.groups.push_back(g);+ p.groups.push_back(Plain(Buttons({ { L"Adicionar Usuário…", [] { OpenUri(L"ms-settings:otherusers"); } } })));+ return p;+}++Page ContasInternet() {+ Page p;+ p.groups.push_back(G({ Uri(L"E-mail e Contas", L"ms-settings:emailandaccounts", L'@', C_BLUE), Uri(L"Contas de Trabalho ou Escola", L"ms-settings:workplace", 0xE821, C_GRAY) }));+ return p;+}+Page Jogos() {+ Page p;+ p.groups.push_back(G({ Uri(L"Barra de Jogo", L"ms-settings:gaming-gamebar", 0xE7FC, C_GREEN), Uri(L"Capturas", L"ms-settings:gaming-gamedvr", 0xE714, C_GRAY),+ Uri(L"Modo de Jogo", L"ms-settings:gaming-gamemode", 0xE945, C_GREEN) }));+ return p;+}+Page Nuvem() {+ Page p;+ p.groups.push_back(Plain(Hero(0xE753, C_CYAN, L"OneDrive", L"No Windows, a nuvem dos seus arquivos e fotos é o OneDrive.")));+ p.groups.push_back(G({ Uri(L"Backup do Windows", L"ms-settings:backup", 0xE753, C_CYAN) }));+ return p;+}++// ================= Teclado, Mouse, Trackpad, Impressoras+// Captura de Tela: onde as capturas vão (issue #8, 21/11/2026: "não encontrei a opção na configuração"). O app de+// captura guarda as opções em %APPDATA%\Shell\captura.txt (destino=0 Mesa, 1 Documentos, 2 Área de Transferência,+// 3 Imagens › Capturas de Tela (o padrão), 4 Outro Local com outro=<pasta>); aqui lê e grava só essas duas linhas.+static std::wstring CapturaTxt() {+ PWSTR p = nullptr; std::wstring d;+ if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) { d = std::wstring(p) + L"\\Shell\\captura.txt"; CoTaskMemFree(p); }+ return d;+}+static std::vector<std::wstring> CapturaLinhas() {+ std::vector<std::wstring> v;+ FILE* f = nullptr;+ if (_wfopen_s(&f, CapturaTxt().c_str(), L"r, ccs=UTF-8") || !f) return v;+ wchar_t line[1024];+ while (fgetws(line, 1024, f)) {+ std::wstring l = line;+ while (!l.empty() && (l.back() == L'\n' || l.back() == L'\r')) l.pop_back();+ if (!l.empty() && l[0] == 0xFEFF) l.erase(0, 1);+ if (!l.empty()) v.push_back(l);+ }+ fclose(f);+ return v;+}+static std::wstring CapturaValor(const wchar_t* key, const wchar_t* def) {+ std::wstring k = std::wstring(key) + L"=";+ for (auto& l : CapturaLinhas()) if (l.rfind(k, 0) == 0) return l.substr(k.size());+ return def;+}+static void CapturaGravar(int dest, const std::wstring* outro) {+ auto v = CapturaLinhas();+ v.erase(std::remove_if(v.begin(), v.end(), [&](const std::wstring& l) { return l.rfind(L"destino=", 0) == 0 || (outro && l.rfind(L"outro=", 0) == 0); }), v.end());+ v.push_back(L"destino=" + std::to_wstring(dest));+ if (outro) v.push_back(L"outro=" + *outro);+ std::wstring path = CapturaTxt();+ SHCreateDirectoryExW(nullptr, path.substr(0, path.find_last_of(L'\\')).c_str(), nullptr);+ FILE* f = nullptr;+ if (_wfopen_s(&f, path.c_str(), L"w, ccs=UTF-8") || !f) return;+ for (auto& l : v) fwprintf(f, L"%ls\n", l.c_str());+ fclose(f);+}+static bool EscolherPastaCaptura(std::wstring& out) {+ IFileOpenDialog* d = nullptr;+ if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&d)))) return false;+ DWORD o = 0; d->GetOptions(&o); d->SetOptions(o | FOS_PICKFOLDERS | FOS_FORCEFILESYSTEM);+ d->SetTitle(Tr(L"Salvar Capturas de Tela em"));+ bool ok = false;+ if (SUCCEEDED(d->Show(Window()))) {+ IShellItem* it = nullptr;+ if (SUCCEEDED(d->GetResult(&it))) {+ PWSTR p = nullptr;+ if (SUCCEEDED(it->GetDisplayName(SIGDN_FILESYSPATH, &p))) { out = p; CoTaskMemFree(p); ok = true; }+ it->Release();+ }+ }+ d->Release();+ return ok;+}++Page Teclado() {+ Page p;+ {+ // ordem do menu: Mesa, Documentos, Imagens › Capturas de Tela, Área de Transferência, Outro Local+ static const int kDest[5] = { 0, 1, 3, 2, 4 };+ std::wstring outro = CapturaValor(L"outro", L"");+ std::wstring outroNome = outro.empty() ? std::wstring(Tr(L"Outro Local…")) : std::wstring(PathFindFileNameW(outro.c_str()));+ p.groups.push_back(G({ Popup(L"Salvar em", { L"Mesa", L"Documentos", L"Imagens › Capturas de Tela", L"Área de Transferência", outroNome },+ [] {+ int d = _wtoi(CapturaValor(L"destino", L"3").c_str());+ for (int i = 0; i < 5; i++) if (kDest[i] == d) return i;+ return 2;+ },+ [](int i) {+ int d = kDest[std::clamp(i, 0, 4)];+ if (d == 4) {+ std::wstring pasta;+ if (!EscolherPastaCaptura(pasta)) { Rebuild(); return; }+ CapturaGravar(4, &pasta);+ } else CapturaGravar(d, nullptr);+ Rebuild();+ }),+ Note(L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.") },+ L"Capturas de Tela"));+ }+ p.groups.push_back(G({+ Slider(L"Repetição de tecla", 0, 31, [] { return (float)sys::KeyRepeat(); }, [](float v) { sys::SetKeyRepeat((int)std::lround(v)); }, L"Lenta", L"Rápida"),+ Slider(L"Atraso até repetir", 0, 3, [] { return (float)(3 - sys::KeyDelay()); }, [](float v) { sys::SetKeyDelay(3 - (int)std::lround(v)); }, L"Longo", L"Curto"),+ }));+ p.groups.push_back(G({ Uri(L"Fontes de Entrada", L"ms-settings:keyboard", 0xE765, C_GRAY), Uri(L"Ditado", L"ms-settings:speech", 0xE720, C_GRAY),+ Uri(L"Digitação", L"ms-settings:typing", 0xE765, C_GRAY) }, L"Entrada de Texto"));+ p.groups.push_back(G({ Toggle(L"Atalhos do Mac para apps", [] { return Setting(L"atalhos_mac", L"1") == L"1"; },+ [](bool on) { SetSetting(L"atalhos_mac", on ? L"1" : L"0"); }),+ Note(L"Win+Q encerra o app, Win+H oculta o app e Win+W fecha a janela, como Command no Mac. Desligado, esses atalhos voltam ao Windows.") },+ L"Atalhos"));+ return p;+}+Page Mouse() {+ Page p;+ p.groups.push_back(G({+ Slider(L"Velocidade de rastreamento", 1, 20, [] { return (float)sys::MouseSpeed(); }, [](float v) { sys::SetMouseSpeed((int)std::lround(v)); }, L"Lenta", L"Rápida"),+ Slider(L"Velocidade do clique duplo", 200, 900, [] { return (float)(1100 - sys::DoubleClickMs()); }, [](float v) { sys::SetDoubleClickMs(1100 - (int)std::lround(v)); }, L"Lenta", L"Rápida"),+ Slider(L"Velocidade de rolagem", 1, 20, [] { return (float)sys::WheelLines(); }, [](float v) { sys::SetWheelLines((int)std::lround(v)); }, L"Lenta", L"Rápida"),+ Popup(L"Clique secundário", { L"Clicar no Lado Direito", L"Clicar no Lado Esquerdo" }, [] { return sys::ButtonsSwapped() ? 1 : 0; }, [](int i) { sys::SetButtonsSwapped(i == 1); }),+ }));+ p.groups.push_back(Plain(Buttons({ { L"Avançado…", [] { OpenUri(L"ms-settings:mousetouchpad"); } } })));+ return p;+}+Page Trackpad() {+ Page p;+ p.groups.push_back(G({ Uri(L"Toque e Gestos", L"ms-settings:devices-touchpad", 0xEFA5, C_GRAY) }));+ return p;+}+Page Impressoras() {+ Page p;+ auto list = sys::Printers();+ if (!list.empty()) {+ std::vector<std::wstring> opts = list;+ p.groups.push_back(G({ Popup(L"Impressora padrão", opts, [list] { auto d = sys::DefaultPrinter(); for (int i = 0; i < (int)list.size(); i++) if (list[i] == d) return i; return -1; },+ [list](int i) { sys::SetPrinterDefault(list[i]); }) }));+ Group g = G({}, L"Impressoras");+ for (auto& n : list) { Row r = Value(n, L""); r.icon = 0xE749; r.iconColor = C_GRAY; g.rows.push_back(r); }+ p.groups.push_back(g);+ } else p.groups.push_back(G({ Note(L"Nenhuma impressora.") }));+ p.groups.push_back(Plain(Buttons({ { L"Adicionar Impressora, Scanner ou Fax…", [] { OpenUri(L"ms-settings:printers"); } } })));+ return p;+}++} // namespace++// ================= Experimental: o que ainda está em teste, num lugar só (pedido do usuário, 23/11/2026)+static void ReiniciaShell() {+ static UINT msg = RegisterWindowMessageW(L"ShellReiniciar");+ HWND sh = FindWindowExW(HWND_MESSAGE, nullptr, L"ShellMensagens", nullptr);+ if (!sh) sh = FindWindowW(L"ShellMensagens", nullptr);+ if (sh) PostMessageW(sh, msg, 0, 0);+}+Page Experimental() {+ Page p;+ p.groups.push_back(Plain(Hero(0xE945, C_ORANGE, L"Experimental", L"Recursos que ainda estão em teste. Podem mudar ou ter falhas: ligue para experimentar e conte o que achou no GitHub do WacOS.")));+ // a barra de título do Mac nos programas do Windows (WacOSWindow.dll): ligada por padrão; desligar reinicia o Shell+ Row tit = Toggle(L"Barra de título do Mac em todos os apps", [] { return Setting(L"janelas_mac", L"1") != L"0"; },+ [](bool v) { SetSetting(L"janelas_mac", v ? L"1" : L"0"); ReiniciaShell(); },+ L"Os programas do Windows ganham a barra de título e os três botões do Mac. Ao mudar, o WacOS reinicia (os apps continuam abertos).");+ // Edge, Chrome, Figma, Discord, VS Code...: os três botões do Mac na barra deles; desligado por padrão (22/11/2026)+ Row propria = Toggle(L"Botões do Mac nos apps com barra própria", [] { return Setting(L"barra_mac_propria", L"0") == L"1"; },+ [](bool v) { SetSetting(L"barra_mac_propria", v ? L"1" : L"0"); },+ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.");+ p.groups.push_back(G({ tit, propria }, L"Janelas"));+ Row shellWin = Toggle(L"Abrir no lugar da área de trabalho do Windows", [] { return ShellDoWindows(); }, [](bool on) { SetShellDoWindows(on); Rebuild(); },+ L"O WacOS abre já no login, sem a área de trabalho do Windows piscar antes. Vale no próximo login.");+ p.groups.push_back(G({ shellWin }, L"Sistema"));+ return p;+}++std::vector<SideItem>& SidebarItems() {+ static std::vector<SideItem> items;+ if (!items.empty()) return items;+ bool battery = sys::HasBattery(nullptr, nullptr);+ items = {+ { L"Wi‑Fi", 0xE701, C_BLUE, WiFi, 0, L"wifi rede sem fio internet", L"wifi" },+ { L"Bluetooth", 0xE702, C_BLUE, Bluetooth, 0, L"fone mouse teclado dispositivos", L"bluetooth" },+ { L"Rede", 0xE774, C_BLUE, Rede, 0, L"ethernet internet ip firewall vpn proxy", L"rede" },+ { battery ? L"Bateria" : L"Energia", (wchar_t)(battery ? 0xE83F : 0xE945), C_GREEN, Energia, 0, L"energia bateria repouso suspender modo desempenho", L"energia" },+ { L"Geral", 0xE713, C_GRAY, Geral, 1, L"sobre atualização armazenamento data hora idioma início", L"geral" },+ { L"Acessibilidade", 0xE776, C_BLUE, Acessibilidade, 1, L"narrador lupa legendas", L"acessibilidade" },+ { L"Aparência", 1, 0x1C1C1E, Aparencia, 1, L"tema escuro claro destaque cor", L"aparencia" },+ { L"Apple Intelligence e Siri", 0xE720, C_PURPLE, Inteligencia, 1, L"copilot fala voz assistente", L"inteligencia" },+ { L"Central de Controle", 0xE9E9, C_GRAY, CentralControle, 1, L"barra de menus relógio ícones microfone câmera", L"central" },+ { L"Ilha Dinâmica", 0xE7F4, 0x1C1C1E, IlhaDinamica, 1, L"notch ilha dinâmica música timer copiado estante", L"ilha" },+ { L"Mesa e Dock", 0xE7F4, 0x1C1C1E, MesaDock, 1, L"dock tamanho ampliação ocultar janelas", L"dock" },+ { L"Telas", 0xE706, C_BLUE, Telas, 1, L"monitor brilho resolução escala night shift", L"telas" },+ { L"Protetor de Tela", 0xE8B9, C_CYAN, Protetor, 1, L"proteção de tela", L"protetor" },+ { L"Spotlight", 0xE721, C_GRAY, Spotlight, 1, L"pesquisa busca índice", L"spotlight" },+ { L"Imagem de Fundo", 0xE771, C_TEAL, Fundo, 1, L"papel de parede wallpaper", L"fundo" },+ { L"Notificações", 0xEA8F, C_RED, Notificacoes, 2, L"avisos alertas", L"notificacoes" },+ { L"Som", 0xE767, C_PINK, Som, 2, L"volume saída entrada alto-falante microfone", L"som" },+ { L"Foco", 0xE708, C_INDIGO, Foco, 2, L"não incomodar", L"foco" },+ { L"Tempo de Uso", 0xE916, C_INDIGO, TempoUso, 2, L"família limites", L"tempo" },+ { L"Tela Bloqueada", 0xE72E, 0x1C1C1E, TelaBloqueada, 3, L"bloqueio senha protetor", L"bloqueio" },+ { L"Privacidade e Segurança", 0xE8D7, C_BLUE, Privacidade, 3, L"localização câmera microfone permissões segurança", L"privacidade" },+ { L"Touch ID e Senha", 0xE928, C_PINK, Senha, 3, L"windows hello digital pin senha", L"senha" },+ { L"Usuários e Grupos", 0xE716, C_BLUE, Usuarios, 3, L"contas usuários", L"usuarios" },+ { L"Contas de Internet", L'@', C_BLUE, ContasInternet, 4, L"email e-mail contas", L"contas" },+ { L"Game Center", 0xE7FC, C_GREEN, Jogos, 4, L"jogos xbox", L"jogos" },+ { L"iCloud", 0xE753, C_CYAN, Nuvem, 4, L"onedrive nuvem backup", L"nuvem" },+ { L"Teclado", 0xE765, C_GRAY, Teclado, 5, L"repetição teclas digitação", L"teclado" },+ { L"Mouse", 0xE962, C_GRAY, Mouse, 5, L"rastreamento clique rolagem", L"mouse" },+ { L"Trackpad", 0xEFA5, C_GRAY, Trackpad, 5, L"touchpad gestos", L"trackpad" },+ { L"Impressoras e Scanners", 0xE749, C_GRAY, Impressoras, 5, L"imprimir scanner", L"impressoras" },+ { L"Experimental", 0xE945, C_ORANGE, Experimental, 6, L"experimental teste beta barra de título botões shell login", L"experimental" },+ { L"Conta", 0xE77B, C_GRAY, Conta, 9, L"conta usuário perfil", L"conta" },+ };+ return items;+}++// SF Symbol usado no Ajustes do Sequoia para cada item (nome do .svg em icones\simbolos)+std::wstring SymbolFor(const std::wstring& label) {+ static const std::map<std::wstring, std::wstring> m = {+ { L"Wi‑Fi", L"wifi" }, { L"Rede", L"globe" }, { L"Energia", L"bolt.fill" }, { L"Bateria", L"battery.100percent" },+ { L"Geral", L"gearshape.fill" }, { L"Experimental", L"sparkles" }, { L"Acessibilidade", L"accessibility" }, { L"Aparência", L"circle.lefthalf.filled" },+ { L"Apple Intelligence e Siri", L"apple.intelligence" }, { L"Assistente e Fala", L"apple.intelligence" }, { L"Central de Controle", L"switch.2" },+ { L"Ilha Dinâmica", L"menubar.dock.rectangle" }, { L"Mostrar o uso do microfone e da câmera", L"microphone.fill" },+ { L"Mesa e Dock", L"dock.rectangle" }, { L"Telas", L"sun.max.fill" }, { L"Protetor de Tela", L"photo.on.rectangle.angled" },+ { L"Spotlight", L"magnifyingglass" }, { L"Imagem de Fundo", L"camera.macro" }, { L"Notificações", L"bell.badge.fill" },+ { L"Som", L"speaker.wave.3.fill" }, { L"Foco", L"moon.fill" }, { L"Tempo de Uso", L"hourglass" }, { L"Tela Bloqueada", L"lock.fill" },+ { L"Privacidade e Segurança", L"hand.raised.fill" }, { L"Touch ID e Senha", L"touchid" }, { L"Windows Hello e Senha", L"touchid" },+ { L"Usuários e Grupos", L"person.2.fill" }, { L"Contas de Internet", L"at" }, { L"Game Center", L"gamecontroller.fill" },+ { L"iCloud", L"icloud.fill" }, { L"OneDrive", L"icloud.fill" }, { L"Teclado", L"keyboard.fill" }, { L"Mouse", L"computermouse.fill" },+ { L"Trackpad", L"rectangle.and.hand.point.up.left.fill" }, { L"Impressoras e Scanners", L"printer.fill" },+ // linhas das páginas+ { L"Sobre", L"desktopcomputer" }, { L"Atualização de Software", L"gear.badge" }, { L"Armazenamento", L"internaldrive.fill" },+ { L"Compartilhamento por Proximidade", L"airplay.audio" }, { L"Itens de Início", L"list.bullet" }, { L"Idioma e Região", L"globe" },+ { L"Data e Hora", L"calendar.badge.clock" }, { L"Compartilhamento", L"square.and.arrow.up.fill" },+ { L"Histórico de Arquivos", L"clock.arrow.trianglehead.counterclockwise.rotate.90" }, { L"Transferir ou Redefinir", L"arrow.counterclockwise" },+ { L"Narrador", L"person.wave.2.fill" }, { L"Lupa", L"plus.magnifyingglass" }, { L"Tela", L"display" }, { L"Tamanho do Texto", L"textformat.size" },+ { L"Filtros de Cor", L"camera.filters" }, { L"Áudio", L"speaker.wave.2.fill" }, { L"Legendas", L"captions.bubble.fill" },+ { L"Controle por Voz", L"microphone.fill" }, { L"Ponteiro do Mouse", L"cursorarrow.rays" },+ { L"Transparência e Efeitos", L"sparkles" }, { L"Copilot", L"apple.intelligence" }, { L"Fala", L"microphone.fill" },+ { L"Spotlight ", L"magnifyingglass" }, { L"Ícones dos aplicativos", L"square.grid.2x2.fill" }, { L"Relógio", L"clock.arrow.trianglehead.counterclockwise.rotate.90" },+ { L"Firewall", L"shield.lefthalf.filled" }, { L"VPN", L"network" }, { L"Proxies", L"network" },+ { L"Informações Pessoais", L"person.fill" }, { L"Início de Sessão e Segurança", L"lock.shield.fill" }, { L"E-mail e Contas", L"at" },+ { L"Família", L"person.2.fill" }, { L"Backup do Windows (OneDrive)", L"icloud.fill" }, { L"Backup do Windows", L"icloud.fill" },+ { L"Serviços de Localização", L"location.fill" }, { L"Câmera", L"camera.fill" }, { L"Microfone", L"microphone.fill" },+ { L"Contatos", L"person.crop.circle" }, { L"Calendários", L"calendar" }, { L"Fotos", L"photo.fill" }, { L"Arquivos e Pastas", L"folder.fill" },+ { L"Acesso Total ao Disco", L"externaldrive.fill" }, { L"Análise e Melhorias", L"chart.bar.fill" }, { L"Publicidade", L"megaphone.fill" },+ { L"Segurança do Windows", L"lock.shield.fill" }, { L"Encontrar Meu Dispositivo", L"location.circle.fill" },+ { L"Opções de Início de Sessão", L"touchid" }, { L"Configurar Digital", L"touchid" }, { L"Configurar Rosto", L"faceid" },+ { L"Imagem e Mensagem da Tela de Bloqueio", L"lock.rectangle.fill" }, { L"Notificações por Aplicativo", L"bell.badge.fill" },+ { L"Não Incomodar", L"moon.fill" }, { L"Sessões de Foco", L"timer" }, { L"Família e Limites", L"hourglass" },+ { L"Histórico de Atividades", L"clock.arrow.trianglehead.counterclockwise.rotate.90" },+ { L"Contas de Trabalho ou Escola", L"briefcase.fill" }, { L"Barra de Jogo", L"gamecontroller.fill" }, { L"Capturas", L"record.circle.fill" },+ { L"Modo de Jogo", L"bolt.fill" }, { L"Fontes de Entrada", L"keyboard.fill" }, { L"Ditado", L"microphone.fill" }, { L"Digitação", L"keyboard" },+ { L"Toque e Gestos", L"rectangle.and.hand.point.up.left.fill" },+ };+ auto it = m.find(label);+ if (it != m.end()) return it->second;+ return L"";+}++// --pagina=atualizacao (o aviso de versão nova do Shell): Geral > Atualização de Software+void OpenUpdatePage() { aj::Push(L"Atualização de Software", Atualizacao); }++int SidebarIndexFor(const std::wstring& idOrUri) {+ auto& items = SidebarItems();+ std::wstring id = idOrUri;+ // links ms-settings: → página equivalente+ static const std::pair<const wchar_t*, const wchar_t*> uris[] = {+ { L"ms-settings:network-wifi", L"wifi" }, { L"ms-settings:bluetooth", L"bluetooth" }, { L"ms-settings:network", L"rede" },+ { L"ms-settings:powersleep", L"energia" }, { L"ms-settings:batterysaver", L"energia" }, { L"ms-settings:about", L"geral" },+ { L"ms-settings:easeofaccess", L"acessibilidade" }, { L"ms-settings:colors", L"aparencia" }, { L"ms-settings:personalization-colors", L"aparencia" },+ { L"ms-settings:taskbar", L"dock" }, { L"ms-settings:display", L"telas" }, { L"ms-settings:lockscreen", L"bloqueio" },+ { L"ms-settings:personalization-background", L"fundo" }, { L"ms-settings:personalization", L"fundo" }, { L"ms-settings:notifications", L"notificacoes" },+ { L"ms-settings:sound", L"som" }, { L"ms-settings:quiethours", L"foco" }, { L"ms-settings:privacy", L"privacidade" },+ { L"ms-settings:signinoptions", L"senha" }, { L"ms-settings:otherusers", L"usuarios" }, { L"ms-settings:yourinfo", L"conta" },+ { L"ms-settings:emailandaccounts", L"contas" }, { L"ms-settings:gaming", L"jogos" }, { L"ms-settings:typing", L"teclado" },+ { L"ms-settings:keyboard", L"teclado" }, { L"ms-settings:mousetouchpad", L"mouse" }, { L"ms-settings:devices-touchpad", L"trackpad" },+ { L"ms-settings:printers", L"impressoras" }, { L"ms-settings:dateandtime", L"geral" }, { L"ms-settings:windowsupdate", L"geral" },+ { L"ms-settings:storagesense", L"geral" }, { L"ms-settings:search", L"spotlight" } };+ if (id.rfind(L"ms-settings:", 0) == 0) {+ std::wstring best;+ size_t len = 0;+ for (auto& [u, pid] : uris) { size_t n = wcslen(u); if (id.compare(0, n, u) == 0 && n > len) { len = n; best = pid; } }+ id = best.empty() ? L"geral" : best;+ }+ for (int i = 0; i < (int)items.size(); i++) if (items[i].id == id) return i;+ return -1;+}diff --cc src/shell/menubar.cppindex 71c73b2,f035131..1d2b007--- a/src/shell/menubar.cpp+++ b/src/shell/menubar.cpp@@@ -1,1835 -1,1578 +1,1900 @@@-// Barra de menus no topo, como no macOS Sequoia: logo (menu do sistema), nome do app ativo em-// negrito, menus do app; à direita os ícones de status (bandeja), rede, Spotlight, Central de-// Controle e relógio. Ver docs/dock-e-barra-de-menus.md.-#include "shell.h"-#include "../comum/simbolos.h"-#include "../menu/context_menu.h"-#include <shellapi.h>-#include <dwmapi.h>-#include <wincodec.h>-#include <shlobj.h>-#include <powrprof.h>-#include <wlanapi.h>-#include <mmdeviceapi.h>-#include <endpointvolume.h>-#include <bluetoothapis.h>-#include <propsys.h>-#pragma comment(lib, "bthprops.lib")-#include <shellscalingapi.h>-#include <iphlpapi.h>-#pragma comment(lib, "iphlpapi.lib")-#include <algorithm>-#include <cmath>-#include <map>-#include "../comum/idioma.h"--namespace {--const float BAR_PT_SEQUOIA = 26; // altura da barra (telas sem entalhe; um pouco maior que os 24 pt do Mac, para telas grandes)-// Tahoe: 30 pt, medido no macOS 26 (guia macOS26-Theme-Reference, seções 13 e 35: frame.maxY − visibleFrame.maxY)-// Leopard: 22 pt, a barra do Mac OS X 10.5-#define BAR_PT (liquid::On() ? 30.f : liquid::Leopard() ? 22.f : BAR_PT_SEQUOIA)-const float PAD_SEQUOIA = 10; // espaço de cada lado de um ícone de status (Mac: ~10 pt, um item a cada ~38 pt)-// Tahoe (guia, seção 35): cada item da direita = o ícone + ~8 pt de respiro de cada lado (31–42 pt por item)-#define PAD (liquid::On() ? 8.f : PAD_SEQUOIA)--bool g_overflow; // macOS 27: algum ícone da bandeja não coube na barra (mostra a »)-enum Kind { K_LOGO, K_APP, K_MENU, K_TRAY, K_NET, K_SPOT, K_CC, K_CLOCK, K_MORE, K_BATT, K_SOUND, K_BT, K_INPUT };-struct Hit { D2D1_RECT_F r; Kind kind; int index; };--HWND g_bar, g_owner; // g_bar: a barra do monitor principal-// Uma barra em cada monitor (como no Mac), todas com o mesmo conteúdo. Cada uma tem a sua superfície e os-// seus itens clicáveis; g_cur é a que está sendo desenhada/clicada agora (nullptr = a principal), e g_s/g_hits-// apontam para as dela.-struct BarState { ui::Surface s; std::vector<Hit> hits; };-std::map<HWND, BarState> g_state;-std::vector<HWND> g_extras; // barras dos outros monitores-HWND g_cur, g_openBar;-HWND Cur() { return g_cur ? g_cur : g_bar; }-#define g_s (g_state[Cur()].s)-#define g_hits (g_state[Cur()].hits)-int g_open = -1; // índice em g_hits do item com menu aberto (na barra g_openBar)-HWND g_fg; // janela do app ativo (fora as nossas)-std::wstring g_appName = L"Finder";-std::vector<std::wstring> g_titles; // menus do app ativo-HMENU g_hmenu; // menu Win32 real do app (se tiver)-bool g_finderActive = true;-IDWriteTextFormat *g_tf, *g_tfBold, *g_tfIcon, *g_tfBadge;--// Como no Mac, a barra mostra pouca coisa: os ícones de bandeja só aparecem se o usuário fixar-// ("Mostrar na barra de menus"); os outros ficam na lista da setinha. Guardados pelo nome (dica).-std::vector<std::wstring> Shown() {- std::vector<std::wstring> v;- std::wstring s = shell::Setting(L"barra_icones", L"");- size_t a = 0, b;- while ((b = s.find(L'|', a)) != std::wstring::npos) { if (b > a) v.push_back(s.substr(a, b - a)); a = b + 1; }- if (a < s.size()) v.push_back(s.substr(a));- return v;-}-std::wstring TrayKey(const TrayIcon& t) { // nome estável: a dica até a primeira quebra de linha ou ":"- std::wstring k = t.tip.substr(0, t.tip.find_first_of(L"\r\n:"));- while (!k.empty() && k.back() == L' ') k.pop_back();- return k;-}-bool IsShown(const TrayIcon& t) {- if (shell::Setting(L"barra_icones_todos", L"0") == L"1") return true; // Central de Controle: "Sempre na barra de menus"- std::wstring k = TrayKey(t);- for (auto& s : Shown()) if (!_wcsicmp(s.c_str(), k.c_str())) return true;- return false;-}-void SetShown(const TrayIcon& t, bool on) {- auto v = Shown();- std::wstring k = TrayKey(t);- v.erase(std::remove_if(v.begin(), v.end(), [&](const std::wstring& x) { return !_wcsicmp(x.c_str(), k.c_str()); }), v.end());- if (on) v.push_back(k);- std::wstring out;- for (auto& x : v) { if (!out.empty()) out += L"|"; out += x; }- shell::SetSetting(L"barra_icones", out);-}--std::wstring Clean(const wchar_t* s, std::wstring* shortcut = nullptr) {- std::wstring out;- for (const wchar_t* p = s; *p; p++) {- if (*p == L'\t') { if (shortcut) *shortcut = p + 1; break; }- if (*p == L'&') { if (p[1] == L'&') { out += L'&'; p++; } continue; }- out += *p;- }- return out;-}--// ---- teclas para os menus genéricos (apps sem menu Win32): mandadas ao app ativo-void SendKeys(std::initializer_list<WORD> keys) {- std::vector<INPUT> in;- for (WORD k : keys) { INPUT i{ INPUT_KEYBOARD }; i.ki.wVk = k; in.push_back(i); }- for (auto it = std::rbegin(keys); it != std::rend(keys); ++it) { INPUT i{ INPUT_KEYBOARD }; i.ki.wVk = *it; i.ki.dwFlags = KEYEVENTF_KEYUP; in.push_back(i); }- SendInput((UINT)in.size(), in.data(), sizeof(INPUT));-}--struct KeyCmd { int id; const wchar_t* label; const wchar_t* shortcut; std::initializer_list<WORD> keys; };-// ids 1000+: atalhos de teclado mandados ao app-const KeyCmd g_keyCmds[] = {- { 1001, L"Nova Janela", L"Ctrl+N", { VK_CONTROL, 'N' } },- { 1002, L"Abrir…", L"Ctrl+O", { VK_CONTROL, 'O' } },- { 1003, L"Fechar Janela", L"Ctrl+W", { VK_CONTROL, 'W' } },- { 1004, L"Salvar", L"Ctrl+S", { VK_CONTROL, 'S' } },- { 1005, L"Imprimir…", L"Ctrl+P", { VK_CONTROL, 'P' } },- { 1010, L"Desfazer", L"Ctrl+Z", { VK_CONTROL, 'Z' } },- { 1011, L"Refazer", L"Ctrl+Y", { VK_CONTROL, 'Y' } },- { 1012, L"Recortar", L"Ctrl+X", { VK_CONTROL, 'X' } },- { 1013, L"Copiar", L"Ctrl+C", { VK_CONTROL, 'C' } },- { 1014, L"Colar", L"Ctrl+V", { VK_CONTROL, 'V' } },- { 1015, L"Selecionar Tudo", L"Ctrl+A", { VK_CONTROL, 'A' } },- { 1016, L"Buscar", L"Ctrl+F", { VK_CONTROL, 'F' } },- { 1020, L"Nova Aba", L"Ctrl+T", { VK_CONTROL, 'T' } },- { 1021, L"Nova Pasta", L"Ctrl+Shift+N", { VK_CONTROL, VK_SHIFT, 'N' } },- { 1022, L"Obter Informações", L"Ctrl+I", { VK_CONTROL, 'I' } },- { 1023, L"Mover para o Lixo", L"Delete", { VK_DELETE } },- { 1030, L"como Ícones", L"Ctrl+1", { VK_CONTROL, '1' } },- { 1031, L"como Lista", L"Ctrl+2", { VK_CONTROL, '2' } },- { 1032, L"como Colunas", L"Ctrl+3", { VK_CONTROL, '3' } },- { 1033, L"como Galeria", L"Ctrl+4", { VK_CONTROL, '4' } },- { 1034, L"Mostrar Opções de Visualização", L"Ctrl+J", { VK_CONTROL, 'J' } },- { 1040, L"Voltar", L"Alt+←", { VK_MENU, VK_LEFT } },- { 1041, L"Avançar", L"Alt+→", { VK_MENU, VK_RIGHT } },- { 1042, L"Pasta Superior", L"Ctrl+↑", { VK_CONTROL, VK_UP } },- { 1043, L"Ir para a Pasta…", L"Ctrl+Shift+G", { VK_CONTROL, VK_SHIFT, 'G' } },- { 1050, L"Ajuda", L"F1", { VK_F1 } },- { 1051, L"Ajustes…", L"Ctrl+,", { VK_CONTROL, VK_OEM_COMMA } },- // menus próprios dos apps sem menu Win32 (AppMenus): os atalhos do Windows de cada um- { 5001, L"Nova Janela Anônima", L"Ctrl+Shift+N", { VK_CONTROL, VK_SHIFT, 'N' } },- { 5002, L"Reabrir Aba Fechada", L"Ctrl+Shift+T", { VK_CONTROL, VK_SHIFT, 'T' } },- { 5003, L"Abrir Arquivo…", L"Ctrl+O", { VK_CONTROL, 'O' } },- { 5004, L"Abrir Local…", L"Ctrl+L", { VK_CONTROL, 'L' } },- { 5005, L"Fechar Janela", L"Ctrl+Shift+W", { VK_CONTROL, VK_SHIFT, 'W' } },- { 5006, L"Fechar Aba", L"Ctrl+W", { VK_CONTROL, 'W' } },- { 5007, L"Salvar Página Como…", L"Ctrl+S", { VK_CONTROL, 'S' } },- { 5010, L"Sempre Mostrar a Barra de Favoritos", L"Ctrl+Shift+B", { VK_CONTROL, VK_SHIFT, 'B' } },- { 5011, L"Parar", L"Esc", { VK_ESCAPE } },- { 5012, L"Recarregar Esta Página", L"Ctrl+R", { VK_CONTROL, 'R' } },- { 5013, L"Forçar Recarregamento", L"Ctrl+Shift+R", { VK_CONTROL, VK_SHIFT, 'R' } },- { 5014, L"Entrar em Tela Cheia", L"F11", { VK_F11 } },- { 5015, L"Tamanho Real", L"Ctrl+0", { VK_CONTROL, '0' } },- { 5016, L"Ampliar", L"Ctrl+=", { VK_CONTROL, VK_OEM_PLUS } },- { 5017, L"Reduzir", L"Ctrl+-", { VK_CONTROL, VK_OEM_MINUS } },- { 5018, L"Ferramentas do Desenvolvedor", L"Ctrl+Shift+I", { VK_CONTROL, VK_SHIFT, 'I' } },- { 5019, L"Ver Código-Fonte", L"Ctrl+U", { VK_CONTROL, 'U' } },- { 5020, L"Página Inicial", L"Alt+Home", { VK_MENU, VK_HOME } },- { 5021, L"Mostrar Histórico Completo", L"Ctrl+H", { VK_CONTROL, 'H' } },- { 5022, L"Limpar Dados de Navegação…", L"Ctrl+Shift+Del", { VK_CONTROL, VK_SHIFT, VK_DELETE } },- { 5030, L"Gerenciador de Favoritos", L"Ctrl+Shift+O", { VK_CONTROL, VK_SHIFT, 'O' } },- { 5031, L"Adicionar Esta Página aos Favoritos…", L"Ctrl+D", { VK_CONTROL, 'D' } },- { 5032, L"Adicionar Todas as Abas aos Favoritos…", L"Ctrl+Shift+D", { VK_CONTROL, VK_SHIFT, 'D' } },- { 5040, L"Selecionar Próxima Aba", L"Ctrl+Tab", { VK_CONTROL, VK_TAB } },- { 5041, L"Selecionar Aba Anterior", L"Ctrl+Shift+Tab", { VK_CONTROL, VK_SHIFT, VK_TAB } },- { 5050, L"Downloads", L"Ctrl+J", { VK_CONTROL, 'J' } },- { 5051, L"Gerenciador de Tarefas", L"Shift+Esc", { VK_SHIFT, VK_ESCAPE } },- { 5060, L"Central de Ajuda", L"F1", { VK_F1 } },- { 5070, L"Refazer", L"Ctrl+Shift+Z", { VK_CONTROL, VK_SHIFT, 'Z' } },- { 5071, L"Recarregar", L"Ctrl+R", { VK_CONTROL, 'R' } },- { 5072, L"Busca Rápida", L"Ctrl+K", { VK_CONTROL, 'K' } },- { 5073, L"Atalhos de Teclado", L"Ctrl+/", { VK_CONTROL, VK_DIVIDE } },- { 5080, L"Nova Conversa", L"Ctrl+N", { VK_CONTROL, 'N' } },- { 5081, L"Novo Grupo", L"Ctrl+Shift+N", { VK_CONTROL, VK_SHIFT, 'N' } },- // Spotify- { 5100, L"Nova Playlist", L"Ctrl+N", { VK_CONTROL, 'N' } },- { 5101, L"Reproduzir/Pausar", L"Espaço", { VK_SPACE } },- { 5102, L"Próxima", L"Ctrl+→", { VK_CONTROL, VK_RIGHT } },- { 5103, L"Anterior", L"Ctrl+←", { VK_CONTROL, VK_LEFT } },- { 5104, L"Aumentar Volume", L"Ctrl+↑", { VK_CONTROL, VK_UP } },- { 5105, L"Diminuir Volume", L"Ctrl+↓", { VK_CONTROL, VK_DOWN } },- { 5106, L"Repetir", L"Ctrl+R", { VK_CONTROL, 'R' } },- { 5107, L"Aleatório", L"Ctrl+S", { VK_CONTROL, 'S' } },- { 5108, L"Buscar", L"Ctrl+K", { VK_CONTROL, 'K' } },- // VS Code- { 5120, L"Novo Arquivo", L"Ctrl+N", { VK_CONTROL, 'N' } },- { 5121, L"Nova Janela", L"Ctrl+Shift+N", { VK_CONTROL, VK_SHIFT, 'N' } },- { 5122, L"Salvar Como…", L"Ctrl+Shift+S", { VK_CONTROL, VK_SHIFT, 'S' } },- { 5123, L"Fechar Editor", L"Ctrl+W", { VK_CONTROL, 'W' } },- { 5124, L"Substituir", L"Ctrl+H", { VK_CONTROL, 'H' } },- { 5125, L"Buscar nos Arquivos", L"Ctrl+Shift+F", { VK_CONTROL, VK_SHIFT, 'F' } },- { 5126, L"Paleta de Comandos…", L"Ctrl+Shift+P", { VK_CONTROL, VK_SHIFT, 'P' } },- { 5127, L"Explorador", L"Ctrl+Shift+E", { VK_CONTROL, VK_SHIFT, 'E' } },- { 5128, L"Controle do Código-Fonte", L"Ctrl+Shift+G", { VK_CONTROL, VK_SHIFT, 'G' } },- { 5129, L"Extensões", L"Ctrl+Shift+X", { VK_CONTROL, VK_SHIFT, 'X' } },- { 5130, L"Ir para Arquivo…", L"Ctrl+P", { VK_CONTROL, 'P' } },- { 5131, L"Ir para Linha…", L"Ctrl+G", { VK_CONTROL, 'G' } },- { 5132, L"Iniciar Depuração", L"F5", { VK_F5 } },- { 5133, L"Executar sem Depurar", L"Ctrl+F5", { VK_CONTROL, VK_F5 } },- { 5134, L"Barra Lateral", L"Ctrl+B", { VK_CONTROL, 'B' } },-};--ctxmenu::Item K(int id) {- for (auto& k : g_keyCmds) if (k.id == id) { ctxmenu::Item i; i.label = Tr(k.label); i.id = id; i.shortcut = k.shortcut; return i; }- return {};-}-ctxmenu::Item I(const std::wstring& label, int id, bool disabled = false, bool checked = false) {- ctxmenu::Item i; i.label = label; i.id = id; i.disabled = disabled; i.checked = checked; return i;-}-ctxmenu::Item Sep() { ctxmenu::Item i; i.separator = true; return i; }--// ---- menu Win32 real do app → itens do nosso menu-std::vector<ctxmenu::Item> FromHmenu(HMENU m, int depth) {- std::vector<ctxmenu::Item> out;- int n = GetMenuItemCount(m);- for (int k = 0; k < n; k++) {- wchar_t buf[256] = {};- MENUITEMINFOW mi{ sizeof(mi) };- mi.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_STATE | MIIM_ID | MIIM_SUBMENU;- mi.dwTypeData = buf; mi.cch = 255;- if (!GetMenuItemInfoW(m, k, TRUE, &mi)) continue;- if (mi.fType & MFT_SEPARATOR) { if (!out.empty() && !out.back().separator) out.push_back(Sep()); continue; }- if (mi.fType & MFT_OWNERDRAW || !buf[0]) continue;- ctxmenu::Item it;- it.label = Clean(buf, &it.shortcut);- it.id = (int)mi.wID;- it.disabled = (mi.fState & (MFS_DISABLED | MFS_GRAYED)) != 0;- it.checked = (mi.fState & MFS_CHECKED) != 0;- if (mi.hSubMenu) {- if (g_fg) {- // alguns apps só preenchem o submenu quando o item dele é destacado (o Ableton deixa "*" nos- // sets recentes até receber WM_MENUSELECT); depois espera um pouco se ainda for o marcador- SendMessageTimeoutW(g_fg, WM_MENUSELECT, MAKEWPARAM(k, MF_POPUP | MF_HILITE), (LPARAM)m, SMTO_ABORTIFHUNG, 200, nullptr);- SendMessageTimeoutW(g_fg, WM_INITMENUPOPUP, (WPARAM)mi.hSubMenu, k, SMTO_ABORTIFHUNG, 200, nullptr);- for (int t = 0; t < 12; t++) {- wchar_t first[8] = {};- GetMenuStringW(mi.hSubMenu, 0, first, 8, MF_BYPOSITION);- if (wcscmp(first, L"*")) break;- SendMessageTimeoutW(g_fg, WM_NULL, 0, 0, SMTO_ABORTIFHUNG, 100, nullptr);- Sleep(15);- }- }- if (depth == 0) it.sub = FromHmenu(mi.hSubMenu, 1);- else { // nosso menu tem um nível de submenu: os mais fundos entram achatados- out.push_back(Sep());- for (auto& c : FromHmenu(mi.hSubMenu, 2)) out.push_back(c);- out.push_back(Sep());- continue;- }- }- out.push_back(it);- }- while (!out.empty() && out.back().separator) out.pop_back();- return out;-}--App* ActiveApp() {- if (g_finderActive || !g_fg) for (auto& a : apps::list) if (a.finder) return &a;- return g_fg ? apps::OfWindow(g_fg) : nullptr;-}--// ---- estado do sistema para a direita da barra-bool WifiName(std::wstring& ssid) {- HANDLE h = nullptr; DWORD ver = 0;- if (WlanOpenHandle(2, nullptr, &ver, &h) != ERROR_SUCCESS) return false;- bool ok = false;- PWLAN_INTERFACE_INFO_LIST list = nullptr;- if (WlanEnumInterfaces(h, nullptr, &list) == ERROR_SUCCESS) {- for (DWORD i = 0; i < list->dwNumberOfItems && !ok; i++) {- auto& info = list->InterfaceInfo[i];- if (info.isState != wlan_interface_state_connected) continue;- PWLAN_CONNECTION_ATTRIBUTES ca = nullptr; DWORD sz = 0;- if (WlanQueryInterface(h, &info.InterfaceGuid, wlan_intf_opcode_current_connection, nullptr, &sz, (PVOID*)&ca, nullptr) == ERROR_SUCCESS) {- auto& s = ca->wlanAssociationAttributes.dot11Ssid;- ssid.assign(s.ucSSID, s.ucSSID + s.uSSIDLength);- ok = true;- WlanFreeMemory(ca);- }- }- WlanFreeMemory(list);- }- WlanCloseHandle(h, nullptr);- return ok;-}--// Estado do sistema para os ícones da direita (relido a cada segundo; o Bluetooth a cada 10 s)-struct Status {- bool wlan = false, wifiOn = false, wired = false;- bool batt = false, charging = false; int pct = 100;- bool bt = false;- bool sound = false, muted = false, phones = false; float vol = 0;- HKL hkl = nullptr;- DWORD btAt = 0;-} g_st;--bool WifiName(std::wstring& ssid);-bool g_audioStale; // a saída padrão mudou: relê o objeto de áudio já--void RefreshStatus() {- static DWORD wifiAt, audioAt;- static IAudioEndpointVolume* vol; // o mesmo objeto de áudio entre as leituras (antes: criado e solto a cada segundo)- DWORD now = GetTickCount();- // Wi-Fi: existe placa? está conectada? (a cada 5 s)- if (!wifiAt || now - wifiAt > 5000) {- wifiAt = now;- g_st.wlan = false;- HANDLE h = nullptr; DWORD ver = 0;- if (WlanOpenHandle(2, nullptr, &ver, &h) == ERROR_SUCCESS) {- PWLAN_INTERFACE_INFO_LIST list = nullptr;- if (WlanEnumInterfaces(h, nullptr, &list) == ERROR_SUCCESS) { g_st.wlan = list->dwNumberOfItems > 0; WlanFreeMemory(list); }- WlanCloseHandle(h, nullptr);- }- std::wstring ssid;- g_st.wifiOn = g_st.wlan && WifiName(ssid);- // cabo ligado (placa Ethernet com rede)? Aí o Wi-Fi desconectado não aparece na barra- g_st.wired = false;- ULONG sz = 16 * 1024;- std::vector<BYTE> buf(sz);- DWORD rc = GetAdaptersInfo((IP_ADAPTER_INFO*)buf.data(), &sz);- if (rc == ERROR_BUFFER_OVERFLOW) { buf.resize(sz); rc = GetAdaptersInfo((IP_ADAPTER_INFO*)buf.data(), &sz); }- if (rc == NO_ERROR) // placa Ethernet com gateway = cabo conectado à rede- for (auto* a = (IP_ADAPTER_INFO*)buf.data(); a; a = a->Next)- if (a->Type == MIB_IF_TYPE_ETHERNET && strcmp(a->GatewayList.IpAddress.String, "0.0.0.0") && a->GatewayList.IpAddress.String[0]) { g_st.wired = true; break; }- }- // bateria (só em quem tem)- SYSTEM_POWER_STATUS ps{};- if (GetSystemPowerStatus(&ps) && !(ps.BatteryFlag & 128) && ps.BatteryFlag != 255 && ps.BatteryLifePercent <= 100) {- g_st.batt = true; g_st.pct = ps.BatteryLifePercent; g_st.charging = ps.ACLineStatus == 1;- } else g_st.batt = false;- // Bluetooth: tem rádio?- if (!g_st.btAt || GetTickCount() - g_st.btAt > 10000) {- g_st.btAt = GetTickCount();- BLUETOOTH_FIND_RADIO_PARAMS fp{ sizeof(fp) }; HANDLE radio = nullptr;- HBLUETOOTH_RADIO_FIND f = BluetoothFindFirstRadio(&fp, &radio);- g_st.bt = f != nullptr;- if (radio) CloseHandle(radio);- if (f) BluetoothFindRadioClose(f);- }- // som: volume e mudo a cada segundo (barato, no objeto guardado); a saída padrão e se é um fone a cada 10 s- bool fresh = false;- if (g_audioStale) { g_audioStale = false; audioAt = 0; }- if (vol && audioAt && now - audioAt < 10000) {- BOOL mute = FALSE;- if (SUCCEEDED(vol->GetMute(&mute)) && SUCCEEDED(vol->GetMasterVolumeLevelScalar(&g_st.vol))) { g_st.muted = mute; fresh = true; }- }- if (!fresh) {- audioAt = now;- if (vol) { vol->Release(); vol = nullptr; }- g_st.sound = false;- IMMDeviceEnumerator* en = nullptr;- if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, IID_PPV_ARGS(&en)))) {- IMMDevice* dev = nullptr;- if (SUCCEEDED(en->GetDefaultAudioEndpoint(eRender, eConsole, &dev))) {- if (SUCCEEDED(dev->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, nullptr, (void**)&vol))) {- BOOL mute = FALSE; vol->GetMute(&mute); vol->GetMasterVolumeLevelScalar(&g_st.vol);- g_st.muted = mute; g_st.sound = true;- }- IPropertyStore* st = nullptr;- g_st.phones = false;- if (SUCCEEDED(dev->OpenPropertyStore(STGM_READ, &st))) {- static const PROPERTYKEY formFactor = { { 0x1da5d803, 0xd492, 0x4edd, { 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e } }, 0 };- PROPVARIANT v; PropVariantInit(&v);- if (SUCCEEDED(st->GetValue(formFactor, &v)) && v.vt == VT_UI4) g_st.phones = v.ulVal == 3 || v.ulVal == 5; // fone / headset- PropVariantClear(&v);- st->Release();- }- dev->Release();- }- en->Release();- }- }- // fonte de entrada (teclado) do app da frente- HWND fg = GetForegroundWindow();- g_st.hkl = GetKeyboardLayout(fg ? GetWindowThreadProcessId(fg, nullptr) : 0);-}--// "A" para o teclado americano (o "ABC" do Mac), senão a sigla do país do layout (BR, PT, ES…)-std::wstring InputBadge(HKL hkl) {- WORD layout = HIWORD((ULONG_PTR)hkl), lang = LOWORD((ULONG_PTR)hkl);- if ((layout & 0xF000) == 0xF000) layout = lang; // layout alternativo: usa o idioma- if (layout == 0x0409) return L"A";- wchar_t name[LOCALE_NAME_MAX_LENGTH] = {};- if (LCIDToLocaleName(MAKELCID(layout, SORT_DEFAULT), name, LOCALE_NAME_MAX_LENGTH, 0) ||- LCIDToLocaleName(MAKELCID(lang, SORT_DEFAULT), name, LOCALE_NAME_MAX_LENGTH, 0)) {- std::wstring n = name;- size_t d = n.find(L'-');- std::wstring c = d != std::wstring::npos ? n.substr(d + 1, 2) : n.substr(0, 2);- for (auto& ch : c) ch = towupper(ch);- return c;- }- return L"?";-}-std::wstring LayoutName(HKL hkl) {- wchar_t name[LOCALE_NAME_MAX_LENGTH] = {}, disp[128] = {};- LCIDToLocaleName(MAKELCID(LOWORD((ULONG_PTR)hkl), SORT_DEFAULT), name, LOCALE_NAME_MAX_LENGTH, 0);- GetLocaleInfoEx(name, LOCALE_SLOCALIZEDDISPLAYNAME, disp, 128);- std::wstring r = disp[0] ? disp : name;- if (HIWORD((ULONG_PTR)hkl) == 0x0416) r += L" (ABNT2)";- return r;-}--IAudioEndpointVolume* Volume() {- IMMDeviceEnumerator* en = nullptr;- IAudioEndpointVolume* vol = nullptr;- if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, IID_PPV_ARGS(&en)))) {- IMMDevice* dev = nullptr;- if (SUCCEEDED(en->GetDefaultAudioEndpoint(eRender, eConsole, &dev))) {- dev->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, nullptr, (void**)&vol);- dev->Release();- }- en->Release();- }- return vol;-}--std::wstring ClockText() {- SYSTEMTIME st; GetLocalTime(&st);- wchar_t day[16] = {}, mon[16] = {};- const wchar_t* loc = idioma::Locale();- GetDateFormatEx(loc, 0, &st, L"ddd", day, 16, nullptr);- GetDateFormatEx(loc, 0, &st, L"MMM", mon, 16, nullptr);- std::wstring d = day, m = mon;- if (idioma::Pt() && !d.empty() && d.back() != L'.') d += L'.';- if (idioma::Pt() && !m.empty() && m.back() != L'.') m += L'.';- wchar_t buf[64];- if (liquid::Leopard()) {- // Leopard: só o dia da semana e a hora ("Mon 6:45 PM" na captura do 10.5), no formato de hora do usuário- wchar_t tm[32] = {};- GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, tm, 32);- std::wstring dd = day;- if (!dd.empty() && dd.back() == L'.') dd.pop_back();- if (!dd.empty()) dd[0] = towupper(dd[0]);- swprintf_s(buf, L"%ls %ls", dd.c_str(), tm);- return buf;- }- if (shell::Setting(L"relogio_curto", L"0") == L"1") swprintf_s(buf, L"%02d:%02d", st.wHour, st.wMinute);- else if (idioma::En()) swprintf_s(buf, L"%ls %ls %d %02d:%02d", d.c_str(), m.c_str(), st.wDay, st.wHour, st.wMinute); // Tue Nov 10- else if (idioma::Pt()) swprintf_s(buf, L"%ls %d de %ls %02d:%02d", d.c_str(), st.wDay, m.c_str(), st.wHour, st.wMinute);- else swprintf_s(buf, L"%ls %02d:%02d", idioma::Date(st, idioma::D_WEEKDAY_SHORT).c_str(), st.wHour, st.wMinute); // ven. 20 nov., 11月20日(金)- return buf;-}--// ---- ícones de status: HICON → BGRA pré-multiplicado (desenhado sobre preto e sobre branco)-struct IconCache { HICON icon; UINT px; std::vector<BYTE> bgra; };-std::vector<IconCache> g_iconCache;--const std::vector<BYTE>& IconPixels(HICON ic, UINT px) {- for (auto& c : g_iconCache) if (c.icon == ic && c.px == px) return c.bgra;- if (g_iconCache.size() > 64) g_iconCache.clear();- // desenhado 4× maior e reduzido pela média de cada bloco 4×4 (anti-aliasing): em 1080p (17 px) o DrawIconEx- // esticava o ícone de 16/32 px pelo vizinho mais próximo e a borda saía serrilhada- const UINT SS = 4, R = px * SS;- BITMAPINFO bi{}; bi.bmiHeader = { sizeof(BITMAPINFOHEADER), (LONG)R, -(LONG)R, 1, 32, BI_RGB };- void *pb, *pw;- HDC dc = CreateCompatibleDC(nullptr);- HBITMAP b = CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, &pb, nullptr, 0);- HBITMAP w = CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, &pw, nullptr, 0);- IconCache c{ ic, px, std::vector<BYTE>(px * px * 4) };- if (!b || !w || !pb || !pw) {- if (b) DeleteObject(b);- if (w) DeleteObject(w);- DeleteDC(dc);- g_iconCache.push_back(std::move(c));- return g_iconCache.back().bgra;- }- memset(pw, 0xFF, R * R * 4);- HGDIOBJ old = SelectObject(dc, b); DrawIconEx(dc, 0, 0, ic, R, R, 0, nullptr, DI_NORMAL);- SelectObject(dc, w); DrawIconEx(dc, 0, 0, ic, R, R, 0, nullptr, DI_NORMAL);- SelectObject(dc, old);- auto* B = (BYTE*)pb; auto* W = (BYTE*)pw;- for (UINT y = 0; y < px; y++)- for (UINT x = 0; x < px; x++) {- UINT sb = 0, sg = 0, sr = 0, sa = 0;- for (UINT dy = 0; dy < SS; dy++)- for (UINT dx = 0; dx < SS; dx++) {- size_t i = ((size_t)(y * SS + dy) * R + (x * SS + dx)) * 4;- int a = 255 - std::clamp((W[i + 1] - B[i + 1]), 0, 255); // alfa = 1 - (branco - preto)- sb += B[i + 0]; sg += B[i + 1]; sr += B[i + 2]; sa += (UINT)a;- }- const UINT n = SS * SS;- size_t o = ((size_t)y * px + x) * 4;- c.bgra[o + 3] = (BYTE)((sa + n / 2) / n);- c.bgra[o + 0] = (BYTE)std::min<UINT>((sb + n / 2) / n, c.bgra[o + 3]);- c.bgra[o + 1] = (BYTE)std::min<UINT>((sg + n / 2) / n, c.bgra[o + 3]);- c.bgra[o + 2] = (BYTE)std::min<UINT>((sr + n / 2) / n, c.bgra[o + 3]);- }- DeleteObject(b); DeleteObject(w); DeleteDC(dc);- g_iconCache.push_back(std::move(c));- return g_iconCache.back().bgra;-}--// ---- desenho-void DrawLogo(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, float cx, float cy) {- // logo próprio (não usamos a marca da Apple): quatro quadradinhos arredondados- float s = 5.4f, g = 1.6f;- for (int i = 0; i < 4; i++) {- float x = cx - s - g / 2 + (i % 2) * (s + g), y = cy - s - g / 2 + (i / 2) * (s + g);- rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(x, y, x + s, y + s), 1.5f, 1.5f), br);- }-}--void DrawCC(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, float cx, float cy) {- // Central de Controle: duas chavinhas- for (int k = 0; k < 2; k++) {- float y = cy - 3.6f + k * 7.2f;- D2D1_ROUNDED_RECT rr{ D2D1::RectF(cx - 7.5f, y - 2.8f, cx + 7.5f, y + 2.8f), 2.8f, 2.8f };- rt->DrawRoundedRectangle(rr, br, 1.2f);- float kx = k == 0 ? cx - 4.7f : cx + 4.7f;- rt->FillEllipse(D2D1::Ellipse({ kx, y }, 2.0f, 2.0f), br);- }-}--// Ajustes > Transparência e Efeitos > "Mostrar fundo da barra de menus" (desligado: como no Tahoe)-// No Tahoe (Liquid Glass) a barra de menus não tem fundo nenhum, como no macOS 26: só o papel de parede atrás.-bool BarBackground() {- if (backdrop::Current().reduce || liquid::Leopard()) return true; // Leopard: a barra translúcida clara sempre tem fundo- if (backdrop::Liquid()) return false;- return shell::Setting(L"barra_fundo", L"1") != L"0";-}--void BarGlass(HWND bar) {- if (!bar) return;- // Leopard: o degradê branco translúcido vem do Render. Translúcida (padrão): transparência de verdade, SEM desfoque- // (o 10.5 deixava o papel de parede aparecer nítido através da barra); opaca: acrílico cheio por baixo- const bool leoClear = liquid::Leopard() && shell::Setting(L"barra_translucida", L"1") == L"1";- if (liquid::Leopard() && !leoClear) { ui::Acrylic(bar, 0xFFE6E6E6u); return; }- if (!leoClear)- if (BarBackground()) { ui::Acrylic(bar, ui::Dark() ? 0x40141414u : 0x55F4F4F4u); return; } // vidro bem claro: o papel de parede aparece, como no Mac- // sem fundo: o DWM só respeita o alfa do que a barra desenha (nada de desfoque)- struct ACCENT_POLICY { int state, flags; DWORD gradient; int anim; };- struct WCA_DATA { int attr; PVOID data; SIZE_T size; };- using Fn = BOOL(WINAPI*)(HWND, WCA_DATA*);- static Fn fn = (Fn)GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetWindowCompositionAttribute");- if (!fn) return;- ACCENT_POLICY ap{ 2 /*ACCENT_ENABLE_TRANSPARENTGRADIENT*/, 2, 0x00000000u, 0 };- WCA_DATA d{ 19 /*WCA_ACCENT_POLICY*/, &ap, sizeof(ap) };- fn(bar, &d);-}--// Barra sem fundo (Tahoe): o texto e os ícones seguem a claridade do que está atrás deles, como no Mac-// (branco sobre papel de parede escuro, preto sobre claro), não o tema do sistema. A barra fica sempre-// em cima do papel de parede (a área de trabalho começa abaixo dela): mede o topo da imagem.-float g_topR = 0.5f, g_topG = 0.5f, g_topB = 0.5f; // cor média do topo do papel de parede (vibrancy do Tahoe)-bool WallpaperTopDarkFile(bool fallback);-// a cor do que está atrás da barra: a faixa que a mesa desenhou (muda na hora com o papel de parede); sem a mesa, o-// arquivo do papel de parede-bool WallpaperTopDark(bool fallback) {- float r, g, b;- if (!mesa::TopColor(menubar::Height(), r, g, b)) return WallpaperTopDarkFile(fallback);- g_topR = r; g_topG = g; g_topB = b;- double luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;- static int adapt = -1; // -1 ainda não decidido, 0 texto claro, 1 texto escuro- static double lastLog = -1;- bool dark;- if (liquid::On()) { // histerese 0,40/0,60 (guia, seção 2.1)- if (luma > 0.60) adapt = 1; else if (luma < 0.40) adapt = 0; else if (adapt < 0) adapt = luma >= 0.5 ? 1 : 0;- dark = adapt == 0;- } else dark = luma < 0.72;- if (std::fabs(luma - lastLog) > 0.05) { lastLog = luma; Log(L"barra de menus: atrás dela claridade %.2f -> texto %ls", luma, dark ? L"branco" : L"preto"); }- return dark;-}-bool WallpaperTopDarkFile(bool fallback) {- static std::wstring lastKey;- static bool lastDark = true;- // o papel de parede que a mesa desenha (do registro); sem ele, o do Windows- wchar_t path[MAX_PATH] = {};- DWORD cb = sizeof(path);- if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"WallPaper", RRF_RT_REG_SZ, nullptr, path, &cb) != ERROR_SUCCESS || !path[0]- || GetFileAttributesW(path) == INVALID_FILE_ATTRIBUTES)- SystemParametersInfoW(SPI_GETDESKWALLPAPER, MAX_PATH, path, 0);- WIN32_FILE_ATTRIBUTE_DATA fa{};- if (!path[0] || !GetFileAttributesExW(path, GetFileExInfoStandard, &fa)) {- static bool warned;- if (!warned) { warned = true; Log(L"barra de menus: papel de parede não encontrado (%ls)", path); }- return fallback;- }- std::wstring key = std::wstring(path) + L"|" + std::to_wstring(fa.ftLastWriteTime.dwLowDateTime);- if (key == lastKey) return lastDark;- lastKey = key;- lastDark = fallback;- IWICImagingFactory* wic = nullptr;- HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&wic));- if (FAILED(hr)) { Log(L"barra de menus: WIC indisponível (0x%08X)", (unsigned)hr); return fallback; }- IWICBitmapDecoder* dec = nullptr; IWICBitmapFrameDecode* fr = nullptr; IWICBitmapScaler* sc = nullptr; IWICFormatConverter* cv = nullptr;- const UINT W = 96, H = 54;- int step = 0;- if (++step, SUCCEEDED(hr = wic->CreateDecoderFromFilename(path, nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &dec)) && (++step, SUCCEEDED(hr = dec->GetFrame(0, &fr))) &&- (++step, SUCCEEDED(hr = wic->CreateBitmapScaler(&sc))) && (++step, SUCCEEDED(hr = sc->Initialize(fr, W, H, WICBitmapInterpolationModeFant))) &&- (++step, SUCCEEDED(hr = wic->CreateFormatConverter(&cv))) && (++step, SUCCEEDED(hr = cv->Initialize(sc, GUID_WICPixelFormat32bppBGRA, WICBitmapDitherTypeNone, nullptr, 0, WICBitmapPaletteTypeCustom)))) {- std::vector<BYTE> px(W * 3 * 4); // as 3 primeiras linhas (~5% de cima, onde fica a barra)- WICRect top{ 0, 0, (INT)W, 3 };- if (SUCCEEDED(hr = cv->CopyPixels(&top, W * 4, (UINT)px.size(), px.data()))) {- double sum = 0, sr = 0, sg = 0, sb = 0;- for (UINT i = 0; i < W * 3; i++) {- sum += (0.0722 * px[i * 4] + 0.7152 * px[i * 4 + 1] + 0.2126 * px[i * 4 + 2]) / 255.0;- sb += px[i * 4] / 255.0; sg += px[i * 4 + 1] / 255.0; sr += px[i * 4 + 2] / 255.0;- }- double luma = sum / (W * 3);- g_topR = (float)(sr / (W * 3)); g_topG = (float)(sg / (W * 3)); g_topB = (float)(sb / (W * 3));- // Tahoe: adaptação com histerese do vidro do macOS 26 (glassLumaHysteresisRange, guia seção 2.1): acima de- // 0,60 vira texto escuro, abaixo de 0,40 texto claro, entre os dois fica como estava. Sequoia: limiar 0,72.- static int adapt = -1; // -1 ainda não decidido, 0 texto claro, 1 texto escuro- if (liquid::On()) {- if (luma > 0.60) adapt = 1; else if (luma < 0.40) adapt = 0; else if (adapt < 0) adapt = luma >= 0.5 ? 1 : 0;- lastDark = adapt == 0;- } else lastDark = luma < 0.72; // o Mac só usa texto escuro sobre fundo bem claro- Log(L"barra de menus: topo do papel de parede com claridade %.2f -> texto %ls", luma, lastDark ? L"branco" : L"preto");- }- }- else Log(L"barra de menus: não deu para ler o papel de parede (etapa %d, 0x%08X)", step, (unsigned)hr);- if (cv) cv->Release(); if (sc) sc->Release(); if (fr) fr->Release(); if (dec) dec->Release();- wic->Release();- return lastDark;-}--void Render() {- if (!g_bar) return;- HWND bar = Cur();- g_s.hwnd = bar;- RECT rc; GetClientRect(bar, &rc);- float sc = ui::Scale(bar);- auto* rt = ui::Begin(g_s, rc.right, rc.bottom, sc);- if (!rt) return;- float W = rc.right / sc, H = rc.bottom / sc;- bool dark = ui::Dark();- // sem fundo, ou no Tahoe (o vidro da barra é tão leve que o papel de parede aparece quase inteiro):- // a cor do texto e dos ícones segue o papel de parede atrás- const bool bgOn0 = BarBackground();- if (!bgOn0 || liquid::On()) dark = WallpaperTopDark(dark);- const bool leo = liquid::Leopard();- // Leopard: Lucida Grande 14 px no Mac; no Windows, a Lucida Sans Unicode (o mesmo desenho de origem)- static IDWriteTextFormat* tfLeo = ui::FormatFace(L"Lucida Sans Unicode", 14, DWRITE_FONT_WEIGHT_NORMAL);- static IDWriteTextFormat* tfLeoB = ui::FormatFace(L"Lucida Sans Unicode", 14, DWRITE_FONT_WEIGHT_BOLD);- IDWriteTextFormat* tfN = leo ? tfLeo : g_tf;- IDWriteTextFormat* tfB = leo ? tfLeoB : g_tfBold;- if (leo) dark = false; // Leopard: a barra é sempre clara, com texto preto (o 10.5 não tinha modo escuro)- // Menubar Image do macOS 26 (guia, seção 31: catálogos Aqua/DarkAqua): branco 90 % no escuro, preto 85 % no claro- D2D1_COLOR_F fgc = dark ? D2D1::ColorF(1, 1, 1, liquid::On() ? 0.90f : 0.92f) : D2D1::ColorF(0, 0, 0, 0.85f);- // Liquid Glass sem fundo: só branco ou preto, mais firmes. Antes puxava a cor do papel de parede saturada 3×- // (a "vibrancy" do Mac) e em papel de parede azul o texto e os ícones ficavam ciano.- if (liquid::On() && !bgOn0) fgc = dark ? D2D1::ColorF(1, 1, 1, 0.96f) : D2D1::ColorF(0, 0, 0, 0.90f);- ID2D1SolidColorBrush* br = nullptr;- bool liquid = backdrop::Liquid(), bgOn = BarBackground();- D2D1_COLOR_F veil = dark ? D2D1::ColorF(0.06f, 0.06f, 0.07f, 0.18f) : D2D1::ColorF(1, 1, 1, 0.26f);- if (liquid) veil.a = backdrop::Current().tinted ? veil.a : veil.a * 0.35f;- if (!bgOn || leo) veil.a = 0; // sem fundo (Tahoe): só o papel de parede atrás; Leopard: o degradê do Render é o fundo todo- rt->CreateSolidColorBrush(veil, &br);- rt->FillRectangle(D2D1::RectF(0, 0, W, H), br); // tinta leve por cima do acrílico- if (leo) {- // Leopard: a barra de menus translúcida do 10.5 — branco leitoso que deixa o papel de parede passar um pouco,- // um tom mais cinza embaixo, o fio de luz no alto e a linha escura embaixo (a "sombra" da barra)- float px = 1 / sc;- // medido numa captura do 10.5 a 1x: 248 no alto -> 204 embaixo, a linha de baixo quase preta- // Aparência > "Barra de menus translúcida" desligada (o 10.5.2 trouxe a opção): opaca- const float op = shell::Setting(L"barra_translucida", L"1") == L"1" ? 1.f : 1.12f;- // translúcida: ~72 % de branco (o papel de parede passa nítido, como nas capturas do 10.5); opaca: cheia- const float a0 = op > 1 ? 1.f : 0.74f, a1 = op > 1 ? 1.f : 0.70f;- D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(248 / 255.f, 248 / 255.f, 248 / 255.f, a0) }, { 1, D2D1::ColorF(214 / 255.f, 214 / 255.f, 214 / 255.f, a1) } };- ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;- if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&- SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, H }), gs, &lb)))- rt->FillRectangle(D2D1::RectF(0, 0, W, H), lb);- if (lb) lb->Release();- if (gs) gs->Release();- br->SetColor(D2D1::ColorF(1, 1, 1, 0.75f));- rt->FillRectangle(D2D1::RectF(0, 0, W, px), br);- br->SetColor(D2D1::ColorF(0, 0, 0, 0.62f));- rt->FillRectangle(D2D1::RectF(0, H - px, W, H), br);- }- if (liquid && bgOn) { // Liquid Glass: sem degradê branco; só um fio fraco embaixo, como no Tahoe- float px = 1 / sc;- br->SetColor(D2D1::ColorF(1, 1, 1, dark ? 0.08f : 0.18f));- rt->FillRectangle(D2D1::RectF(0, H - px, W, H), br);- }- g_hits.clear();- bool litNow = false; // Leopard: o item aceso fica com o texto branco sobre o azul- auto highlight = [&](D2D1_RECT_F r) {- if (leo) { // Leopard: o destaque azul do Aqua de ponta a ponta na altura da barra, sem cantos- litNow = true;- D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.39f, 0.56f, 0.95f, 1) }, { 1, D2D1::ColorF(0.13f, 0.35f, 0.86f, 1) } };- ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;- if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&- SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, H }), gs, &lb)))- rt->FillRectangle(D2D1::RectF(r.left, 0, r.right, H - 1 / sc), lb);- if (lb) lb->Release();- if (gs) gs->Release();- return;- }- if (liquid::On()) { // Tahoe (vídeo do macOS 26): o item aberto ganha uma cápsula de vidro clara- br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.24f) : D2D1::ColorF(1, 1, 1, 0.55f));- float rad = (H - 4) / 2;- rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, 2, r.right - 1, H - 2), rad, rad), br);- br->SetColor(D2D1::ColorF(1, 1, 1, dark ? 0.18f : 0.45f)); // o fio de luz da borda- rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1.5f, 2.5f, r.right - 1.5f, H - 2.5f), rad - 0.5f, rad - 0.5f), br, 0.8f);- return;- }- br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.20f) : D2D1::ColorF(0, 0, 0, 0.10f));- rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, 2, r.right, H - 2), 4, 4), br);- };- auto add = [&](D2D1_RECT_F r, Kind k, int i) {- litNow = false;- g_hits.push_back({ r, k, i });- bool lit = (k == K_SOUND && (som::IsOpen() || som::HudLit())) // menu Som aberto / aviso de volume do Tahoe- || (k == K_CC && central::IsOpen()) || (k == K_CLOCK && (notificacoes::IsOpen() || (liquid::On() && notificacoes::BannerVisible()))) || (k == K_SPOT && spotlight::IsOpen());- if (lit || ((int)g_hits.size() - 1 == g_open && bar == g_openBar)) highlight(r);- };-- // esquerda (Tahoe, guia seção 35: o menu Apple fica em x 10, com 34 de largura)- float x = liquid::On() ? 10.f : 8.f;- add(D2D1::RectF(x, 0, x + 34, H), K_LOGO, 0);- br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);- if (leo && !litNow) {- // Leopard: a maçã grafite brilhante do 10.5 (a azul era a do Tiger): cinza claro em cima, quase preto embaixo;- // aberta, fica branca- D2D1_GRADIENT_STOP st[3] = { { 0, D2D1::ColorF(0.62f, 0.62f, 0.63f, 1) }, { 0.45f, D2D1::ColorF(0.36f, 0.36f, 0.37f, 1) }, { 1, D2D1::ColorF(0.16f, 0.16f, 0.17f, 1) } };- ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;- bool ok = SUCCEEDED(rt->CreateGradientStopCollection(st, 3, &gs)) &&- SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, H / 2 - 7.5f }, { 0, H / 2 + 6.5f }), gs, &lb));- if (!ok || !simbolo::Draw(rt, L"apple.logo", D2D1::RectF(x + 10, H / 2 - 7.5f, x + 24, H / 2 + 6.5f), lb)) {- br->SetColor(D2D1::ColorF(0.30f, 0.30f, 0.31f, 1));- DrawLogo(rt, br, x + 17, H / 2);- }- if (lb) lb->Release();- if (gs) gs->Release();- } else- if (!simbolo::Draw(rt, L"apple.logo", D2D1::RectF(x + 10, H / 2 - 7.5f, x + 24, H / 2 + 6.5f), (br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc), br))) // a maçã do SF Symbols- DrawLogo(rt, br, x + 17, H / 2);- x += 34;- {- float w = ui::TextWidth(tfB, g_appName) + 20;- add(D2D1::RectF(x, 0, x + w, H), K_APP, 0);- br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);- rt->DrawTextW(g_appName.c_str(), (UINT32)g_appName.size(), tfB, D2D1::RectF(x + 10, 0, x + w, H), br);- x += w;- }- float leftEnd = x;-- // direita (da borda para dentro), na ordem do Mac: relógio, Central de Controle, Spotlight, fonte de- // entrada, Wi-Fi, bateria, som, Bluetooth, ícones fixados dos apps e a setinha dos guardados.- // Cada item é o símbolo com 10 pt de cada lado (no Mac fica um a cada ~38 pt).- float r = W - 10;- auto slot = [&](float iconW, Kind k, int i) { // reserva o espaço e devolve a caixa do símbolo- float w = iconW + 2 * PAD;- add(D2D1::RectF(r - w, 0, r, H), k, i);- D2D1_RECT_F box = D2D1::RectF(r - w + PAD, 0, r - PAD, H);- r -= w;- br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);- return box;- };- auto sym = [&](const wchar_t* name, D2D1_RECT_F box, float h) {- return simbolo::Draw(rt, name, D2D1::RectF(box.left, H / 2 - h / 2, box.right, H / 2 + h / 2), br);- };- // Leopard (captura do 10.5): a lupa do Spotlight é o último item, na ponta direita, e o relógio vem antes dela;- // (a Central de Controle continua, à esquerda do relógio: o usuário quer o acesso a ela)- if (leo && shell::Setting(L"barra_spotlight", L"1") == L"1") {- auto bx = slot(15, K_SPOT, 0);- if (!sym(L"magnifyingglass", bx, 15)) rt->DrawTextW(L"", 1, g_tfIcon, bx, br);- }- {- std::wstring t = ClockText();- float w = ui::TextWidth(tfN, t) + 2 * PAD;- add(D2D1::RectF(r - w, 0, r, H), K_CLOCK, 0);- br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);- rt->DrawTextW(t.c_str(), (UINT32)t.size(), tfN, D2D1::RectF(r - w + PAD, 0, r, H), br);- r -= w;- }- // microfone/câmera em uso (issue #8, todos os temas): como no macOS, uma bolinha de 6 pt no vão entre a Central de- // Controle e a data/hora: laranja = microfone, verde = câmera (a câmera ganha). barra_privacidade=0 tira.- if (shell::Setting(L"barra_privacidade", L"1") != L"0")- if (int pv = ilha::Privacidade()) {- br->SetColor(pv & 2 ? D2D1::ColorF(0.20f, 0.78f, 0.35f) : D2D1::ColorF(1.0f, 0.58f, 0.0f));- rt->FillEllipse(D2D1::Ellipse({ r, H / 2 }, 3, 3), br); // no meio do vão (os dois PAD): nada anda de lugar- }- { auto bx = slot(18, K_CC, 0); if (!sym(L"switch.2", bx, 14)) DrawCC(rt, br, (bx.left + bx.right) / 2, H / 2); }- if (!leo && shell::Setting(L"barra_spotlight", L"1") == L"1") {- auto bx = slot(15, K_SPOT, 0);- if (!sym(L"magnifyingglass", bx, 15)) rt->DrawTextW(L"", 1, g_tfIcon, bx, br);- }- if (shell::Setting(L"barra_teclado", L"1") == L"1") { // fonte de entrada: a sigla num quadradinho (como o "A" do ABC)- std::wstring t = InputBadge(g_st.hkl);- float tw = std::max(15.f, ui::TextWidth(g_tfBadge, t) + 7);- auto bx = slot(tw, K_INPUT, 0);- D2D1_RECT_F k = D2D1::RectF(bx.left, H / 2 - 7.5f, bx.right, H / 2 + 7.5f);- rt->FillRoundedRectangle(D2D1::RoundedRect(k, 3.5f, 3.5f), br);- br->SetColor(dark ? D2D1::ColorF(0.13f, 0.13f, 0.14f) : D2D1::ColorF(0.96f, 0.96f, 0.96f));- rt->DrawTextW(t.c_str(), (UINT32)t.size(), g_tfBadge, D2D1::RectF(k.left, k.top - 0.5f, k.right, k.bottom - 0.5f), br);- }- // como no Mac: só quem tem Wi-Fi; no cabo, o Wi-Fi desconectado não aparece- if (g_st.wlan && (g_st.wifiOn || !g_st.wired) && shell::Setting(L"barra_wifi", L"1") == L"1") {- auto bx = slot(18, K_NET, 0);- if (!sym(g_st.wifiOn ? L"wifi" : L"wifi.slash", bx, 14)) rt->DrawTextW(L"", 1, g_tfIcon, bx, br);- }- if (g_st.batt && shell::Setting(L"barra_bateria", L"1") == L"1") {- const wchar_t* name = g_st.charging ? L"battery.100percent.bolt" : g_st.pct > 87 ? L"battery.100percent" : g_st.pct > 62 ? L"battery.75percent"- : g_st.pct > 37 ? L"battery.50percent" : g_st.pct > 12 ? L"battery.25percent" : L"battery.0percent";- if (liquid::Golden()) {- // macOS 27 (vídeo do MacVince, 2:44): a porcentagem DENTRO do ícone — corpo cheio de 25 × 12 com canto 4,- // o número vazado (e o raio quando carrega) e a ponta à direita- auto bx = slot(29, K_BATT, 0);- float cy = H / 2;- D2D1_RECT_F body = D2D1::RectF(bx.left, cy - 6, bx.left + 25, cy + 6);- rt->FillRoundedRectangle(D2D1::RoundedRect(body, 4, 4), br);- rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(body.right + 1, cy - 2.5f, body.right + 2.8f, cy + 2.5f), 1, 1), br);- static IDWriteTextFormat* tfB = ui::Format(9.5f, DWRITE_FONT_WEIGHT_BOLD, false, DWRITE_TEXT_ALIGNMENT_CENTER);- wchar_t num[8]; swprintf_s(num, L"%d", std::clamp(g_st.pct, 0, 100));- br->SetColor(dark ? D2D1::ColorF(0.15f, 0.13f, 0.12f, 0.92f) : D2D1::ColorF(1, 1, 1, 0.95f));- D2D1_RECT_F tr = D2D1::RectF(body.left, body.top - 0.5f, body.right - (g_st.charging ? 6.f : 0.f), body.bottom - 0.5f);- if (tfB) { tfB->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); rt->DrawTextW(num, (UINT32)wcslen(num), tfB, tr, br); }- if (g_st.charging) { // raio- float bx0 = body.right - 6.5f;- ID2D1PathGeometry* g = nullptr;- if (SUCCEEDED(ui::d2d->CreatePathGeometry(&g))) {- ID2D1GeometrySink* sk = nullptr; g->Open(&sk);- sk->BeginFigure({ bx0 + 2.6f, cy - 4.5f }, D2D1_FIGURE_BEGIN_FILLED);- D2D1_POINT_2F pts[] = { { bx0, cy + 0.6f }, { bx0 + 1.9f, cy + 0.6f }, { bx0 + 1.1f, cy + 4.5f }, { bx0 + 3.8f, cy - 0.8f }, { bx0 + 1.9f, cy - 0.8f } };- sk->AddLines(pts, 5); sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();- rt->FillGeometry(g, br);- g->Release();- }- }- br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);- } else {- auto bx = slot(27, K_BATT, 0);- sym(name, bx, 13);- }- }- // Som e Bluetooth: no Mac ficam fora da barra por padrão (Ajustes > Central de Controle liga)- if (g_st.sound && shell::Setting(L"barra_som", L"0") == L"1") {- const wchar_t* name = g_st.muted ? L"speaker.slash.fill" : g_st.phones ? L"headphones" : g_st.vol < 0.01f ? L"speaker.fill"- : g_st.vol < 0.34f ? L"speaker.wave.1.fill" : g_st.vol < 0.67f ? L"speaker.wave.2.fill" : L"speaker.wave.3.fill";- auto bx = slot(g_st.phones ? 16 : 21, K_SOUND, 0);- sym(name, bx, g_st.phones ? 16 : 14);- }- if (g_st.bt && shell::Setting(L"barra_bluetooth", L"0") == L"1") { // o símbolo do Bluetooth do Mac (não está no SF Symbols público)- auto bx = slot(9, K_BT, 0);- float cx = (bx.left + bx.right) / 2, cy = H / 2, hh = 7.2f, ww = 3.9f;- ID2D1PathGeometry* g = nullptr;- if (SUCCEEDED(ui::d2d->CreatePathGeometry(&g))) {- ID2D1GeometrySink* sk = nullptr; g->Open(&sk);- sk->BeginFigure({ cx - ww, cy - hh * 0.48f }, D2D1_FIGURE_BEGIN_HOLLOW);- D2D1_POINT_2F pts[] = { { cx + ww, cy + hh * 0.48f }, { cx, cy + hh }, { cx, cy - hh }, { cx + ww, cy - hh * 0.48f }, { cx - ww, cy + hh * 0.48f } };- sk->AddLines(pts, 5); sk->EndFigure(D2D1_FIGURE_END_OPEN); sk->Close(); sk->Release();- ID2D1StrokeStyle* st = nullptr;- ui::d2d->CreateStrokeStyle(D2D1::StrokeStyleProperties(D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_LINE_JOIN_ROUND), nullptr, 0, &st);- rt->DrawGeometry(g, br, 1.5f, st);- if (st) st->Release();- g->Release();- }- }- UINT px = (UINT)std::lround(17 * sc);- for (int i = (int)tray::icons.size() - 1; i >= 0; i--) {- auto& t = tray::icons[i];- if (t.hidden || !t.icon || !IsShown(t) || tray::IsPrivacy(t)) continue; // o do Windows: vira a bolinha- if (r - 37 < leftEnd + 60) { g_overflow = true; break; } // sem espaço: some, como no Mac (macOS 27: aparece a »)- auto bx = slot(17, K_TRAY, i);- std::vector<BYTE> mono = IconPixels(t.icon, px);- // como os ícones-modelo do Mac: uma cor só, a mesma do texto da barra (branco no escuro, preto no claro);- // o desenho de dentro (ícone de fundo cheio: Discord, WhatsApp) sai pela transparência, nunca por cinza- // ou pela cor do original, que deixava o ícone azulado/acinzentado em cima do papel de parede.- float lmin = 1, lmax = 0;- for (size_t k = 0; k < mono.size(); k += 4) {- float a = mono[k + 3] / 255.f;- if (a < 0.5f) continue;- float l = std::clamp((0.2126f * mono[k + 2] + 0.7152f * mono[k + 1] + 0.0722f * mono[k]) / 255.f / a, 0.f, 1.f);- lmin = std::min(lmin, l); lmax = std::max(lmax, l);- }- bool detail = lmax - lmin > 0.25f; // tem desenho de dentro (senão é só a silhueta)- BYTE ink = dark ? 255 : 0;- for (size_t k = 0; k < mono.size(); k += 4) {- float a = mono[k + 3] / 255.f;- if (a <= 0.004f) { mono[k] = mono[k + 1] = mono[k + 2] = mono[k + 3] = 0; continue; }- float oa = a;- if (detail) {- float l = std::clamp((0.2126f * mono[k + 2] + 0.7152f * mono[k + 1] + 0.0722f * mono[k]) / 255.f / a, 0.f, 1.f);- float t = std::clamp((l - lmin) / (lmax - lmin), 0.f, 1.f); // 0 = parte mais escura do original- oa = a * (dark ? 0.30f + 0.70f * t : 1.f - 0.70f * t);- }- oa *= dark ? 0.96f : 0.88f;- BYTE c = (BYTE)std::lround(ink * oa);- mono[k] = mono[k + 1] = mono[k + 2] = c;- mono[k + 3] = (BYTE)std::lround(oa * 255);- }- if (ID2D1Bitmap* bmp = ui::Bitmap(rt, px, px, mono)) {- // no pixel inteiro (1:1 com o bitmap): fora da grade o bitmap era reamostrado e borrava/serrilhava- float cxp = (bx.left + bx.right) / 2 * sc, cyp = H / 2 * sc;- float l0 = std::round(cxp - px / 2.f) / sc, t0 = std::round(cyp - px / 2.f) / sc;- rt->DrawBitmap(bmp, D2D1::RectF(l0, t0, l0 + px / sc, t0 + px / sc), 1, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);- bmp->Release();- }- }- bool anyHidden = false;- for (auto& t : tray::icons) if (!t.hidden && t.icon && !IsShown(t) && !tray::IsPrivacy(t)) anyHidden = true;- if (liquid::Golden() && (g_overflow || anyHidden)) {- // macOS 27 (vídeo, 2:16): quando os ícones não cabem, uma seta dupla » mostra os escondidos- auto bx = slot(14, K_MORE, 0);- float cx = (bx.left + bx.right) / 2, cy = H / 2;- for (int k = 0; k < 2; k++) {- float ox = cx - 3.5f + k * 5.5f;- rt->DrawLine({ ox - 2.2f, cy - 4.5f }, { ox + 2.2f, cy }, br, 1.5f);- rt->DrawLine({ ox + 2.2f, cy }, { ox - 2.2f, cy + 4.5f }, br, 1.5f);- }- anyHidden = false; // já desenhada- }- g_overflow = false;- // setinha dos ícones guardados: não existe no Mac, desligada por padrão (barra_seta=1 liga); a lista abre- // também no botão direito da Central de Controle- if (anyHidden && shell::Setting(L"barra_seta", L"0") == L"1") { // setinha dos ícones guardados: o chevron do SF Symbols, apontando para onde eles abrem- auto bx = slot(8, K_MORE, 0);- if (!sym(L"chevron.left", bx, 12)) {- float cx = (bx.left + bx.right) / 2, cy = H / 2;- rt->DrawLine({ cx + 2, cy - 5 }, { cx - 2.5f, cy }, br, 1.6f);- rt->DrawLine({ cx - 2.5f, cy }, { cx + 2, cy + 5 }, br, 1.6f);- }- }-- // menus do app (entre o nome e os ícones)- for (int i = 0; i < (int)g_titles.size(); i++) {- float w = ui::TextWidth(tfN, g_titles[i]) + 20;- if (x + w > r - 8) break;- add(D2D1::RectF(x, 0, x + w, H), K_MENU, i);- br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);- rt->DrawTextW(g_titles[i].c_str(), (UINT32)g_titles[i].size(), tfN, D2D1::RectF(x + 10, 0, x + w, H), br);- x += w;- }- br->Release();- ui::End(g_s, false);-}--// ---- menus-// Menus próprios, como os do app no Mac, para os apps sem menu Win32 (os itens mandam o atalho do Windows do-// app). Ids: atalhos de g_keyCmds; 0 = separador. No "Janela" os itens vêm antes da lista de janelas.-struct MenuDef { const wchar_t* title; std::vector<int> ids; };-const std::vector<MenuDef>* AppMenus(App* app) {- static const std::vector<MenuDef> browser = {- { L"Arquivo", { 1020, 1001, 5001, 5002, 0, 5003, 5004, 0, 5005, 5006, 5007, 0, 1005 } },- { L"Editar", { 1010, 5070, 0, 1012, 1013, 1014, 1015, 0, 1016 } },- { L"Visualizar", { 5010, 0, 5011, 5012, 5013, 0, 5014, 5015, 5016, 5017, 0, 5018, 5019 } },- { L"Histórico", { 5020, 1040, 1041, 0, 5021, 5022 } },- { L"Favoritos", { 5030, 0, 5031, 5032 } },- { L"Aba", { 5040, 5041 } },- { L"Janela", { 5050, 5051 } },- { L"Ajuda", { 5060 } },- };- static const std::vector<MenuDef> discord = {- { L"Editar", { 1010, 5070, 0, 1012, 1013, 1014, 1015 } },- { L"Visualizar", { 5071, 5072, 0, 5015, 5016, 5017 } },- { L"Janela", {} },- { L"Ajuda", { 5073 } },- };- static const std::vector<MenuDef> whatsapp = {- { L"Arquivo", { 5080, 5081, 0, 1003 } },- { L"Editar", { 1010, 1011, 0, 1012, 1013, 1014, 1015, 0, 1016 } },- { L"Visualizar", { 5015, 5016, 5017 } },- { L"Janela", {} },- { L"Ajuda", {} },- };- static const std::vector<MenuDef> electron = { // Claude e afins: editar e zoom (o padrão do Electron)- { L"Arquivo", { 1001, 0, 1003 } },- { L"Editar", { 1010, 5070, 0, 1012, 1013, 1014, 1015 } },- { L"Visualizar", { 5071, 0, 5015, 5016, 5017 } },- { L"Janela", {} },- { L"Ajuda", {} },- };- // o programa da janela ativa (o App do Chrome casa pelo AUMID e pode vir sem o .exe)- static HWND s_fg; static std::wstring s_path; // a barra pergunta a cada atualização: lido uma vez por janela- std::wstring path = app ? app->exe : L"";- DWORD pid = 0;- if (g_fg && g_fg == s_fg) { if (!s_path.empty()) path = s_path; }- else if (g_fg && GetWindowThreadProcessId(g_fg, &pid) && pid) {- s_fg = g_fg; s_path.clear();- if (HANDLE p = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid)) {- wchar_t buf[MAX_PATH]; DWORD n = MAX_PATH;- if (QueryFullProcessImageNameW(p, 0, buf, &n)) path = s_path = buf;- CloseHandle(p);- }- }- if (path.empty()) return nullptr;- std::wstring n = path.substr(path.find_last_of(L"\\/") + 1);- for (auto& c : n) c = towlower(c);- if (n == L"chrome.exe" || n == L"msedge.exe" || n == L"brave.exe" || n == L"vivaldi.exe") return &browser;- if (n == L"discord.exe" || n == L"discordptb.exe" || n == L"discordcanary.exe") return &discord;- if (n.find(L"whatsapp") != std::wstring::npos) return &whatsapp;- if (n == L"claude.exe") return &electron;- static const std::vector<MenuDef> spotify = {- { L"Arquivo", { 5100, 0, 1003 } },- { L"Editar", { 1010, 1011, 0, 1012, 1013, 1014, 1015, 0, 5108 } },- { L"Visualizar", { 5015, 5016, 5017 } },- { L"Reprodução", { 5101, 5102, 5103, 0, 5104, 5105, 0, 5106, 5107 } },- { L"Janela", {} },- { L"Ajuda", {} },- };- static const std::vector<MenuDef> vscode = {- { L"Arquivo", { 5120, 5121, 0, 1002, 0, 1004, 5122, 0, 5123 } },- { L"Editar", { 1010, 1011, 0, 1012, 1013, 1014, 0, 1016, 5124, 0, 5125 } },- { L"Seleção", { 1015 } },- { L"Visualizar", { 5126, 0, 5127, 5125, 5128, 5129, 0, 5134, 0, 5016, 5017, 5015 } },- { L"Ir", { 5130, 5131 } },- { L"Executar", { 5132, 5133 } },- { L"Janela", {} },- { L"Ajuda", {} },- };- if (n == L"spotify.exe") return &spotify;- if (n == L"code.exe" || n == L"cursor.exe" || n == L"code - insiders.exe") return &vscode;- return nullptr;-}--std::vector<std::wstring> GenericTitles(App* app) {- if (!g_finderActive)- if (auto* defs = AppMenus(app)) {- std::vector<std::wstring> t;- for (auto& d : *defs) t.push_back(Tr(d.title));- return t;- }- if (g_finderActive) return { Tr(L"Arquivo"), Tr(L"Editar"), Tr(L"Visualizar"), Tr(L"Ir"), Tr(L"Janela"), Tr(L"Ajuda") };- return { Tr(L"Arquivo"), Tr(L"Editar"), Tr(L"Janela"), Tr(L"Ajuda") };-}--std::vector<ctxmenu::Item> GenericMenu(const std::wstring& title, App* app) {- std::vector<ctxmenu::Item> pre; // Janela: itens do app antes dos comuns (minimizar, zoom, lista de janelas)- if (auto* defs = g_finderActive ? nullptr : AppMenus(app))- for (auto& d : *defs) {- if (title != Tr(d.title)) continue;- std::vector<ctxmenu::Item> v;- for (int id : d.ids) v.push_back(id ? K(id) : Sep());- if (title != Tr(L"Janela")) {- if (v.empty()) v.push_back(I(Tr(L"Nenhum item"), 0, true));- return v;- }- if (!v.empty()) { pre = v; pre.push_back(Sep()); }- break;- }- if (title == Tr(L"Arquivo")) {- if (g_finderActive) return { K(1001), K(1020), K(1021), Sep(), K(1002), K(1003), Sep(), K(1022), Sep(), K(1023) };- return { K(1001), K(1002), Sep(), K(1003), K(1004), Sep(), K(1005) };- }- if (title == Tr(L"Editar")) return { K(1010), K(1011), Sep(), K(1012), K(1013), K(1014), K(1015), Sep(), K(1016) };- if (title == Tr(L"Visualizar")) return { K(1030), K(1031), K(1032), K(1033), Sep(), K(1034) };- if (title == Tr(L"Ir")) return { K(1040), K(1041), K(1042), Sep(), K(1043), Sep(), I(Tr(L"Recentes"), 1100), I(Tr(L"Documentos"), 1101), I(Tr(L"Mesa"), 1102), I(Tr(L"Downloads"), 1103), I(Tr(L"Início"), 1104), I(Tr(L"Este Computador"), 1105), I(Tr(L"Aplicativos"), 1106) };- if (title == Tr(L"Janela")) {- std::vector<ctxmenu::Item> v{ I(Tr(L"Minimizar"), 1200), I(Tr(L"Zoom"), 1201), Sep(), I(Tr(L"Trazer Tudo para a Frente"), 1202) };- v.insert(v.begin(), pre.begin(), pre.end());- if (app && !app->wins.empty()) {- v.push_back(Sep());- for (int k = 0; k < (int)app->wins.size() && k < 20; k++) {- auto it = I(app->wins[k].title, 3000 + k);- it.checked = app->wins[k].hwnd == g_fg;- v.push_back(it);- }- }- return v;- }- if (title == Tr(L"Ajuda")) return { K(1050) };- return {};-}--std::vector<ctxmenu::Item> LogoMenu() {- std::vector<ctxmenu::Item> recent;- { // Itens Recentes: os atalhos mais novos de shell:Recent- PWSTR p = nullptr;- if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Recent, 0, nullptr, &p))) {- std::wstring dir = p; CoTaskMemFree(p);- std::vector<std::pair<ULONGLONG, std::wstring>> files;- WIN32_FIND_DATAW fd;- HANDLE h = FindFirstFileW((dir + L"\\*.lnk").c_str(), &fd);- if (h != INVALID_HANDLE_VALUE) {- do files.push_back({ ((ULONGLONG)fd.ftLastWriteTime.dwHighDateTime << 32) | fd.ftLastWriteTime.dwLowDateTime, dir + L"\\" + fd.cFileName });- while (FindNextFileW(h, &fd));- FindClose(h);- }- std::sort(files.begin(), files.end(), [](auto& a, auto& b) { return a.first > b.first; });- static std::vector<std::wstring> s_recent;- s_recent.clear();- for (size_t k = 0; k < files.size() && k < 10; k++) {- std::wstring n = files[k].second.substr(files[k].second.find_last_of(L'\\') + 1);- n.resize(n.size() - 4);- s_recent.push_back(files[k].second);- recent.push_back(I(n, 4000 + (int)k));- }- if (recent.empty()) recent.push_back(I(Tr(L"Nenhum item"), 0, true));- }- }- wchar_t user[128] = L""; DWORD n = 128; GetUserNameW(user, &n);- ctxmenu::Item rec = I(Tr(L"Itens Recentes"), 0); rec.sub = recent;- return { I(Tr(L"Sobre Este Mac"), 100), Sep(), I(Tr(L"Ajustes do Sistema…"), 101), I(Tr(L"Microsoft Store…"), 102), Sep(),- rec, Sep(), I(Tr(L"Forçar Encerrar…"), 103), Sep(), I(Tr(L"Repousar"), 104), I(Tr(L"Reiniciar…"), 105), I(Tr(L"Desligar…"), 106), Sep(),- I(Tr(L"Bloquear Tela"), 107), I(Tr(L"Encerrar Sessão de ") + std::wstring(user) + L"…", 108), Sep(), I(Tr(L"Sair do Shell (voltar à barra do Windows)"), 109) };-}--std::vector<ctxmenu::Item> AppMenu(App* a) {- std::wstring n = a ? a->name : g_appName;- return { I(Tr(L"Sobre ") + n, 200), Sep(), K(1051), Sep(), I(Tr(L"Ocultar ") + n, 201), I(Tr(L"Ocultar Outros"), 202), I(Tr(L"Mostrar Tudo"), 203), Sep(), I(Tr(L"Encerrar ") + n, 204) };-}---void Shutdown(UINT how) {- HANDLE tok;- if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tok)) {- TOKEN_PRIVILEGES tp{ 1 };- LookupPrivilegeValueW(nullptr, SE_SHUTDOWN_NAME, &tp.Privileges[0].Luid);- tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;- AdjustTokenPrivileges(tok, FALSE, &tp, 0, nullptr, nullptr);- CloseHandle(tok);- }- ExitWindowsEx(how, SHTDN_REASON_FLAG_PLANNED);-}--void Open(const wchar_t* what, const wchar_t* args = nullptr) {- if (!wcsncmp(what, L"ms-settings:", 12)) { shell::OpenSettings(what); return; } // o nosso Ajustes do Sistema- ShellExecuteW(nullptr, L"open", what, args, nullptr, SW_SHOWNORMAL);-}--void OpenFinder(const std::wstring& args) {- if (shell::nativo) { shell::AbrirFinder(args); return; }- for (auto& a : apps::list) if (a.finder) { ShellExecuteW(nullptr, L"open", a.launch.c_str(), args.c_str(), nullptr, SW_SHOWNORMAL); return; }-}--void Run(int id, App* app) {- for (auto& k : g_keyCmds) if (k.id == id) { // atalho de teclado para o app ativo- if (g_fg) SetForegroundWindow(g_fg);- Sleep(30);- SendKeys(k.keys);- return;- }- if (id >= 1000 && id < 1100) return;- switch (id) {- case 100: sobre::Show(); break;- case 101: shell::OpenSettings(L""); break;- case 102: Open(L"ms-windows-store:"); break;- case 103: shell::OpenForceQuit(false); break;- case 104: SetSuspendState(FALSE, FALSE, FALSE); break;- // como no Mac: alerta com o ícone do computador, Cancelar | Reiniciar/Desligar (antes era a caixa do Windows)- case 105: alertas::Confirm(Tr(L"Tem certeza de que deseja reiniciar o computador agora?"), L"", Tr(L"Reiniciar"), [] { Shutdown(EWX_REBOOT); }, L"pack:macstudio"); break;- case 106: alertas::Confirm(Tr(L"Tem certeza de que deseja desligar o computador agora?"), L"", Tr(L"Desligar"), [] { Shutdown(EWX_POWEROFF); }, L"pack:macstudio"); break;- case 107: bloqueio::Lock(); break; // a nossa tela de bloqueio (o LockWorkStation fica desligado pela política enquanto o Shell roda: não fazia nada, issue #8)- case 108: alertas::Confirm(Tr(L"Tem certeza de que deseja encerrar todos os aplicativos e sair agora?"), L"", Tr(L"Encerrar Sessão"), [] { ExitWindowsEx(EWX_LOGOFF, 0); }, L"pack:macstudio"); break;- case 109: shell::Quit(L"menu do logo"); break;- case 200: if (app && !app->exe.empty()) ShellExecuteW(nullptr, L"properties", app->exe.c_str(), nullptr, nullptr, SW_SHOWNORMAL); break;- case 201: if (app) apps::Hide(*app); break;- case 202: for (auto& a : apps::list) if (&a != app) apps::Hide(a); break;- case 203: for (auto& a : apps::list) for (auto& w : a.wins) if (w.minimized) ShowWindow(w.hwnd, SW_SHOWNOACTIVATE); break;- case 204: if (app) apps::Quit(*app); break;- case 1100: OpenFinder(L"shell:Recent"); break;- case 1101: OpenFinder(L"shell:Personal"); break;- case 1102: OpenFinder(L"shell:Desktop"); break;- case 1103: OpenFinder(L"shell:Downloads"); break;- case 1104: OpenFinder(L"shell:Profile"); break;- case 1105: OpenFinder(L"shell:MyComputerFolder"); break;- case 1106: OpenFinder(L"shell:Common Programs"); break;- case 1200: if (g_fg) ShowWindow(g_fg, SW_MINIMIZE); break;- case 1201: if (g_fg) ShowWindow(g_fg, IsZoomed(g_fg) ? SW_RESTORE : SW_MAXIMIZE); break;- case 1202: if (app) apps::Activate(*app); break;- }- if (id >= 3000 && id < 3100 && app && id - 3000 < (int)app->wins.size()) {- HWND w = app->wins[id - 3000].hwnd;- if (IsIconic(w)) shell::Restaurar(w);- SetForegroundWindow(w);- }-}--int g_closedHit = -1; DWORD g_closedHitAt; // o título cujo menu acabou de fechar (clicar nele de novo só fecha)-void ShowAt(int hit, const std::vector<ctxmenu::Item>& items, std::function<void(int)> done) {- g_open = hit;- g_openBar = Cur();- Render();- float sc = ui::Scale(Cur());- RECT wr; GetWindowRect(Cur(), &wr);- POINT pt{ wr.left + (LONG)std::lround(g_hits[hit].r.left * sc), wr.bottom };- // Tahoe (guia, seção 35): o menu abre 1 pt abaixo da barra e 4 pt à esquerda do título (o texto fica a 10 da caixa)- if (liquid::On()) pt = { wr.left + (LONG)std::lround((g_hits[hit].r.left + 6) * sc), wr.bottom + (LONG)std::lround(sc) };- SetForegroundWindow(g_owner); // o menu fecha se a janela dona não estiver na frente- int id = ctxmenu::ShowItems(g_owner, pt, items);- g_closedHit = hit; g_closedHitAt = GetTickCount();- g_open = -1;- Render();- if (g_fg && IsWindow(g_fg)) SetForegroundWindow(g_fg);- if (id) done(id);-}--void Click(D2D1_POINT_2F p, bool right) {- int hit = -1;- for (int i = 0; i < (int)g_hits.size(); i++)- if (p.x >= g_hits[i].r.left && p.x < g_hits[i].r.right) { hit = i; break; }- if (hit < 0) return;- if (!right && hit == g_closedHit && GetTickCount() - g_closedHitAt < 400) { g_closedHit = -1; return; } // clique no mesmo título: só fechou- g_closedHit = -1;- Hit h = g_hits[hit];- App* app = ActiveApp();- float sc = ui::Scale(Cur());- RECT wr; GetWindowRect(Cur(), &wr);- POINT spt{ wr.left + (LONG)std::lround((h.r.left + h.r.right) / 2 * sc), wr.bottom };- switch (h.kind) {- case K_LOGO: ShowAt(hit, LogoMenu(), [&](int id) {- if (id >= 4000 && id < 4010) { // item recente- PWSTR p = nullptr; SHGetKnownFolderPath(FOLDERID_Recent, 0, nullptr, &p);- std::wstring dir = p; CoTaskMemFree(p);- std::vector<std::pair<ULONGLONG, std::wstring>> files;- WIN32_FIND_DATAW fd; HANDLE fh = FindFirstFileW((dir + L"\\*.lnk").c_str(), &fd);- if (fh != INVALID_HANDLE_VALUE) { do files.push_back({ ((ULONGLONG)fd.ftLastWriteTime.dwHighDateTime << 32) | fd.ftLastWriteTime.dwLowDateTime, dir + L"\\" + fd.cFileName }); while (FindNextFileW(fh, &fd)); FindClose(fh); }- std::sort(files.begin(), files.end(), [](auto& a, auto& b) { return a.first > b.first; });- if (id - 4000 < (int)files.size()) Open(files[id - 4000].second.c_str());- } else Run(id, app);- }); break;- case K_APP: ShowAt(hit, AppMenu(app), [&](int id) { Run(id, app); }); break;- case K_MENU:- if (g_hmenu && IsMenu(g_hmenu)) {- HMENU sub = GetSubMenu(g_hmenu, h.index);- if (!sub) break;- SendMessageTimeoutW(g_fg, WM_INITMENU, (WPARAM)g_hmenu, 0, SMTO_ABORTIFHUNG, 200, nullptr);- SendMessageTimeoutW(g_fg, WM_INITMENUPOPUP, (WPARAM)sub, h.index, SMTO_ABORTIFHUNG, 200, nullptr);- HWND target = g_fg;- ShowAt(hit, FromHmenu(sub, 0), [&](int id) { PostMessageW(target, WM_COMMAND, MAKEWPARAM(id, 0), 0); });- } else ShowAt(hit, GenericMenu(g_titles[h.index], app), [&](int id) { Run(id, app); });- break;- case K_TRAY: tray::Click(h.index, right ? WM_RBUTTONUP : WM_LBUTTONUP, spt); break;- case K_CC:- if (!right) { central::Toggle(); break; }- [[fallthrough]]; // botão direito: a lista dos ícones guardados (a setinha fica desligada, como no Mac)- case K_MORE: { // lista dos ícones guardados: abrir, menu do app, mostrar na barra- std::vector<ctxmenu::Item> items;- std::vector<int> idx;- for (int i = 0; i < (int)tray::icons.size(); i++) {- auto& t = tray::icons[i];- if (t.hidden || !t.icon || tray::IsPrivacy(t)) continue;- std::wstring name = TrayKey(t);- if (name.empty()) name = Tr(L"(sem nome)");- ctxmenu::Item it = I(name, 0);- it.sub = { I(Tr(L"Abrir"), 1000 + i * 4), I(Tr(L"Menu do App"), 1001 + i * 4), Sep(), I(Tr(L"Mostrar na barra de menus"), 1002 + i * 4, false, IsShown(t)) };- items.push_back(it);- }- ShowAt(hit, items, [&](int id) {- int i = (id - 1000) / 4, op = (id - 1000) % 4;- if (i < 0 || i >= (int)tray::icons.size()) return;- if (op == 2) { SetShown(tray::icons[i], !IsShown(tray::icons[i])); return; }- tray::Click(i, op == 1 ? WM_RBUTTONUP : WM_LBUTTONUP, spt);- });- break;- }- case K_SPOT: spotlight::Toggle(); break;- case K_NET: {- std::wstring ssid;- bool wifi = WifiName(ssid);- ShowAt(hit, { I(wifi ? L"Wi-Fi: " + ssid : L"Ethernet", 0, true), Sep(), I(Tr(L"Ajustes de Rede…"), 1) }, [](int) { Open(L"ms-settings:network"); });- break;- }- case K_SOUND: { // menu "Som" do Mac (som.cpp): volume, saídas e Ajustes de Som- RECT ir{ wr.left + (LONG)std::lround(h.r.left * sc), wr.top, wr.left + (LONG)std::lround(h.r.right * sc), wr.bottom };- som::Toggle(ir);- break;- }- case K_BT: ShowAt(hit, { I(Tr(L"Bluetooth"), 0, true), Sep(), I(Tr(L"Ajustes de Bluetooth…"), 1) }, [](int) { shell::OpenSettings(L"bluetooth"); }); break;- case K_BATT: {- wchar_t b[64]; swprintf_s(b, Tr(L"Bateria: %d%%"), g_st.pct);- ShowAt(hit, { I(b, 0, true), I(g_st.charging ? Tr(L"Fonte de Energia: Carregador") : Tr(L"Fonte de Energia: Bateria"), 0, true), Sep(), I(Tr(L"Ajustes de Bateria…"), 1) },- [](int) { shell::OpenSettings(L"energia"); });- break;- }- case K_INPUT: { // as fontes de entrada instaladas; a escolhida vai para o app da frente- HKL list[32]; int n = GetKeyboardLayoutList(32, list);- std::vector<ctxmenu::Item> items;- for (int i = 0; i < n; i++) items.push_back(I(InputBadge(list[i]) + L" " + LayoutName(list[i]), 100 + i, false, list[i] == g_st.hkl));- items.push_back(Sep());- items.push_back(I(Tr(L"Abrir Ajustes de Teclado…"), 1));- HWND target = g_fg;- ShowAt(hit, items, [&](int id) {- if (id == 1) { shell::OpenSettings(L"teclado"); return; }- if (id >= 100 && id - 100 < n && target) PostMessageW(target, WM_INPUTLANGCHANGEREQUEST, 0, (LPARAM)list[id - 100]);- RefreshStatus(); Render();- });- break;- } // painel da Central de Controle (central.cpp)- case K_CLOCK: {- if (!right) { notificacoes::Toggle(); break; } // clique: Central de Notificações; botão direito: data e ajustes- SYSTEMTIME st; GetLocalTime(&st);- wchar_t full[128] = {};- GetDateFormatEx(idioma::Locale(), DATE_LONGDATE, &st, nullptr, full, 128, nullptr);- ShowAt(hit, { I(full, 0, true), Sep(), I(Tr(L"Ajustes de Data e Hora…"), 1) }, [](int) { Open(L"ms-settings:dateandtime"); });- break;- }- }-}--// Desenha todas as barras (a principal por último: os itens dela ficam em g_hits de quem chama sem g_cur)-void RenderAll() {- HWND keep = g_cur;- for (HWND b : g_extras) if (IsWindowVisible(b)) { g_cur = b; Render(); }- g_cur = nullptr;- Render();- g_cur = keep;-}--// Redesenha só quando algo visível mudou (antes: a barra inteira a cada segundo)-void RenderIfChanged() {- static std::wstring last;- std::wstring sig = g_appName + L"|" + ClockText() + L"|" + std::to_wstring(ui::Dark()) + L"|" + std::to_wstring(g_titles.size());- for (auto& t : g_titles) sig += t;- wchar_t b[128];- swprintf_s(b, L"|%d%d%d%d%d%d%d|%d|%d|%p|%d", g_st.wlan, g_st.wifiOn, g_st.batt, g_st.charging, g_st.bt, g_st.sound, g_st.muted,- g_st.pct, (int)std::lround(g_st.vol * 3), (void*)g_st.hkl, g_st.phones);- sig += b;- for (auto& t : tray::icons) { swprintf_s(b, L"|%p%d%d", (void*)t.icon, t.hidden, IsShown(t)); sig += b; }- RECT rc; GetClientRect(g_bar, &rc);- sig += std::to_wstring(rc.right) + L"x" + std::to_wstring(rc.bottom);- for (HWND b : g_extras) { GetClientRect(b, &rc); sig += L"|" + std::to_wstring(rc.right) + L"x" + std::to_wstring(IsWindowVisible(b)); }- if (sig == last) return;- last = sig;- RenderAll();-}--const UINT WM_BARDISPLAYS = WM_APP + 41; // monitores mudaram: refaz as barras (fora do WndProc que recebeu o aviso)--// Barra de menus de vidro (Ajustes > Transparência > "Barra de menus de vidro", barra_vidro=1, só no Liquid Glass):-// como o Dock, uma janela logo atrás de cada barra com o vidro do backdrop (o real: captura da tela, desfoque leve,-// vibrância, borda que refrata e brilho). Sem ela a barra do Tahoe não tem fundo nenhum, e em papel de parede-// cheio de detalhe as letras sumiam (pedido de 22/11/2026).-std::map<HWND, HWND> g_vidro; // barra -> janela de vidro atrás dela-// o último lugar/tinta passados ao vidro de cada barra: o relógio chama SyncVidro a cada segundo e, sem mudança, não se-// mexe em nada (antes: SetWindowPos + backdrop::Set a cada segundo, e cada SetWindowPos fazia o vidro real refazer a-// lista de janelas e remontar o fundo inteiro; o Set igual ainda redesenhava a peça)-struct VidroUlt { RECT r{}; bool white = false, ok = false; };-std::map<HWND, VidroUlt> g_vidroUlt;-bool GlassBarOn() { return backdrop::Liquid() && !liquid::Leopard() && shell::Setting(L"barra_vidro", L"0") == L"1"; }-LRESULT CALLBACK VidroProc(HWND h, UINT m, WPARAM w, LPARAM l) {- if (m == WM_MOUSEACTIVATE) return MA_NOACTIVATE;- if (m == WM_NCHITTEST) return HTTRANSPARENT;- if (m == WM_PAINT) { PAINTSTRUCT ps; BeginPaint(h, &ps); EndPaint(h, &ps); return 0; }- return DefWindowProcW(h, m, w, l);-}-void SyncVidro(HWND bar) {- auto it = g_vidro.find(bar);- HWND v = it != g_vidro.end() ? it->second : nullptr;- if (!GlassBarOn() || !IsWindow(bar) || !IsWindowVisible(bar)) {- if (v && IsWindowVisible(v)) ShowWindow(v, SW_HIDE);- g_vidroUlt[bar].ok = false;- return;- }- if (!v) {- if (it != g_vidro.end()) return; // já falhou nesta barra- static bool reg;- if (!reg) { WNDCLASSW c{}; c.lpfnWndProc = VidroProc; c.hInstance = shell::inst; c.lpszClassName = L"ShellBarraVidro"; RegisterClassW(&c); reg = true; }- v = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_TRANSPARENT | WS_EX_NOREDIRECTIONBITMAP, L"ShellBarraVidro", L"",- WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, shell::inst, nullptr);- if (!v || !backdrop::Attach(v)) {- if (v) DestroyWindow(v);- g_vidro[bar] = nullptr;- Log(L"barra de menus: vidro indisponível");- return;- }- apps::ours.push_back(v);- g_vidro[bar] = v;- }- RECT r; GetWindowRect(bar, &r);- const int w = r.right - r.left, h = r.bottom - r.top;- if (w <= 0 || h <= 0) { ShowWindow(v, SW_HIDE); g_vidroUlt[bar].ok = false; return; }- // tinta pela cor do texto (que segue o papel de parede): letras pretas -> vidro claro; brancas -> vidro escuro- bool white = WallpaperTopDark(ui::Dark());- VidroUlt& u = g_vidroUlt[bar];- const bool same = u.ok && EqualRect(&u.r, &r) && u.white == white && IsWindowVisible(v);- // logo atrás da barra (o vidro não passa por cima de nada além dela); só se mudou ou se algo entrou entre os dois- if (!same || GetWindow(bar, GW_HWNDNEXT) != v) SetWindowPos(v, bar, r.left, r.top, w, h, SWP_NOACTIVATE | SWP_SHOWWINDOW);- if (same) return;- D2D1_COLOR_F tint = white ? D2D1::ColorF(0.12f, 0.12f, 0.13f, 0.26f) : D2D1::ColorF(0.98f, 0.98f, 0.99f, 0.34f);- backdrop::Set(v, (float)w, (float)h, 0.f, tint);- u.r = r; u.white = white; u.ok = true;-}-void DropVidro(HWND bar) {- auto it = g_vidro.find(bar);- if (it == g_vidro.end()) return;- if (it->second) { backdrop::Detach(it->second); DestroyWindow(it->second); }- g_vidro.erase(it);- g_vidroUlt.erase(bar);-}--LRESULT CALLBACK BarProc(HWND h, UINT m, WPARAM w, LPARAM l) {- switch (m) {- case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(h, &ps); EndPaint(h, &ps); HWND keep = g_cur; g_cur = h; Render(); g_cur = keep; return 0; }- case WM_LBUTTONDOWN: case WM_RBUTTONUP: {- float sc = ui::Scale(h);- HWND keep = g_cur;- g_cur = h; // os menus abrem embaixo da barra clicada (no monitor dela)- Click({ (short)LOWORD(l) / sc, (short)HIWORD(l) / sc }, m == WM_RBUTTONUP);- g_cur = keep;- return 0;- }- case WM_BARDISPLAYS: menubar::Displays(); return 0;- case WM_MOUSEACTIVATE: return MA_NOACTIVATE;- case WM_TIMER:- RefreshStatus(); menubar::Update();- SyncVidro(g_bar); for (HWND b : g_extras) SyncVidro(b); // ligado/desligado nos Ajustes, tinta, monitores- return 0;- case WM_WINDOWPOSCHANGED: SyncVidro(h); break; // o vidro acompanha a barra (lugar, tamanho, escondida)- case WM_DESTROY: DropVidro(h); break;- case WM_SETTINGCHANGE: // Windows trocou entre claro e escuro- if (l && !lstrcmpiW((LPCWSTR)l, L"ImmersiveColorSet")) { menubar::ApplyTheme(); dock::ApplyTheme(); }- break;- case WM_DPICHANGED: case WM_DISPLAYCHANGE:- // todas as barras recebem o aviso: só a principal refaz (depois, fora deste WndProc)- PostMessageW(g_bar, WM_BARDISPLAYS, 0, 0);- return 0;- }- return DefWindowProcW(h, m, w, l);-}--} // namespace--HWND menubar::Hwnd() { return g_bar; }-void menubar::SoundChanged(bool device) {- if (!g_bar) return;- if (device) g_audioStale = true;- RefreshStatus();- if (g_open < 0) RenderAll();-}-bool menubar::SoundIcon(RECT* out) {- if (!g_bar || !IsWindowVisible(Cur())) return false;- for (auto& h : g_hits)- if (h.kind == K_SOUND) {- float sc = ui::Scale(Cur());- RECT wr; GetWindowRect(Cur(), &wr);- *out = { wr.left + (LONG)std::lround(h.r.left * sc), wr.top, wr.left + (LONG)std::lround(h.r.right * sc), wr.bottom };- return true;- }- return false;-}-void menubar::ApplyTheme() {- if (!g_bar) return;- { // tema trocado (Sequoia 26 pt / Tahoe 30 pt): a barra muda de altura- static float lastPt = 0;- if (lastPt && lastPt != BAR_PT) menubar::Displays();- lastPt = BAR_PT;- }- BarGlass(g_bar);- InvalidateRect(g_bar, nullptr, FALSE);- for (HWND b : g_extras) { BarGlass(b); InvalidateRect(b, nullptr, FALSE); }-}-static bool g_fsOn;-static HMONITOR g_fsMon;-void menubar::SetFullscreen(bool on, HMONITOR mon) {- if (!g_bar) return;- g_fsOn = on; g_fsMon = mon;- std::vector<HWND> all{ g_bar };- all.insert(all.end(), g_extras.begin(), g_extras.end());- for (HWND b : all) {- bool hide = on && (!mon || MonitorFromWindow(b, MONITOR_DEFAULTTONEAREST) == mon); // só a barra do monitor em tela cheia- if (hide == !IsWindowVisible(b)) continue;- ShowWindow(b, hide ? SW_HIDE : SW_SHOWNOACTIVATE);- if (!hide) SetWindowPos(b, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);- }-}-int menubar::Height() { return g_bar ? (int)std::lround(BAR_PT * ui::Scale(g_bar)) : (int)std::lround(BAR_PT * GetDpiForSystem() / 96.f); }-int menubar::HeightOn(HMONITOR mon) {- UINT dx = 96, dy = 96;- if (FAILED(GetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &dx, &dy))) dx = GetDpiForSystem();- return (int)std::lround(BAR_PT * dx / 96.f);-}--static bool AllMonitors() { return shell::Setting(L"barra_todos_monitores", L"1") != L"0"; }-// O que a barra ocupa no topo do monitor (área de trabalho, Dock lateral): 0 nos secundários sem barra-int menubar::ReservedOn(HMONITOR mon) {- MONITORINFO mi{ sizeof(mi) };- bool prim = GetMonitorInfoW(mon, &mi) && (mi.dwFlags & MONITORINFOF_PRIMARY);- if (prim) return Height();- return AllMonitors() ? HeightOn(mon) : 0;-}--// Uma barra em cada monitor (como no Mac): a principal no monitor principal e uma igual em cada um dos outros.-void menubar::Displays() {- if (!g_bar) return;- struct Mon { HMONITOR hm; RECT r; };- std::vector<Mon> others;- Mon prim{};- std::pair<std::vector<Mon>*, Mon*> ctx{ &others, &prim };- EnumDisplayMonitors(nullptr, nullptr, [](HMONITOR hm, HDC, LPRECT, LPARAM p) -> BOOL {- MONITORINFO mi{ sizeof(mi) };- if (!GetMonitorInfoW(hm, &mi)) return TRUE;- auto* v = (std::pair<std::vector<Mon>*, Mon*>*)p;- if (mi.dwFlags & MONITORINFOF_PRIMARY) *v->second = { hm, mi.rcMonitor };- else v->first->push_back({ hm, mi.rcMonitor });- return TRUE;- }, (LPARAM)&ctx);- if (!prim.hm) { prim.hm = MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY); MONITORINFO mi{ sizeof(mi) }; GetMonitorInfoW(prim.hm, &mi); prim.r = mi.rcMonitor; }- // "Mostrar a barra de menus em todos os monitores" desligado (barra_todos_monitores=0): só a do principal- if (!AllMonitors()) others.clear();- SetWindowPos(g_bar, HWND_TOPMOST, prim.r.left, prim.r.top, prim.r.right - prim.r.left, HeightOn(prim.hm), SWP_NOACTIVATE);- // sobrando (monitor desligado): fecha- while (g_extras.size() > others.size()) {- HWND b = g_extras.back();- g_extras.pop_back();- apps::ours.erase(std::remove(apps::ours.begin(), apps::ours.end(), b), apps::ours.end());- if (g_cur == b) g_cur = nullptr;- if (g_openBar == b) g_openBar = nullptr;- DestroyWindow(b);- g_state.erase(b);- }- // faltando (monitor novo): cria- while (g_extras.size() < others.size()) {- HWND b = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, L"ShellBarraDeMenus", L"Barra de menus", WS_POPUP,- 0, 0, 100, 20, nullptr, nullptr, (HINSTANCE)GetWindowLongPtrW(g_bar, GWLP_HINSTANCE), nullptr);- if (!b) break;- g_extras.push_back(b);- apps::ours.push_back(b);- g_state[b].s.hwnd = b;- DWORD corner = 1;- DwmSetWindowAttribute(b, 33, &corner, sizeof(corner));- BarGlass(b);- }- for (size_t i = 0; i < g_extras.size(); i++) {- const RECT& r = others[i].r;- bool hide = g_fsOn && (!g_fsMon || g_fsMon == others[i].hm);- SetWindowPos(g_extras[i], HWND_TOPMOST, r.left, r.top, r.right - r.left, HeightOn(others[i].hm),- SWP_NOACTIVATE | (hide ? 0 : SWP_SHOWWINDOW));- }- static size_t lastN = (size_t)-1;- if (lastN != g_extras.size()) { lastN = g_extras.size(); Log(L"barra de menus: %zu monitor(es) a mais", lastN); }- RenderAll();- shell::ApplyWorkArea();-}--bool menubar::Create(HINSTANCE hi) {- WNDCLASSW wc{}; wc.lpfnWndProc = BarProc; wc.hInstance = hi; wc.lpszClassName = L"ShellBarraDeMenus";- wc.hCursor = LoadCursorW(nullptr, IDC_ARROW);- RegisterClassW(&wc);- WNDCLASSW oc{}; oc.lpfnWndProc = DefWindowProcW; oc.hInstance = hi; oc.lpszClassName = L"ShellDonoDosMenus";- RegisterClassW(&oc);- g_owner = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, oc.lpszClassName, L"", WS_POPUP | WS_VISIBLE, -32000, -32000, 1, 1, nullptr, nullptr, hi, nullptr);- SetLayeredWindowAttributes(g_owner, 0, 0, LWA_ALPHA);- g_bar = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, wc.lpszClassName, L"Barra de menus", WS_POPUP,- 0, 0, GetSystemMetrics(SM_CXSCREEN), menubar::Height(), nullptr, nullptr, hi, nullptr);- if (!g_bar) return false;- apps::ours.push_back(g_bar);- apps::ours.push_back(g_owner);- g_s.hwnd = g_bar;- DWORD corner = 1; // sem cantos arredondados- DwmSetWindowAttribute(g_bar, 33, &corner, sizeof(corner));- BarGlass(g_bar);- g_tf = ui::Format(13.5f, DWRITE_FONT_WEIGHT_MEDIUM); // o Mac desenha a barra com vibrância: as letras parecem mais cheias- g_tfBold = ui::Format(13.5f, DWRITE_FONT_WEIGHT_BOLD);- g_tfBadge = ui::Format(10, DWRITE_FONT_WEIGHT_NORMAL, false, DWRITE_TEXT_ALIGNMENT_CENTER); // sem negrito (issue #8)- if (g_tfBadge) g_tfBadge->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);- g_tfIcon = ui::Format(14, DWRITE_FONT_WEIGHT_NORMAL, true, DWRITE_TEXT_ALIGNMENT_CENTER);- RefreshStatus();- ShowWindow(g_bar, SW_SHOWNOACTIVATE);- SetTimer(g_bar, 1, 1000, nullptr);- Update();- Displays(); // uma barra igual em cada um dos outros monitores- return true;-}--void menubar::Update() {- HWND fg = GetForegroundWindow();- if (fg && !apps::IsShellWindow(fg)) {- HWND root = GetAncestor(fg, GA_ROOTOWNER);- if (root) fg = root;- wchar_t cls[64] = {}; GetClassNameW(fg, cls, 64);- bool desktop = mesa::IsDeskClass(cls) || !wcscmp(cls, L"Shell_TrayWnd");- if (desktop) { g_finderActive = true; g_fg = nullptr; }- else if (fg != g_fg) {- g_fg = fg;- App* a = apps::OfWindow(fg);- g_finderActive = a && a->finder;- }- }- App* a = ActiveApp();- g_appName = a ? a->name : L"Finder";- if (wchar_t cls[32] = {}; g_fg && GetClassNameW(g_fg, cls, 32) && !wcscmp(cls, L"AjustesJanela")) g_appName = TrPick(L"Ajustes do Sistema", L"System Settings");- g_hmenu = (g_fg && !g_finderActive) ? GetMenu(g_fg) : nullptr;- if (!g_hmenu && g_fg && !g_finderActive) g_hmenu = (HMENU)GetPropW(g_fg, L"MacJanelaMenu"); // tirada da janela pela MacJanela.dll- g_titles.clear();- if (g_hmenu && IsMenu(g_hmenu)) {- int n = GetMenuItemCount(g_hmenu);- for (int k = 0; k < n; k++) {- wchar_t buf[128] = {};- GetMenuStringW(g_hmenu, k, buf, 127, MF_BYPOSITION);- if (buf[0]) g_titles.push_back(Clean(buf));- else g_titles.push_back(L"?");- }- } else {- g_hmenu = nullptr;- g_titles = GenericTitles(a);- }- if (g_open < 0) RenderIfChanged();-}+// Barra de menus no topo, como no macOS Sequoia: logo (menu do sistema), nome do app ativo em+// negrito, menus do app; à direita os ícones de status (bandeja), rede, Spotlight, Central de+// Controle e relógio. Ver docs/dock-e-barra-de-menus.md.+#include "shell.h"+#include "../comum/simbolos.h"+static const wchar_t* IconePC() { return shell::Setting(L"sobre_mac", L"pc") == L"macstudio" ? L"pack:macstudio" : L"sym:pc"; }+#include "../menu/context_menu.h"+#include <shellapi.h>+#include <dwmapi.h>+#include <wincodec.h>+#include <shlobj.h>+#include <powrprof.h>+#include <wlanapi.h>+#include <mmdeviceapi.h>+#include <endpointvolume.h>+#include <bluetoothapis.h>+#include <propsys.h>+#pragma comment(lib, "bthprops.lib")+#include <shellscalingapi.h>+#include <iphlpapi.h>+#pragma comment(lib, "iphlpapi.lib")+#include <algorithm>+#include <cmath>+#include <map>+#include <atomic>+#include <mutex>+#include <thread>+#include "../comum/idioma.h"++static void TiqueOcultar(); // ocultar a barra automaticamente (mais abaixo, fora do namespace)+namespace {++const float BAR_PT_SEQUOIA = 26; // altura da barra (telas sem entalhe; um pouco maior que os 24 pt do Mac, para telas grandes)+// Tahoe: 30 pt, medido no macOS 26 (guia macOS26-Theme-Reference, seções 13 e 35: frame.maxY − visibleFrame.maxY)+// Leopard: 22 pt, a barra do Mac OS X 10.5+#define BAR_PT (liquid::On() ? 30.f : liquid::Leopard() ? 22.f : BAR_PT_SEQUOIA)+const float PAD_SEQUOIA = 10; // espaço de cada lado de um ícone de status (Mac: ~10 pt, um item a cada ~38 pt)+// Tahoe (guia, seção 35): cada item da direita = o ícone + ~8 pt de respiro de cada lado (31–42 pt por item)+#define PAD (liquid::On() ? 8.f : PAD_SEQUOIA)++bool g_overflow; // macOS 27: algum ícone da bandeja não coube na barra (mostra a »)+enum Kind { K_LOGO, K_APP, K_MENU, K_TRAY, K_NET, K_SPOT, K_CC, K_CLOCK, K_MORE, K_BATT, K_SOUND, K_BT, K_INPUT, K_SIRI };+struct Hit { D2D1_RECT_F r; Kind kind; int index; };++HWND g_bar, g_owner; // g_bar: a barra do monitor principal+// Uma barra em cada monitor (como no Mac), todas com o mesmo conteúdo. Cada uma tem a sua superfície e os+// seus itens clicáveis; g_cur é a que está sendo desenhada/clicada agora (nullptr = a principal), e g_s/g_hits+// apontam para as dela.+struct BarState { ui::Surface s; std::vector<Hit> hits; };+std::map<HWND, BarState> g_state;+std::vector<HWND> g_extras; // barras dos outros monitores+HWND g_cur, g_openBar;+HWND Cur() { return g_cur ? g_cur : g_bar; }+#define g_s (g_state[Cur()].s)+#define g_hits (g_state[Cur()].hits)+int g_open = -1; // índice em g_hits do item com menu aberto (na barra g_openBar)+int g_vaoE = 0, g_vaoD = 0; // barra embaixo: o trecho do Dock na linha dela (px da janela da barra); 0-0 = em cima+HWND g_fg; // janela do app ativo (fora as nossas)+std::wstring g_appName = L"Finder";+std::vector<std::wstring> g_titles; // menus do app ativo+HMENU g_hmenu; // menu Win32 real do app (se tiver)+bool g_finderActive = true;+IDWriteTextFormat *g_tf, *g_tfBold, *g_tfIcon, *g_tfBadge;++// Como no Mac, a barra mostra pouca coisa: os ícones de bandeja só aparecem se o usuário fixar+// ("Mostrar na barra de menus"); os outros ficam na lista da setinha. Guardados pelo nome (dica).+std::vector<std::wstring> Shown() {+ std::vector<std::wstring> v;+ std::wstring s = shell::Setting(L"barra_icones", L"");+ size_t a = 0, b;+ while ((b = s.find(L'|', a)) != std::wstring::npos) { if (b > a) v.push_back(s.substr(a, b - a)); a = b + 1; }+ if (a < s.size()) v.push_back(s.substr(a));+ return v;+}+// Apps Electron (Discord) põem o ícone sem dica: aparecia "(sem nome)" na lista e não dava para fixar, porque o nome+// vazio some ao ler barra_icones (issue #30). Sem dica vale o nome do programa dono (Discord.exe -> Discord): é estável+// e sai sem ler o disco. Guardado por janela e processo (o número de uma janela fechada pode voltar em outro app).+std::wstring ProgramaDoIcone(HWND h) {+ DWORD pid = 0;+ if (!h || !GetWindowThreadProcessId(h, &pid) || !pid) return L"";+ static std::map<std::pair<HWND, DWORD>, std::wstring> nomes;+ auto chave = std::make_pair(h, pid);+ if (auto it = nomes.find(chave); it != nomes.end()) return it->second;+ std::wstring nome;+ if (HANDLE p = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid)) {+ wchar_t b[MAX_PATH]; DWORD n = MAX_PATH;+ if (QueryFullProcessImageNameW(p, 0, b, &n)) {+ nome = b;+ nome = nome.substr(nome.find_last_of(L'\\') + 1);+ if (nome.size() > 4 && !_wcsicmp(nome.c_str() + nome.size() - 4, L".exe")) nome.resize(nome.size() - 4);+ if (!nome.empty()) nome[0] = towupper(nome[0]);+ }+ CloseHandle(p);+ }+ if (nomes.size() > 256) nomes.clear();+ return nomes[chave] = nome;+}+std::wstring TrayKey(const TrayIcon& t) { // nome estável: a dica até a primeira quebra de linha ou ":"; sem dica, o programa+ std::wstring k = t.tip.substr(0, t.tip.find_first_of(L"\r\n:"));+ while (!k.empty() && k.back() == L' ') k.pop_back();+ return k.empty() ? ProgramaDoIcone(t.hwnd) : k;+}+bool IsShown(const TrayIcon& t) {+ if (shell::Setting(L"barra_icones_todos", L"0") == L"1") return true; // Central de Controle: "Sempre na barra de menus"+ std::wstring k = TrayKey(t);+ for (auto& s : Shown()) if (!_wcsicmp(s.c_str(), k.c_str())) return true;+ return false;+}+void SetShown(const TrayIcon& t, bool on) {+ auto v = Shown();+ std::wstring k = TrayKey(t);+ v.erase(std::remove_if(v.begin(), v.end(), [&](const std::wstring& x) { return !_wcsicmp(x.c_str(), k.c_str()); }), v.end());+ if (on) v.push_back(k);+ std::wstring out;+ for (auto& x : v) { if (!out.empty()) out += L"|"; out += x; }+ shell::SetSetting(L"barra_icones", out);+}++std::wstring Clean(const wchar_t* s, std::wstring* shortcut = nullptr) {+ std::wstring out;+ for (const wchar_t* p = s; *p; p++) {+ if (*p == L'\t') { if (shortcut) *shortcut = p + 1; break; }+ if (*p == L'&') { if (p[1] == L'&') { out += L'&'; p++; } continue; }+ out += *p;+ }+ return out;+}++// ---- teclas para os menus genéricos (apps sem menu Win32): mandadas ao app ativo+void SendKeys(std::initializer_list<WORD> keys) {+ std::vector<INPUT> in;+ for (WORD k : keys) { INPUT i{ INPUT_KEYBOARD }; i.ki.wVk = k; in.push_back(i); }+ for (auto it = std::rbegin(keys); it != std::rend(keys); ++it) { INPUT i{ INPUT_KEYBOARD }; i.ki.wVk = *it; i.ki.dwFlags = KEYEVENTF_KEYUP; in.push_back(i); }+ SendInput((UINT)in.size(), in.data(), sizeof(INPUT));+}++struct KeyCmd { int id; const wchar_t* label; const wchar_t* shortcut; std::initializer_list<WORD> keys; };+// ids 1000+: atalhos de teclado mandados ao app+const KeyCmd g_keyCmds[] = {+ { 1001, L"Nova Janela", L"Ctrl+N", { VK_CONTROL, 'N' } },+ { 1002, L"Abrir…", L"Ctrl+O", { VK_CONTROL, 'O' } },+ { 1003, L"Fechar Janela", L"Ctrl+W", { VK_CONTROL, 'W' } },+ { 1004, L"Salvar", L"Ctrl+S", { VK_CONTROL, 'S' } },+ { 1005, L"Imprimir…", L"Ctrl+P", { VK_CONTROL, 'P' } },+ { 1010, L"Desfazer", L"Ctrl+Z", { VK_CONTROL, 'Z' } },+ { 1011, L"Refazer", L"Ctrl+Y", { VK_CONTROL, 'Y' } },+ { 1012, L"Recortar", L"Ctrl+X", { VK_CONTROL, 'X' } },+ { 1013, L"Copiar", L"Ctrl+C", { VK_CONTROL, 'C' } },+ { 1014, L"Colar", L"Ctrl+V", { VK_CONTROL, 'V' } },+ { 1015, L"Selecionar Tudo", L"Ctrl+A", { VK_CONTROL, 'A' } },+ { 1016, L"Buscar", L"Ctrl+F", { VK_CONTROL, 'F' } },+ { 1020, L"Nova Aba", L"Ctrl+T", { VK_CONTROL, 'T' } },+ { 1021, L"Nova Pasta", L"Ctrl+Shift+N", { VK_CONTROL, VK_SHIFT, 'N' } },+ { 1022, L"Obter Informações", L"Ctrl+I", { VK_CONTROL, 'I' } },+ { 1023, L"Mover para o Lixo", L"Delete", { VK_DELETE } },+ { 1030, L"como Ícones", L"Ctrl+1", { VK_CONTROL, '1' } },+ { 1031, L"como Lista", L"Ctrl+2", { VK_CONTROL, '2' } },+ { 1032, L"como Colunas", L"Ctrl+3", { VK_CONTROL, '3' } },+ { 1033, L"como Galeria", L"Ctrl+4", { VK_CONTROL, '4' } },+ { 1034, L"Mostrar Opções de Visualização", L"Ctrl+J", { VK_CONTROL, 'J' } },+ { 1040, L"Voltar", L"Alt+←", { VK_MENU, VK_LEFT } },+ { 1041, L"Avançar", L"Alt+→", { VK_MENU, VK_RIGHT } },+ { 1042, L"Pasta Superior", L"Ctrl+↑", { VK_CONTROL, VK_UP } },+ { 1043, L"Ir para a Pasta…", L"Ctrl+Shift+G", { VK_CONTROL, VK_SHIFT, 'G' } },+ { 1050, L"Ajuda", L"F1", { VK_F1 } },+ { 1051, L"Ajustes…", L"Ctrl+,", { VK_CONTROL, VK_OEM_COMMA } },+ // menus próprios dos apps sem menu Win32 (AppMenus): os atalhos do Windows de cada um+ { 5001, L"Nova Janela Anônima", L"Ctrl+Shift+N", { VK_CONTROL, VK_SHIFT, 'N' } },+ { 5002, L"Reabrir Aba Fechada", L"Ctrl+Shift+T", { VK_CONTROL, VK_SHIFT, 'T' } },+ { 5003, L"Abrir Arquivo…", L"Ctrl+O", { VK_CONTROL, 'O' } },+ { 5004, L"Abrir Local…", L"Ctrl+L", { VK_CONTROL, 'L' } },+ { 5005, L"Fechar Janela", L"Ctrl+Shift+W", { VK_CONTROL, VK_SHIFT, 'W' } },+ { 5006, L"Fechar Aba", L"Ctrl+W", { VK_CONTROL, 'W' } },+ { 5007, L"Salvar Página Como…", L"Ctrl+S", { VK_CONTROL, 'S' } },+ { 5010, L"Sempre Mostrar a Barra de Favoritos", L"Ctrl+Shift+B", { VK_CONTROL, VK_SHIFT, 'B' } },+ { 5011, L"Parar", L"Esc", { VK_ESCAPE } },+ { 5012, L"Recarregar Esta Página", L"Ctrl+R", { VK_CONTROL, 'R' } },+ { 5013, L"Forçar Recarregamento", L"Ctrl+Shift+R", { VK_CONTROL, VK_SHIFT, 'R' } },+ { 5014, L"Entrar em Tela Cheia", L"F11", { VK_F11 } },+ { 5015, L"Tamanho Real", L"Ctrl+0", { VK_CONTROL, '0' } },+ { 5016, L"Ampliar", L"Ctrl+=", { VK_CONTROL, VK_OEM_PLUS } },+ { 5017, L"Reduzir", L"Ctrl+-", { VK_CONTROL, VK_OEM_MINUS } },+ { 5018, L"Ferramentas do Desenvolvedor", L"Ctrl+Shift+I", { VK_CONTROL, VK_SHIFT, 'I' } },+ { 5019, L"Ver Código-Fonte", L"Ctrl+U", { VK_CONTROL, 'U' } },+ { 5020, L"Página Inicial", L"Alt+Home", { VK_MENU, VK_HOME } },+ { 5021, L"Mostrar Histórico Completo", L"Ctrl+H", { VK_CONTROL, 'H' } },+ { 5022, L"Limpar Dados de Navegação…", L"Ctrl+Shift+Del", { VK_CONTROL, VK_SHIFT, VK_DELETE } },+ { 5030, L"Gerenciador de Favoritos", L"Ctrl+Shift+O", { VK_CONTROL, VK_SHIFT, 'O' } },+ { 5031, L"Adicionar Esta Página aos Favoritos…", L"Ctrl+D", { VK_CONTROL, 'D' } },+ { 5032, L"Adicionar Todas as Abas aos Favoritos…", L"Ctrl+Shift+D", { VK_CONTROL, VK_SHIFT, 'D' } },+ { 5040, L"Selecionar Próxima Aba", L"Ctrl+Tab", { VK_CONTROL, VK_TAB } },+ { 5041, L"Selecionar Aba Anterior", L"Ctrl+Shift+Tab", { VK_CONTROL, VK_SHIFT, VK_TAB } },+ { 5050, L"Downloads", L"Ctrl+J", { VK_CONTROL, 'J' } },+ { 5051, L"Gerenciador de Tarefas", L"Shift+Esc", { VK_SHIFT, VK_ESCAPE } },+ { 5060, L"Central de Ajuda", L"F1", { VK_F1 } },+ { 5070, L"Refazer", L"Ctrl+Shift+Z", { VK_CONTROL, VK_SHIFT, 'Z' } },+ { 5071, L"Recarregar", L"Ctrl+R", { VK_CONTROL, 'R' } },+ { 5072, L"Busca Rápida", L"Ctrl+K", { VK_CONTROL, 'K' } },+ { 5073, L"Atalhos de Teclado", L"Ctrl+/", { VK_CONTROL, VK_DIVIDE } },+ { 5080, L"Nova Conversa", L"Ctrl+N", { VK_CONTROL, 'N' } },+ { 5081, L"Novo Grupo", L"Ctrl+Shift+N", { VK_CONTROL, VK_SHIFT, 'N' } },+ // Spotify+ { 5100, L"Nova Playlist", L"Ctrl+N", { VK_CONTROL, 'N' } },+ { 5101, L"Reproduzir/Pausar", L"Espaço", { VK_SPACE } },+ { 5102, L"Próxima", L"Ctrl+→", { VK_CONTROL, VK_RIGHT } },+ { 5103, L"Anterior", L"Ctrl+←", { VK_CONTROL, VK_LEFT } },+ { 5104, L"Aumentar Volume", L"Ctrl+↑", { VK_CONTROL, VK_UP } },+ { 5105, L"Diminuir Volume", L"Ctrl+↓", { VK_CONTROL, VK_DOWN } },+ { 5106, L"Repetir", L"Ctrl+R", { VK_CONTROL, 'R' } },+ { 5107, L"Aleatório", L"Ctrl+S", { VK_CONTROL, 'S' } },+ { 5108, L"Buscar", L"Ctrl+K", { VK_CONTROL, 'K' } },+ // VS Code+ { 5120, L"Novo Arquivo", L"Ctrl+N", { VK_CONTROL, 'N' } },+ { 5121, L"Nova Janela", L"Ctrl+Shift+N", { VK_CONTROL, VK_SHIFT, 'N' } },+ { 5122, L"Salvar Como…", L"Ctrl+Shift+S", { VK_CONTROL, VK_SHIFT, 'S' } },+ { 5123, L"Fechar Editor", L"Ctrl+W", { VK_CONTROL, 'W' } },+ { 5124, L"Substituir", L"Ctrl+H", { VK_CONTROL, 'H' } },+ { 5125, L"Buscar nos Arquivos", L"Ctrl+Shift+F", { VK_CONTROL, VK_SHIFT, 'F' } },+ { 5126, L"Paleta de Comandos…", L"Ctrl+Shift+P", { VK_CONTROL, VK_SHIFT, 'P' } },+ { 5127, L"Explorador", L"Ctrl+Shift+E", { VK_CONTROL, VK_SHIFT, 'E' } },+ { 5128, L"Controle do Código-Fonte", L"Ctrl+Shift+G", { VK_CONTROL, VK_SHIFT, 'G' } },+ { 5129, L"Extensões", L"Ctrl+Shift+X", { VK_CONTROL, VK_SHIFT, 'X' } },+ { 5130, L"Ir para Arquivo…", L"Ctrl+P", { VK_CONTROL, 'P' } },+ { 5131, L"Ir para Linha…", L"Ctrl+G", { VK_CONTROL, 'G' } },+ { 5132, L"Iniciar Depuração", L"F5", { VK_F5 } },+ { 5133, L"Executar sem Depurar", L"Ctrl+F5", { VK_CONTROL, VK_F5 } },+ { 5134, L"Barra Lateral", L"Ctrl+B", { VK_CONTROL, 'B' } },+};++ctxmenu::Item K(int id) {+ for (auto& k : g_keyCmds) if (k.id == id) { ctxmenu::Item i; i.label = Tr(k.label); i.id = id; i.shortcut = k.shortcut; return i; }+ return {};+}+ctxmenu::Item I(const std::wstring& label, int id, bool disabled = false, bool checked = false) {+ ctxmenu::Item i; i.label = label; i.id = id; i.disabled = disabled; i.checked = checked; return i;+}+ctxmenu::Item Sep() { ctxmenu::Item i; i.separator = true; return i; }++// ---- menu Win32 real do app → itens do nosso menu+std::vector<ctxmenu::Item> FromHmenu(HMENU m, int depth) {+ std::vector<ctxmenu::Item> out;+ int n = GetMenuItemCount(m);+ for (int k = 0; k < n; k++) {+ wchar_t buf[256] = {};+ MENUITEMINFOW mi{ sizeof(mi) };+ mi.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_STATE | MIIM_ID | MIIM_SUBMENU;+ mi.dwTypeData = buf; mi.cch = 255;+ if (!GetMenuItemInfoW(m, k, TRUE, &mi)) continue;+ if (mi.fType & MFT_SEPARATOR) { if (!out.empty() && !out.back().separator) out.push_back(Sep()); continue; }+ if (mi.fType & MFT_OWNERDRAW || !buf[0]) continue;+ ctxmenu::Item it;+ it.label = Clean(buf, &it.shortcut);+ it.id = (int)mi.wID;+ it.disabled = (mi.fState & (MFS_DISABLED | MFS_GRAYED)) != 0;+ it.checked = (mi.fState & MFS_CHECKED) != 0;+ if (mi.hSubMenu) {+ if (g_fg) {+ // alguns apps só preenchem o submenu quando o item dele é destacado (o Ableton deixa "*" nos+ // sets recentes até receber WM_MENUSELECT); depois espera um pouco se ainda for o marcador+ SendMessageTimeoutW(g_fg, WM_MENUSELECT, MAKEWPARAM(k, MF_POPUP | MF_HILITE), (LPARAM)m, SMTO_ABORTIFHUNG, 200, nullptr);+ SendMessageTimeoutW(g_fg, WM_INITMENUPOPUP, (WPARAM)mi.hSubMenu, k, SMTO_ABORTIFHUNG, 200, nullptr);+ for (int t = 0; t < 12; t++) {+ wchar_t first[8] = {};+ GetMenuStringW(mi.hSubMenu, 0, first, 8, MF_BYPOSITION);+ if (wcscmp(first, L"*")) break;+ SendMessageTimeoutW(g_fg, WM_NULL, 0, 0, SMTO_ABORTIFHUNG, 100, nullptr);+ Sleep(15);+ }+ }+ if (depth == 0) it.sub = FromHmenu(mi.hSubMenu, 1);+ else { // nosso menu tem um nível de submenu: os mais fundos entram achatados+ out.push_back(Sep());+ for (auto& c : FromHmenu(mi.hSubMenu, 2)) out.push_back(c);+ out.push_back(Sep());+ continue;+ }+ }+ out.push_back(it);+ }+ while (!out.empty() && out.back().separator) out.pop_back();+ return out;+}++App* ActiveApp() {+ if (g_finderActive || !g_fg) for (auto& a : apps::list) if (a.finder) return &a;+ return g_fg ? apps::OfWindow(g_fg) : nullptr;+}++// ---- estado do sistema para a direita da barra+bool WifiName(std::wstring& ssid) {+ HANDLE h = nullptr; DWORD ver = 0;+ if (WlanOpenHandle(2, nullptr, &ver, &h) != ERROR_SUCCESS) return false;+ bool ok = false;+ PWLAN_INTERFACE_INFO_LIST list = nullptr;+ if (WlanEnumInterfaces(h, nullptr, &list) == ERROR_SUCCESS) {+ for (DWORD i = 0; i < list->dwNumberOfItems && !ok; i++) {+ auto& info = list->InterfaceInfo[i];+ if (info.isState != wlan_interface_state_connected) continue;+ // Conectado é o estado da placa. O nome da rede, desde o Windows 11 24H2, só sai com a permissão de+ // localização ligada (sem ela a consulta falha): antes isso virava "não conectado" (issue #40)+ ok = true;+ PWLAN_CONNECTION_ATTRIBUTES ca = nullptr; DWORD sz = 0;+ if (WlanQueryInterface(h, &info.InterfaceGuid, wlan_intf_opcode_current_connection, nullptr, &sz, (PVOID*)&ca, nullptr) == ERROR_SUCCESS && ca) {+ auto& s = ca->wlanAssociationAttributes.dot11Ssid;+ std::string a((const char*)s.ucSSID, s.uSSIDLength); // o nome vem em UTF-8+ int n = MultiByteToWideChar(CP_UTF8, 0, a.c_str(), (int)a.size(), nullptr, 0);+ ssid.resize(n);+ MultiByteToWideChar(CP_UTF8, 0, a.c_str(), (int)a.size(), ssid.data(), n);+ WlanFreeMemory(ca);+ }+ }+ WlanFreeMemory(list);+ }+ WlanCloseHandle(h, nullptr);+ return ok;+}++// Estado do sistema para os ícones da direita (relido a cada segundo; o Bluetooth a cada 10 s)+struct Status {+ bool wlan = false, wifiOn = false, wired = false;+ bool batt = false, charging = false; int pct = 100;+ bool bt = false;+ bool sound = false, muted = false, phones = false; float vol = 0;+ HKL hkl = nullptr;+ DWORD btAt = 0;+ std::wstring ssid;+} g_st;++bool WifiName(std::wstring& ssid);+std::atomic<bool> g_audioStale{ false }; // a saída padrão mudou: relê o objeto de áudio já++void LerStatus(Status& st) {+ static DWORD wifiAt, audioAt;+ static IAudioEndpointVolume* vol; // o mesmo objeto de áudio entre as leituras (antes: criado e solto a cada segundo)+ DWORD now = GetTickCount();+ // Wi-Fi: existe placa? está conectada? (a cada 5 s)+ if (!wifiAt || now - wifiAt > 5000) {+ wifiAt = now;+ st.wlan = false;+ HANDLE h = nullptr; DWORD ver = 0;+ if (WlanOpenHandle(2, nullptr, &ver, &h) == ERROR_SUCCESS) {+ PWLAN_INTERFACE_INFO_LIST list = nullptr;+ if (WlanEnumInterfaces(h, nullptr, &list) == ERROR_SUCCESS) { st.wlan = list->dwNumberOfItems > 0; WlanFreeMemory(list); }+ WlanCloseHandle(h, nullptr);+ }+ st.ssid.clear();+ st.wifiOn = st.wlan && WifiName(st.ssid);+ // cabo ligado (placa Ethernet com rede)? Aí o Wi-Fi desconectado não aparece na barra+ st.wired = false;+ ULONG sz = 16 * 1024;+ std::vector<BYTE> buf(sz);+ DWORD rc = GetAdaptersInfo((IP_ADAPTER_INFO*)buf.data(), &sz);+ if (rc == ERROR_BUFFER_OVERFLOW) { buf.resize(sz); rc = GetAdaptersInfo((IP_ADAPTER_INFO*)buf.data(), &sz); }+ if (rc == NO_ERROR) // placa Ethernet com gateway = cabo conectado à rede+ for (auto* a = (IP_ADAPTER_INFO*)buf.data(); a; a = a->Next)+ if (a->Type == MIB_IF_TYPE_ETHERNET && strcmp(a->GatewayList.IpAddress.String, "0.0.0.0") && a->GatewayList.IpAddress.String[0]) { st.wired = true; break; }+ }+ // bateria (só em quem tem)+ SYSTEM_POWER_STATUS ps{};+ if (GetSystemPowerStatus(&ps) && !(ps.BatteryFlag & 128) && ps.BatteryFlag != 255 && ps.BatteryLifePercent <= 100) {+ st.batt = true; st.pct = ps.BatteryLifePercent; st.charging = ps.ACLineStatus == 1;+ } else st.batt = false;+ // Bluetooth: tem rádio?+ if (!st.btAt || GetTickCount() - st.btAt > 10000) {+ st.btAt = GetTickCount();+ BLUETOOTH_FIND_RADIO_PARAMS fp{ sizeof(fp) }; HANDLE radio = nullptr;+ HBLUETOOTH_RADIO_FIND f = BluetoothFindFirstRadio(&fp, &radio);+ st.bt = f != nullptr;+ if (radio) CloseHandle(radio);+ if (f) BluetoothFindRadioClose(f);+ }+ // som: volume e mudo a cada segundo (barato, no objeto guardado); a saída padrão e se é um fone a cada 10 s+ bool fresh = false;+ if (g_audioStale.exchange(false)) audioAt = 0;+ if (vol && audioAt && now - audioAt < 10000) {+ BOOL mute = FALSE;+ if (SUCCEEDED(vol->GetMute(&mute)) && SUCCEEDED(vol->GetMasterVolumeLevelScalar(&st.vol))) { st.muted = mute; fresh = true; }+ }+ if (!fresh) {+ audioAt = now;+ if (vol) { vol->Release(); vol = nullptr; }+ st.sound = false;+ IMMDeviceEnumerator* en = nullptr;+ if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, IID_PPV_ARGS(&en)))) {+ IMMDevice* dev = nullptr;+ if (SUCCEEDED(en->GetDefaultAudioEndpoint(eRender, eConsole, &dev))) {+ if (SUCCEEDED(dev->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, nullptr, (void**)&vol))) {+ BOOL mute = FALSE; vol->GetMute(&mute); vol->GetMasterVolumeLevelScalar(&st.vol);+ st.muted = mute; st.sound = true;+ }+ IPropertyStore* ps2 = nullptr;+ st.phones = false;+ if (SUCCEEDED(dev->OpenPropertyStore(STGM_READ, &ps2))) {+ static const PROPERTYKEY formFactor = { { 0x1da5d803, 0xd492, 0x4edd, { 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e } }, 0 };+ PROPVARIANT v; PropVariantInit(&v);+ if (SUCCEEDED(ps2->GetValue(formFactor, &v)) && v.vt == VT_UI4) st.phones = v.ulVal == 3 || v.ulVal == 5; // fone / headset+ PropVariantClear(&v);+ ps2->Release();+ }+ dev->Release();+ }+ en->Release();+ }+ }+}++// Tudo acima pergunta a um serviço do Windows (WLAN, rede, Bluetooth, áudio) e espera a resposta. Na thread da+// interface, com o PC ocupado, o Shell inteiro parava: o WlanOpenHandle levou 3,6 s (pilha de 22/11/2026, 15:14).+// Uma thread só lê; a interface pega a última resposta e redesenha quando chega uma diferente.+const UINT WM_BARSTATUS = WM_APP + 42;+std::mutex g_stMx;+Status g_stLido;++void PedeStatus() {+ static HANDLE pedido = CreateEventW(nullptr, FALSE, FALSE, nullptr);+ static std::once_flag uma;+ std::call_once(uma, [] {+ std::thread([] {+ CoInitializeEx(nullptr, COINIT_MULTITHREADED);+ Status st;+ while (WaitForSingleObject(pedido, INFINITE) == WAIT_OBJECT_0) {+ LerStatus(st);+ bool mudou;+ {+ std::lock_guard<std::mutex> l(g_stMx);+ const Status& a = g_stLido;+ mudou = a.wlan != st.wlan || a.wifiOn != st.wifiOn || a.wired != st.wired || a.batt != st.batt || a.charging != st.charging ||+ a.pct != st.pct || a.bt != st.bt || a.sound != st.sound || a.muted != st.muted || a.phones != st.phones ||+ a.vol != st.vol || a.ssid != st.ssid;+ g_stLido = st;+ }+ if (mudou && g_bar) PostMessageW(g_bar, WM_BARSTATUS, 0, 0);+ }+ }).detach();+ });+ SetEvent(pedido);+}++void PegaStatus() {+ { std::lock_guard<std::mutex> l(g_stMx); g_st = g_stLido; }+ // fonte de entrada (teclado) do app da frente+ HWND fg = GetForegroundWindow();+ g_st.hkl = GetKeyboardLayout(fg ? GetWindowThreadProcessId(fg, nullptr) : 0);+}++void RefreshStatus() {+ PedeStatus();+ PegaStatus();+}++// "A" para o teclado americano (o "ABC" do Mac), senão a sigla do país do layout (BR, PT, ES…)+std::wstring InputBadge(HKL hkl) {+ WORD layout = HIWORD((ULONG_PTR)hkl), lang = LOWORD((ULONG_PTR)hkl);+ if ((layout & 0xF000) == 0xF000) layout = lang; // layout alternativo: usa o idioma+ if (layout == 0x0409) return L"A";+ wchar_t name[LOCALE_NAME_MAX_LENGTH] = {};+ if (LCIDToLocaleName(MAKELCID(layout, SORT_DEFAULT), name, LOCALE_NAME_MAX_LENGTH, 0) ||+ LCIDToLocaleName(MAKELCID(lang, SORT_DEFAULT), name, LOCALE_NAME_MAX_LENGTH, 0)) {+ std::wstring n = name;+ size_t d = n.find(L'-');+ std::wstring c = d != std::wstring::npos ? n.substr(d + 1, 2) : n.substr(0, 2);+ for (auto& ch : c) ch = towupper(ch);+ return c;+ }+ return L"?";+}+std::wstring LayoutName(HKL hkl) {+ wchar_t name[LOCALE_NAME_MAX_LENGTH] = {}, disp[128] = {};+ LCIDToLocaleName(MAKELCID(LOWORD((ULONG_PTR)hkl), SORT_DEFAULT), name, LOCALE_NAME_MAX_LENGTH, 0);+ GetLocaleInfoEx(name, LOCALE_SLOCALIZEDDISPLAYNAME, disp, 128);+ std::wstring r = disp[0] ? disp : name;+ if (HIWORD((ULONG_PTR)hkl) == 0x0416) r += L" (ABNT2)";+ return r;+}++IAudioEndpointVolume* Volume() {+ IMMDeviceEnumerator* en = nullptr;+ IAudioEndpointVolume* vol = nullptr;+ if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, IID_PPV_ARGS(&en)))) {+ IMMDevice* dev = nullptr;+ if (SUCCEEDED(en->GetDefaultAudioEndpoint(eRender, eConsole, &dev))) {+ dev->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, nullptr, (void**)&vol);+ dev->Release();+ }+ en->Release();+ }+ return vol;+}++std::wstring ClockText() {+ SYSTEMTIME st; GetLocalTime(&st);+ wchar_t day[16] = {}, mon[16] = {};+ const wchar_t* loc = idioma::Locale();+ GetDateFormatEx(loc, 0, &st, L"ddd", day, 16, nullptr);+ GetDateFormatEx(loc, 0, &st, L"MMM", mon, 16, nullptr);+ std::wstring d = day, m = mon;+ if (idioma::Pt() && !d.empty() && d.back() != L'.') d += L'.';+ if (idioma::Pt() && !m.empty() && m.back() != L'.') m += L'.';+ wchar_t buf[64];+ if (liquid::Leopard()) {+ // Leopard: só o dia da semana e a hora ("Mon 6:45 PM" na captura do 10.5), no formato de hora do usuário+ wchar_t tm[32] = {};+ GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, tm, 32);+ std::wstring dd = day;+ if (!dd.empty() && dd.back() == L'.') dd.pop_back();+ if (!dd.empty()) dd[0] = towupper(dd[0]);+ swprintf_s(buf, L"%ls %ls", dd.c_str(), tm);+ return buf;+ }+ // relogio_segundos (issue #38, como "Mostrar segundos" do Mac): 14:05:09; relogio_formato (issue #43): 2:05 PM+ std::wstring hora = shell::Hora(st, shell::Setting(L"relogio_segundos", L"0") == L"1");+ const wchar_t* hm = hora.c_str();+ if (shell::Setting(L"relogio_curto", L"0") == L"1") swprintf_s(buf, L"%ls", hm);+ else if (idioma::En()) swprintf_s(buf, L"%ls %ls %d %ls", d.c_str(), m.c_str(), st.wDay, hm); // Tue Nov 10+ else if (idioma::Pt()) swprintf_s(buf, L"%ls %d de %ls %ls", d.c_str(), st.wDay, m.c_str(), hm);+ else swprintf_s(buf, L"%ls %ls", idioma::Date(st, idioma::D_WEEKDAY_SHORT).c_str(), hm); // ven. 20 nov., 11月20日(金)+ return buf;+}++// ---- ícones de status: HICON → BGRA pré-multiplicado (desenhado sobre preto e sobre branco)+struct IconCache { HICON icon; UINT px; std::vector<BYTE> bgra; };+std::vector<IconCache> g_iconCache;++const std::vector<BYTE>& IconPixels(HICON ic, UINT px) {+ for (auto& c : g_iconCache) if (c.icon == ic && c.px == px) return c.bgra;+ if (g_iconCache.size() > 64) g_iconCache.clear();+ // desenhado 4× maior e reduzido pela média de cada bloco 4×4 (anti-aliasing): em 1080p (17 px) o DrawIconEx+ // esticava o ícone de 16/32 px pelo vizinho mais próximo e a borda saía serrilhada+ const UINT SS = 4, R = px * SS;+ BITMAPINFO bi{}; bi.bmiHeader = { sizeof(BITMAPINFOHEADER), (LONG)R, -(LONG)R, 1, 32, BI_RGB };+ void *pb, *pw;+ HDC dc = CreateCompatibleDC(nullptr);+ HBITMAP b = CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, &pb, nullptr, 0);+ HBITMAP w = CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, &pw, nullptr, 0);+ IconCache c{ ic, px, std::vector<BYTE>(px * px * 4) };+ if (!b || !w || !pb || !pw) {+ if (b) DeleteObject(b);+ if (w) DeleteObject(w);+ DeleteDC(dc);+ g_iconCache.push_back(std::move(c));+ return g_iconCache.back().bgra;+ }+ memset(pw, 0xFF, R * R * 4);+ HGDIOBJ old = SelectObject(dc, b); DrawIconEx(dc, 0, 0, ic, R, R, 0, nullptr, DI_NORMAL);+ SelectObject(dc, w); DrawIconEx(dc, 0, 0, ic, R, R, 0, nullptr, DI_NORMAL);+ SelectObject(dc, old);+ auto* B = (BYTE*)pb; auto* W = (BYTE*)pw;+ for (UINT y = 0; y < px; y++)+ for (UINT x = 0; x < px; x++) {+ UINT sb = 0, sg = 0, sr = 0, sa = 0;+ for (UINT dy = 0; dy < SS; dy++)+ for (UINT dx = 0; dx < SS; dx++) {+ size_t i = ((size_t)(y * SS + dy) * R + (x * SS + dx)) * 4;+ int a = 255 - std::clamp((W[i + 1] - B[i + 1]), 0, 255); // alfa = 1 - (branco - preto)+ sb += B[i + 0]; sg += B[i + 1]; sr += B[i + 2]; sa += (UINT)a;+ }+ const UINT n = SS * SS;+ size_t o = ((size_t)y * px + x) * 4;+ c.bgra[o + 3] = (BYTE)((sa + n / 2) / n);+ c.bgra[o + 0] = (BYTE)std::min<UINT>((sb + n / 2) / n, c.bgra[o + 3]);+ c.bgra[o + 1] = (BYTE)std::min<UINT>((sg + n / 2) / n, c.bgra[o + 3]);+ c.bgra[o + 2] = (BYTE)std::min<UINT>((sr + n / 2) / n, c.bgra[o + 3]);+ }+ DeleteObject(b); DeleteObject(w); DeleteDC(dc);+ g_iconCache.push_back(std::move(c));+ return g_iconCache.back().bgra;+}++// ---- desenho+void DrawLogo(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, float cx, float cy) {+ // logo próprio (não usamos a marca da Apple): quatro quadradinhos arredondados+ float s = 5.4f, g = 1.6f;+ for (int i = 0; i < 4; i++) {+ float x = cx - s - g / 2 + (i % 2) * (s + g), y = cy - s - g / 2 + (i / 2) * (s + g);+ rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(x, y, x + s, y + s), 1.5f, 1.5f), br);+ }+}++void DrawCC(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, float cx, float cy) {+ // Central de Controle: duas chavinhas+ for (int k = 0; k < 2; k++) {+ float y = cy - 3.6f + k * 7.2f;+ D2D1_ROUNDED_RECT rr{ D2D1::RectF(cx - 7.5f, y - 2.8f, cx + 7.5f, y + 2.8f), 2.8f, 2.8f };+ rt->DrawRoundedRectangle(rr, br, 1.2f);+ float kx = k == 0 ? cx - 4.7f : cx + 4.7f;+ rt->FillEllipse(D2D1::Ellipse({ kx, y }, 2.0f, 2.0f), br);+ }+}++// Ajustes > Transparência e Efeitos > "Mostrar fundo da barra de menus" (desligado: como no Tahoe)+// No Tahoe (Liquid Glass) a barra de menus não tem fundo nenhum, como no macOS 26: só o papel de parede atrás.+bool BarBackground() {+ if (backdrop::Current().reduce || liquid::Leopard()) return true; // Leopard: a barra translúcida clara sempre tem fundo+ if (menubar::Embaixo()) return false; // na linha do Dock: sem faixa atravessando a tela+ if (backdrop::Liquid()) return false;+ return shell::Setting(L"barra_fundo", L"1") != L"0";+}++void BarGlass(HWND bar) {+ if (!bar) return;+ // Leopard: o degradê branco translúcido vem do Render. Translúcida (padrão): transparência de verdade, SEM desfoque+ // (o 10.5 deixava o papel de parede aparecer nítido através da barra); opaca: acrílico cheio por baixo+ const bool leoClear = liquid::Leopard() && shell::Setting(L"barra_translucida", L"1") == L"1";+ if (liquid::Leopard() && !leoClear) { ui::Acrylic(bar, 0xFFE6E6E6u); return; }+ if (!leoClear)+ if (BarBackground()) { ui::Acrylic(bar, ui::Dark() ? 0x40141414u : 0x55F4F4F4u); return; } // vidro bem claro: o papel de parede aparece, como no Mac+ // sem fundo: o DWM só respeita o alfa do que a barra desenha (nada de desfoque)+ struct ACCENT_POLICY { int state, flags; DWORD gradient; int anim; };+ struct WCA_DATA { int attr; PVOID data; SIZE_T size; };+ using Fn = BOOL(WINAPI*)(HWND, WCA_DATA*);+ static Fn fn = (Fn)GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetWindowCompositionAttribute");+ if (!fn) return;+ ACCENT_POLICY ap{ 2 /*ACCENT_ENABLE_TRANSPARENTGRADIENT*/, 2, 0x00000000u, 0 };+ WCA_DATA d{ 19 /*WCA_ACCENT_POLICY*/, &ap, sizeof(ap) };+ fn(bar, &d);+}++// Barra sem fundo (Tahoe): o texto e os ícones seguem a claridade do que está atrás deles, como no Mac+// (branco sobre papel de parede escuro, preto sobre claro), não o tema do sistema. A barra fica sempre+// em cima do papel de parede (a área de trabalho começa abaixo dela): mede o topo da imagem.+float g_topR = 0.5f, g_topG = 0.5f, g_topB = 0.5f; // cor média do topo do papel de parede (vibrancy do Tahoe)+bool WallpaperTopDarkFile(bool fallback);+// a cor do que está atrás da barra: a faixa que a mesa desenhou (muda na hora com o papel de parede); sem a mesa, o+// arquivo do papel de parede+bool WallpaperTopDark(bool fallback) {+ float r, g, b;+ const bool baixo = menubar::Embaixo();+ const int faixa = baixo ? menubar::ReservedBottom(MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY)) : menubar::Height();+ if (!mesa::TopColor(faixa, r, g, b, baixo)) return WallpaperTopDarkFile(fallback);+ g_topR = r; g_topG = g; g_topB = b;+ double luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;+ static int adapt = -1; // -1 ainda não decidido, 0 texto claro, 1 texto escuro+ static double lastLog = -1;+ bool dark;+ if (liquid::On()) { // histerese 0,40/0,60 (guia, seção 2.1)+ if (luma > 0.60) adapt = 1; else if (luma < 0.40) adapt = 0; else if (adapt < 0) adapt = luma >= 0.5 ? 1 : 0;+ dark = adapt == 0;+ } else dark = luma < 0.72;+ if (std::fabs(luma - lastLog) > 0.05) { lastLog = luma; Log(L"barra de menus: atrás dela claridade %.2f -> texto %ls", luma, dark ? L"branco" : L"preto"); }+ return dark;+}+// O arquivo do papel de parede numa thread (issue #32): esta conta roda a cada desenho da barra e a cada tique de 1 s,+// e com o Explorador de fundo (o padrão, sem a nossa mesa para dar a cor) lia o Registro e perguntava ao disco pelo+// arquivo toda vez. Com o disco ocupado o GetFileAttributes segurou a interface 11 s (sentinela, 22/11/2026 20:49).+// Agora a interface usa o último resultado e pede uma leitura nova no máximo a cada 4 s.+bool LeTopoDoArquivo(bool fallback, float rgb[3]);+void Render();+bool WallpaperTopDarkFile(bool fallback) {+ static std::atomic<bool> rodando{ false };+ static DWORD quando = 0;+ static int escuro = -1; // -1: ainda sem leitura+ DWORD agora = GetTickCount();+ if (!rodando && (!quando || agora - quando > 4000)) {+ quando = agora;+ rodando = true;+ std::thread([fallback] {+ HRESULT ci = CoInitializeEx(nullptr, COINIT_MULTITHREADED); // WIC+ float rgb[3] = { -1, -1, -1 };+ bool d = LeTopoDoArquivo(fallback, rgb);+ if (SUCCEEDED(ci)) CoUninitialize();+ shell::NaInterface([d, r = rgb[0], g = rgb[1], b = rgb[2]] {+ rodando = false;+ bool mudou = escuro != (d ? 1 : 0);+ escuro = d ? 1 : 0;+ if (r >= 0 && (r != g_topR || g != g_topG || b != g_topB)) { g_topR = r; g_topG = g; g_topB = b; mudou = true; }+ if (mudou) Render();+ });+ }).detach();+ }+ return escuro < 0 ? fallback : escuro == 1;+}+// roda numa thread (só uma por vez): rgb sai com a cor média do topo, ou fica como veio se não leu+bool LeTopoDoArquivo(bool fallback, float rgb[3]) {+ static std::wstring lastKey;+ static bool lastDark = true;+ static float lastRGB[3] = { -1, -1, -1 };+ struct Sai { float* o; ~Sai() { if (lastRGB[0] >= 0) for (int i = 0; i < 3; i++) o[i] = lastRGB[i]; } } sai{ rgb };+ // o papel de parede que a mesa desenha (do registro); sem ele, o do Windows+ wchar_t path[MAX_PATH] = {};+ DWORD cb = sizeof(path);+ if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"WallPaper", RRF_RT_REG_SZ, nullptr, path, &cb) != ERROR_SUCCESS || !path[0]+ || GetFileAttributesW(path) == INVALID_FILE_ATTRIBUTES)+ SystemParametersInfoW(SPI_GETDESKWALLPAPER, MAX_PATH, path, 0);+ WIN32_FILE_ATTRIBUTE_DATA fa{};+ if (!path[0] || !GetFileAttributesExW(path, GetFileExInfoStandard, &fa)) {+ static bool warned;+ if (!warned) { warned = true; Log(L"barra de menus: papel de parede não encontrado (%ls)", path); }+ return fallback;+ }+ std::wstring key = std::wstring(path) + L"|" + std::to_wstring(fa.ftLastWriteTime.dwLowDateTime);+ if (key == lastKey) return lastDark;+ lastKey = key;+ lastDark = fallback;+ IWICImagingFactory* wic = nullptr;+ HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&wic));+ if (FAILED(hr)) { Log(L"barra de menus: WIC indisponível (0x%08X)", (unsigned)hr); return fallback; }+ IWICBitmapDecoder* dec = nullptr; IWICBitmapFrameDecode* fr = nullptr; IWICBitmapScaler* sc = nullptr; IWICFormatConverter* cv = nullptr;+ const UINT W = 96, H = 54;+ int step = 0;+ if (++step, SUCCEEDED(hr = wic->CreateDecoderFromFilename(path, nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &dec)) && (++step, SUCCEEDED(hr = dec->GetFrame(0, &fr))) &&+ (++step, SUCCEEDED(hr = wic->CreateBitmapScaler(&sc))) && (++step, SUCCEEDED(hr = sc->Initialize(fr, W, H, WICBitmapInterpolationModeFant))) &&+ (++step, SUCCEEDED(hr = wic->CreateFormatConverter(&cv))) && (++step, SUCCEEDED(hr = cv->Initialize(sc, GUID_WICPixelFormat32bppBGRA, WICBitmapDitherTypeNone, nullptr, 0, WICBitmapPaletteTypeCustom)))) {+ std::vector<BYTE> px(W * 3 * 4); // as 3 primeiras linhas (~5% de cima, onde fica a barra)+ WICRect top{ 0, 0, (INT)W, 3 };+ if (SUCCEEDED(hr = cv->CopyPixels(&top, W * 4, (UINT)px.size(), px.data()))) {+ double sum = 0, sr = 0, sg = 0, sb = 0;+ for (UINT i = 0; i < W * 3; i++) {+ sum += (0.0722 * px[i * 4] + 0.7152 * px[i * 4 + 1] + 0.2126 * px[i * 4 + 2]) / 255.0;+ sb += px[i * 4] / 255.0; sg += px[i * 4 + 1] / 255.0; sr += px[i * 4 + 2] / 255.0;+ }+ double luma = sum / (W * 3);+ lastRGB[0] = (float)(sr / (W * 3)); lastRGB[1] = (float)(sg / (W * 3)); lastRGB[2] = (float)(sb / (W * 3));+ // Tahoe: adaptação com histerese do vidro do macOS 26 (glassLumaHysteresisRange, guia seção 2.1): acima de+ // 0,60 vira texto escuro, abaixo de 0,40 texto claro, entre os dois fica como estava. Sequoia: limiar 0,72.+ static int adapt = -1; // -1 ainda não decidido, 0 texto claro, 1 texto escuro+ if (liquid::On()) {+ if (luma > 0.60) adapt = 1; else if (luma < 0.40) adapt = 0; else if (adapt < 0) adapt = luma >= 0.5 ? 1 : 0;+ lastDark = adapt == 0;+ } else lastDark = luma < 0.72; // o Mac só usa texto escuro sobre fundo bem claro+ Log(L"barra de menus: topo do papel de parede com claridade %.2f -> texto %ls", luma, lastDark ? L"branco" : L"preto");+ }+ }+ else Log(L"barra de menus: não deu para ler o papel de parede (etapa %d, 0x%08X)", step, (unsigned)hr);+ if (cv) cv->Release(); if (sc) sc->Release(); if (fr) fr->Release(); if (dec) dec->Release();+ wic->Release();+ return lastDark;+}++void Render() {+ if (!g_bar) return;+ HWND bar = Cur();+ g_s.hwnd = bar;+ RECT rc; GetClientRect(bar, &rc);+ float sc = ui::Scale(bar);+ auto* rt = ui::Begin(g_s, rc.right, rc.bottom, sc);+ if (!rt) return;+ float W = rc.right / sc, H = rc.bottom / sc;+ bool dark = ui::Dark();+ // sem fundo, ou no Tahoe (o vidro da barra é tão leve que o papel de parede aparece quase inteiro):+ // a cor do texto e dos ícones segue o papel de parede atrás+ const bool bgOn0 = BarBackground();+ if (!bgOn0 || liquid::On()) dark = WallpaperTopDark(dark);+ const bool leo = liquid::Leopard();+ // Leopard: Lucida Grande 14 px no Mac; no Windows, a Lucida Sans Unicode (o mesmo desenho de origem)+ static IDWriteTextFormat* tfLeo = ui::FormatFace(L"Lucida Sans Unicode", 14, DWRITE_FONT_WEIGHT_NORMAL);+ static IDWriteTextFormat* tfLeoB = ui::FormatFace(L"Lucida Sans Unicode", 14, DWRITE_FONT_WEIGHT_BOLD);+ IDWriteTextFormat* tfN = leo ? tfLeo : g_tf;+ IDWriteTextFormat* tfB = leo ? tfLeoB : g_tfBold;+ if (leo) dark = false; // Leopard: a barra é sempre clara, com texto preto (o 10.5 não tinha modo escuro)+ // Menubar Image do macOS 26 (guia, seção 31: catálogos Aqua/DarkAqua): branco 90 % no escuro, preto 85 % no claro+ D2D1_COLOR_F fgc = dark ? D2D1::ColorF(1, 1, 1, liquid::On() ? 0.90f : 0.92f) : D2D1::ColorF(0, 0, 0, 0.85f);+ // Liquid Glass sem fundo: só branco ou preto, mais firmes. Antes puxava a cor do papel de parede saturada 3×+ // (a "vibrancy" do Mac) e em papel de parede azul o texto e os ícones ficavam ciano.+ if (liquid::On() && !bgOn0) fgc = dark ? D2D1::ColorF(1, 1, 1, 0.96f) : D2D1::ColorF(0, 0, 0, 0.90f);+ ID2D1SolidColorBrush* br = nullptr;+ bool liquid = backdrop::Liquid(), bgOn = BarBackground();+ D2D1_COLOR_F veil = dark ? D2D1::ColorF(0.06f, 0.06f, 0.07f, 0.18f) : D2D1::ColorF(1, 1, 1, 0.26f);+ if (liquid) veil.a = backdrop::Current().tinted ? veil.a : veil.a * 0.35f;+ if (!bgOn || leo) veil.a = 0; // sem fundo (Tahoe): só o papel de parede atrás; Leopard: o degradê do Render é o fundo todo+ rt->CreateSolidColorBrush(veil, &br);+ rt->FillRectangle(D2D1::RectF(0, 0, W, H), br); // tinta leve por cima do acrílico+ if (leo) {+ // Leopard: a barra de menus translúcida do 10.5 — branco leitoso que deixa o papel de parede passar um pouco,+ // um tom mais cinza embaixo, o fio de luz no alto e a linha escura embaixo (a "sombra" da barra)+ float px = 1 / sc;+ // medido numa captura do 10.5 a 1x: 248 no alto -> 204 embaixo, a linha de baixo quase preta+ // Aparência > "Barra de menus translúcida" desligada (o 10.5.2 trouxe a opção): opaca+ const float op = shell::Setting(L"barra_translucida", L"1") == L"1" ? 1.f : 1.12f;+ // translúcida: ~72 % de branco (o papel de parede passa nítido, como nas capturas do 10.5); opaca: cheia+ const float a0 = op > 1 ? 1.f : 0.74f, a1 = op > 1 ? 1.f : 0.70f;+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(248 / 255.f, 248 / 255.f, 248 / 255.f, a0) }, { 1, D2D1::ColorF(214 / 255.f, 214 / 255.f, 214 / 255.f, a1) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, H }), gs, &lb)))+ rt->FillRectangle(D2D1::RectF(0, 0, W, H), lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.75f));+ rt->FillRectangle(D2D1::RectF(0, 0, W, px), br);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.62f));+ rt->FillRectangle(D2D1::RectF(0, H - px, W, H), br);+ }+ if (liquid && bgOn) { // Liquid Glass: sem degradê branco; só um fio fraco embaixo, como no Tahoe+ float px = 1 / sc;+ br->SetColor(D2D1::ColorF(1, 1, 1, dark ? 0.08f : 0.18f));+ rt->FillRectangle(D2D1::RectF(0, H - px, W, H), br);+ }+ g_hits.clear();+ // Embaixo, o meio da linha é do Dock: o que é da esquerda acaba em limE e o da direita começa em limD+ float limE = W, limD = 0;+ if (g_vaoD > g_vaoE && bar == g_bar) { limE = g_vaoE / sc - 6; limD = g_vaoD / sc + 6; }+ bool litNow = false; // Leopard: o item aceso fica com o texto branco sobre o azul+ auto highlight = [&](D2D1_RECT_F r) {+ if (leo) { // Leopard: o destaque azul do Aqua de ponta a ponta na altura da barra, sem cantos+ litNow = true;+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.39f, 0.56f, 0.95f, 1) }, { 1, D2D1::ColorF(0.13f, 0.35f, 0.86f, 1) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, H }), gs, &lb)))+ rt->FillRectangle(D2D1::RectF(r.left, 0, r.right, H - 1 / sc), lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ return;+ }+ if (liquid::On()) { // Tahoe (vídeo do macOS 26): o item aberto ganha uma cápsula de vidro clara+ br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.24f) : D2D1::ColorF(1, 1, 1, 0.55f));+ float rad = (H - 4) / 2;+ rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, 2, r.right - 1, H - 2), rad, rad), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, dark ? 0.18f : 0.45f)); // o fio de luz da borda+ rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1.5f, 2.5f, r.right - 1.5f, H - 2.5f), rad - 0.5f, rad - 0.5f), br, 0.8f);+ return;+ }+ br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.20f) : D2D1::ColorF(0, 0, 0, 0.10f));+ rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, 2, r.right, H - 2), 4, 4), br);+ };+ auto add = [&](D2D1_RECT_F r, Kind k, int i) {+ litNow = false;+ g_hits.push_back({ r, k, i });+ bool lit = (k == K_SOUND && (som::IsOpen() || som::HudLit())) // menu Som aberto / aviso de volume do Tahoe+ || (k == K_CC && central::IsOpen()) || (k == K_CLOCK && (notificacoes::IsOpen() || (liquid::On() && notificacoes::BannerVisible()))) || (k == K_SPOT && spotlight::IsOpen()) || (k == K_SIRI && siri::Aberta());+ if (lit || ((int)g_hits.size() - 1 == g_open && bar == g_openBar)) highlight(r);+ };++ // esquerda (Tahoe, guia seção 35: o menu Apple fica em x 10, com 34 de largura)+ float x = liquid::On() ? 10.f : 8.f;+ add(D2D1::RectF(x, 0, x + 34, H), K_LOGO, 0);+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);+ if (leo && !litNow) {+ // Leopard: a maçã grafite brilhante do 10.5 (a azul era a do Tiger): cinza claro em cima, quase preto embaixo;+ // aberta, fica branca+ D2D1_GRADIENT_STOP st[3] = { { 0, D2D1::ColorF(0.62f, 0.62f, 0.63f, 1) }, { 0.45f, D2D1::ColorF(0.36f, 0.36f, 0.37f, 1) }, { 1, D2D1::ColorF(0.16f, 0.16f, 0.17f, 1) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ bool ok = SUCCEEDED(rt->CreateGradientStopCollection(st, 3, &gs)) &&+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, H / 2 - 7.5f }, { 0, H / 2 + 6.5f }), gs, &lb));+ if (!ok || !simbolo::Draw(rt, L"apple.logo", D2D1::RectF(x + 10, H / 2 - 7.5f, x + 24, H / 2 + 6.5f), lb)) {+ br->SetColor(D2D1::ColorF(0.30f, 0.30f, 0.31f, 1));+ DrawLogo(rt, br, x + 17, H / 2);+ }+ if (lb) lb->Release();+ if (gs) gs->Release();+ } else+ if (!simbolo::Draw(rt, L"apple.logo", D2D1::RectF(x + 10, H / 2 - 7.5f, x + 24, H / 2 + 6.5f), (br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc), br))) // a maçã do SF Symbols+ DrawLogo(rt, br, x + 17, H / 2);+ x += 34;+ if (float w = ui::TextWidth(tfB, g_appName) + 20; x + w <= limE) {+ add(D2D1::RectF(x, 0, x + w, H), K_APP, 0);+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);+ rt->DrawTextW(g_appName.c_str(), (UINT32)g_appName.size(), tfB, D2D1::RectF(x + 10, 0, x + w, H), br);+ x += w;+ }+ float leftEnd = x;++ // direita (da borda para dentro), na ordem do Mac: relógio, Central de Controle, Spotlight, fonte de+ // entrada, Wi-Fi, bateria, som, Bluetooth, ícones fixados dos apps e a setinha dos guardados.+ // Cada item é o símbolo com 10 pt de cada lado (no Mac fica um a cada ~38 pt).+ float r = W - 10;+ auto slot = [&](float iconW, Kind k, int i) { // reserva o espaço e devolve a caixa do símbolo+ float w = iconW + 2 * PAD;+ if (r - w < limD) return D2D1::RectF(-1000, 0, -1000 + iconW, H); // o Dock ocupa o lugar: fica de fora (nem clique)+ add(D2D1::RectF(r - w, 0, r, H), k, i);+ D2D1_RECT_F box = D2D1::RectF(r - w + PAD, 0, r - PAD, H);+ r -= w;+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);+ return box;+ };+ auto sym = [&](const wchar_t* name, D2D1_RECT_F box, float h) {+ return simbolo::Draw(rt, name, D2D1::RectF(box.left, H / 2 - h / 2, box.right, H / 2 + h / 2), br);+ };+ // Leopard (captura do 10.5): a lupa do Spotlight é o último item, na ponta direita, e o relógio vem antes dela;+ // (a Central de Controle continua, à esquerda do relógio: o usuário quer o acesso a ela)+ if (leo && shell::Setting(L"barra_spotlight", L"1") == L"1") {+ auto bx = slot(15, K_SPOT, 0);+ if (!sym(L"magnifyingglass", bx, 15)) rt->DrawTextW(L"", 1, g_tfIcon, bx, br);+ }+ {+ std::wstring t = ClockText();+ float w = ui::TextWidth(tfN, t) + 2 * PAD;+ if (r - w - (18 + 2 * PAD) < limD) { // embaixo com pouco espaço: só a hora, para a Central de Controle caber+ SYSTEMTIME st; GetLocalTime(&st);+ t = shell::Hora(st); w = ui::TextWidth(tfN, t) + 2 * PAD;+ }+ add(D2D1::RectF(r - w, 0, r, H), K_CLOCK, 0);+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);+ rt->DrawTextW(t.c_str(), (UINT32)t.size(), tfN, D2D1::RectF(r - w + PAD, 0, r, H), br);+ r -= w;+ }+ // microfone/câmera em uso (issue #8, todos os temas): como no macOS, uma bolinha de 6 pt no vão entre a Central de+ // Controle e a data/hora: laranja = microfone, verde = câmera (a câmera ganha). barra_privacidade=0 tira.+ if (shell::Setting(L"barra_privacidade", L"1") != L"0")+ if (int pv = ilha::Privacidade()) {+ br->SetColor(pv & 2 ? D2D1::ColorF(0.20f, 0.78f, 0.35f) : D2D1::ColorF(1.0f, 0.58f, 0.0f));+ rt->FillEllipse(D2D1::Ellipse({ r, H / 2 }, 3, 3), br); // no meio do vão (os dois PAD): nada anda de lugar+ }+ // a Siri entre o relógio e a Central de Controle, como no macOS (só com um serviço escolhido; barra_siri=0 tira)+ if (siri::Pronta() && shell::Setting(L"barra_siri", L"1") != L"0") {+ auto bx = slot(16, K_SIRI, 0);+ float cx = (bx.left + bx.right) / 2, r = 7.f;+ D2D1_GRADIENT_STOP gs[3] = { { 0, D2D1::ColorF(0.98f, 0.36f, 0.62f) }, { 0.5f, D2D1::ColorF(0.62f, 0.38f, 1.f) }, { 1, D2D1::ColorF(0.25f, 0.62f, 1.f) } };+ ID2D1GradientStopCollection* gsc = nullptr; ID2D1LinearGradientBrush* lg = nullptr;+ if (SUCCEEDED(rt->CreateGradientStopCollection(gs, 3, &gsc)) &&+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ cx - r, H / 2 - r }, { cx + r, H / 2 + r }), gsc, &lg)))+ rt->FillEllipse(D2D1::Ellipse({ cx, H / 2 }, r, r), lg);+ if (lg) lg->Release();+ if (gsc) gsc->Release();+ }+ { auto bx = slot(18, K_CC, 0); if (!sym(L"switch.2", bx, 14)) DrawCC(rt, br, (bx.left + bx.right) / 2, H / 2); }+ if (!leo && shell::Setting(L"barra_spotlight", L"1") == L"1") {+ auto bx = slot(15, K_SPOT, 0);+ if (!sym(L"magnifyingglass", bx, 15)) rt->DrawTextW(L"", 1, g_tfIcon, bx, br);+ }+ if (shell::Setting(L"barra_teclado", L"1") == L"1") { // fonte de entrada: a sigla num quadradinho (como o "A" do ABC)+ std::wstring t = InputBadge(g_st.hkl);+ float tw = std::max(15.f, ui::TextWidth(g_tfBadge, t) + 7);+ auto bx = slot(tw, K_INPUT, 0);+ D2D1_RECT_F k = D2D1::RectF(bx.left, H / 2 - 7.5f, bx.right, H / 2 + 7.5f);+ rt->FillRoundedRectangle(D2D1::RoundedRect(k, 3.5f, 3.5f), br);+ br->SetColor(dark ? D2D1::ColorF(0.13f, 0.13f, 0.14f) : D2D1::ColorF(0.96f, 0.96f, 0.96f));+ rt->DrawTextW(t.c_str(), (UINT32)t.size(), g_tfBadge, D2D1::RectF(k.left, k.top - 0.5f, k.right, k.bottom - 0.5f), br);+ }+ // como no Mac: só quem tem Wi-Fi; no cabo, o Wi-Fi desconectado não aparece+ if (g_st.wlan && (g_st.wifiOn || !g_st.wired) && shell::Setting(L"barra_wifi", L"1") == L"1") {+ auto bx = slot(18, K_NET, 0);+ if (!sym(g_st.wifiOn ? L"wifi" : L"wifi.slash", bx, 14)) rt->DrawTextW(L"", 1, g_tfIcon, bx, br);+ }+ if (g_st.batt && shell::Setting(L"barra_bateria", L"1") == L"1") {+ const wchar_t* name = g_st.charging ? L"battery.100percent.bolt" : g_st.pct > 87 ? L"battery.100percent" : g_st.pct > 62 ? L"battery.75percent"+ : g_st.pct > 37 ? L"battery.50percent" : g_st.pct > 12 ? L"battery.25percent" : L"battery.0percent";+ if (liquid::Golden()) {+ // macOS 27 (vídeo do MacVince, 2:44): a porcentagem DENTRO do ícone — corpo cheio de 25 × 12 com canto 4,+ // o número vazado (e o raio quando carrega) e a ponta à direita+ auto bx = slot(29, K_BATT, 0);+ float cy = H / 2;+ D2D1_RECT_F body = D2D1::RectF(bx.left, cy - 6, bx.left + 25, cy + 6);+ rt->FillRoundedRectangle(D2D1::RoundedRect(body, 4, 4), br);+ rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(body.right + 1, cy - 2.5f, body.right + 2.8f, cy + 2.5f), 1, 1), br);+ static IDWriteTextFormat* tfB = ui::Format(9.5f, DWRITE_FONT_WEIGHT_BOLD, false, DWRITE_TEXT_ALIGNMENT_CENTER);+ wchar_t num[8]; swprintf_s(num, L"%d", std::clamp(g_st.pct, 0, 100));+ br->SetColor(dark ? D2D1::ColorF(0.15f, 0.13f, 0.12f, 0.92f) : D2D1::ColorF(1, 1, 1, 0.95f));+ D2D1_RECT_F tr = D2D1::RectF(body.left, body.top - 0.5f, body.right - (g_st.charging ? 6.f : 0.f), body.bottom - 0.5f);+ if (tfB) { tfB->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); rt->DrawTextW(num, (UINT32)wcslen(num), tfB, tr, br); }+ if (g_st.charging) { // raio+ float bx0 = body.right - 6.5f;+ ID2D1PathGeometry* g = nullptr;+ if (SUCCEEDED(ui::d2d->CreatePathGeometry(&g))) {+ ID2D1GeometrySink* sk = nullptr; g->Open(&sk);+ sk->BeginFigure({ bx0 + 2.6f, cy - 4.5f }, D2D1_FIGURE_BEGIN_FILLED);+ D2D1_POINT_2F pts[] = { { bx0, cy + 0.6f }, { bx0 + 1.9f, cy + 0.6f }, { bx0 + 1.1f, cy + 4.5f }, { bx0 + 3.8f, cy - 0.8f }, { bx0 + 1.9f, cy - 0.8f } };+ sk->AddLines(pts, 5); sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();+ rt->FillGeometry(g, br);+ g->Release();+ }+ }+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);+ } else {+ auto bx = slot(27, K_BATT, 0);+ sym(name, bx, 13);+ }+ }+ // Som e Bluetooth: no Mac ficam fora da barra por padrão (Ajustes > Central de Controle liga)+ if (g_st.sound && shell::Setting(L"barra_som", L"0") == L"1") {+ const wchar_t* name = g_st.muted ? L"speaker.slash.fill" : g_st.phones ? L"headphones" : g_st.vol < 0.01f ? L"speaker.fill"+ : g_st.vol < 0.34f ? L"speaker.wave.1.fill" : g_st.vol < 0.67f ? L"speaker.wave.2.fill" : L"speaker.wave.3.fill";+ auto bx = slot(g_st.phones ? 16 : 21, K_SOUND, 0);+ sym(name, bx, g_st.phones ? 16 : 14);+ }+ if (g_st.bt && shell::Setting(L"barra_bluetooth", L"0") == L"1") { // o símbolo do Bluetooth do Mac (não está no SF Symbols público)+ auto bx = slot(9, K_BT, 0);+ float cx = (bx.left + bx.right) / 2, cy = H / 2, hh = 7.2f, ww = 3.9f;+ ID2D1PathGeometry* g = nullptr;+ if (SUCCEEDED(ui::d2d->CreatePathGeometry(&g))) {+ ID2D1GeometrySink* sk = nullptr; g->Open(&sk);+ sk->BeginFigure({ cx - ww, cy - hh * 0.48f }, D2D1_FIGURE_BEGIN_HOLLOW);+ D2D1_POINT_2F pts[] = { { cx + ww, cy + hh * 0.48f }, { cx, cy + hh }, { cx, cy - hh }, { cx + ww, cy - hh * 0.48f }, { cx - ww, cy + hh * 0.48f } };+ sk->AddLines(pts, 5); sk->EndFigure(D2D1_FIGURE_END_OPEN); sk->Close(); sk->Release();+ ID2D1StrokeStyle* st = nullptr;+ ui::d2d->CreateStrokeStyle(D2D1::StrokeStyleProperties(D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_LINE_JOIN_ROUND), nullptr, 0, &st);+ rt->DrawGeometry(g, br, 1.5f, st);+ if (st) st->Release();+ g->Release();+ }+ }+ UINT px = (UINT)std::lround(17 * sc);+ for (int i = (int)tray::icons.size() - 1; i >= 0; i--) {+ auto& t = tray::icons[i];+ if (t.hidden || !t.icon || !IsShown(t) || tray::IsPrivacy(t)) continue; // o do Windows: vira a bolinha+ if (r - 37 < (limD > 0 ? limD + 34 : leftEnd + 60)) { g_overflow = true; break; } // sem espaço: some, como no Mac (macOS 27: aparece a »)+ auto bx = slot(17, K_TRAY, i);+ std::vector<BYTE> mono = IconPixels(t.icon, px);+ // como os ícones-modelo do Mac: uma cor só, a mesma do texto da barra (branco no escuro, preto no claro);+ // o desenho de dentro (ícone de fundo cheio: Discord, WhatsApp) sai pela transparência, nunca por cinza+ // ou pela cor do original, que deixava o ícone azulado/acinzentado em cima do papel de parede.+ float lmin = 1, lmax = 0;+ for (size_t k = 0; k < mono.size(); k += 4) {+ float a = mono[k + 3] / 255.f;+ if (a < 0.5f) continue;+ float l = std::clamp((0.2126f * mono[k + 2] + 0.7152f * mono[k + 1] + 0.0722f * mono[k]) / 255.f / a, 0.f, 1.f);+ lmin = std::min(lmin, l); lmax = std::max(lmax, l);+ }+ bool detail = lmax - lmin > 0.25f; // tem desenho de dentro (senão é só a silhueta)+ BYTE ink = dark ? 255 : 0;+ for (size_t k = 0; k < mono.size(); k += 4) {+ float a = mono[k + 3] / 255.f;+ if (a <= 0.004f) { mono[k] = mono[k + 1] = mono[k + 2] = mono[k + 3] = 0; continue; }+ float oa = a;+ if (detail) {+ float l = std::clamp((0.2126f * mono[k + 2] + 0.7152f * mono[k + 1] + 0.0722f * mono[k]) / 255.f / a, 0.f, 1.f);+ float t = std::clamp((l - lmin) / (lmax - lmin), 0.f, 1.f); // 0 = parte mais escura do original+ oa = a * (dark ? 0.30f + 0.70f * t : 1.f - 0.70f * t);+ }+ oa *= dark ? 0.96f : 0.88f;+ BYTE c = (BYTE)std::lround(ink * oa);+ mono[k] = mono[k + 1] = mono[k + 2] = c;+ mono[k + 3] = (BYTE)std::lround(oa * 255);+ }+ if (ID2D1Bitmap* bmp = ui::Bitmap(rt, px, px, mono)) {+ // no pixel inteiro (1:1 com o bitmap): fora da grade o bitmap era reamostrado e borrava/serrilhava+ float cxp = (bx.left + bx.right) / 2 * sc, cyp = H / 2 * sc;+ float l0 = std::round(cxp - px / 2.f) / sc, t0 = std::round(cyp - px / 2.f) / sc;+ rt->DrawBitmap(bmp, D2D1::RectF(l0, t0, l0 + px / sc, t0 + px / sc), 1, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);+ bmp->Release();+ }+ }+ bool anyHidden = false;+ for (auto& t : tray::icons) if (!t.hidden && t.icon && !IsShown(t) && !tray::IsPrivacy(t)) anyHidden = true;+ if (liquid::Golden() && (g_overflow || anyHidden)) {+ // macOS 27 (vídeo, 2:16): quando os ícones não cabem, uma seta dupla » mostra os escondidos+ auto bx = slot(14, K_MORE, 0);+ float cx = (bx.left + bx.right) / 2, cy = H / 2;+ for (int k = 0; k < 2; k++) {+ float ox = cx - 3.5f + k * 5.5f;+ rt->DrawLine({ ox - 2.2f, cy - 4.5f }, { ox + 2.2f, cy }, br, 1.5f);+ rt->DrawLine({ ox + 2.2f, cy }, { ox - 2.2f, cy + 4.5f }, br, 1.5f);+ }+ anyHidden = false; // já desenhada+ }+ g_overflow = false;+ // setinha dos ícones guardados: não existe no Mac, desligada por padrão (barra_seta=1 liga); a lista abre+ // também no botão direito da Central de Controle+ if (anyHidden && shell::Setting(L"barra_seta", L"0") == L"1") { // setinha dos ícones guardados: o chevron do SF Symbols, apontando para onde eles abrem+ auto bx = slot(8, K_MORE, 0);+ if (!sym(L"chevron.left", bx, 12)) {+ float cx = (bx.left + bx.right) / 2, cy = H / 2;+ rt->DrawLine({ cx + 2, cy - 5 }, { cx - 2.5f, cy }, br, 1.6f);+ rt->DrawLine({ cx - 2.5f, cy }, { cx + 2, cy + 5 }, br, 1.6f);+ }+ }++ // menus do app (entre o nome e os ícones)+ for (int i = 0; i < (int)g_titles.size(); i++) {+ float w = ui::TextWidth(tfN, g_titles[i]) + 20;+ if (x + w > std::min(r - 8, limE)) break;+ add(D2D1::RectF(x, 0, x + w, H), K_MENU, i);+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);+ rt->DrawTextW(g_titles[i].c_str(), (UINT32)g_titles[i].size(), tfN, D2D1::RectF(x + 10, 0, x + w, H), br);+ x += w;+ }+ br->Release();+ ui::End(g_s, false);+}++// ---- menus+// Menus próprios, como os do app no Mac, para os apps sem menu Win32 (os itens mandam o atalho do Windows do+// app). Ids: atalhos de g_keyCmds; 0 = separador. No "Janela" os itens vêm antes da lista de janelas.+struct MenuDef { const wchar_t* title; std::vector<int> ids; };+const std::vector<MenuDef>* AppMenus(App* app) {+ static const std::vector<MenuDef> browser = {+ { L"Arquivo", { 1020, 1001, 5001, 5002, 0, 5003, 5004, 0, 5005, 5006, 5007, 0, 1005 } },+ { L"Editar", { 1010, 5070, 0, 1012, 1013, 1014, 1015, 0, 1016 } },+ { L"Visualizar", { 5010, 0, 5011, 5012, 5013, 0, 5014, 5015, 5016, 5017, 0, 5018, 5019 } },+ { L"Histórico", { 5020, 1040, 1041, 0, 5021, 5022 } },+ { L"Favoritos", { 5030, 0, 5031, 5032 } },+ { L"Aba", { 5040, 5041 } },+ { L"Janela", { 5050, 5051 } },+ { L"Ajuda", { 5060 } },+ };+ static const std::vector<MenuDef> discord = {+ { L"Editar", { 1010, 5070, 0, 1012, 1013, 1014, 1015 } },+ { L"Visualizar", { 5071, 5072, 0, 5015, 5016, 5017 } },+ { L"Janela", {} },+ { L"Ajuda", { 5073 } },+ };+ static const std::vector<MenuDef> whatsapp = {+ { L"Arquivo", { 5080, 5081, 0, 1003 } },+ { L"Editar", { 1010, 1011, 0, 1012, 1013, 1014, 1015, 0, 1016 } },+ { L"Visualizar", { 5015, 5016, 5017 } },+ { L"Janela", {} },+ { L"Ajuda", {} },+ };+ static const std::vector<MenuDef> electron = { // Claude e afins: editar e zoom (o padrão do Electron)+ { L"Arquivo", { 1001, 0, 1003 } },+ { L"Editar", { 1010, 5070, 0, 1012, 1013, 1014, 1015 } },+ { L"Visualizar", { 5071, 0, 5015, 5016, 5017 } },+ { L"Janela", {} },+ { L"Ajuda", {} },+ };+ // o programa da janela ativa (o App do Chrome casa pelo AUMID e pode vir sem o .exe)+ static HWND s_fg; static std::wstring s_path; // a barra pergunta a cada atualização: lido uma vez por janela+ std::wstring path = app ? app->exe : L"";+ DWORD pid = 0;+ if (g_fg && g_fg == s_fg) { if (!s_path.empty()) path = s_path; }+ else if (g_fg && GetWindowThreadProcessId(g_fg, &pid) && pid) {+ s_fg = g_fg; s_path.clear();+ if (HANDLE p = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid)) {+ wchar_t buf[MAX_PATH]; DWORD n = MAX_PATH;+ if (QueryFullProcessImageNameW(p, 0, buf, &n)) path = s_path = buf;+ CloseHandle(p);+ }+ }+ if (path.empty()) return nullptr;+ std::wstring n = path.substr(path.find_last_of(L"\\/") + 1);+ for (auto& c : n) c = towlower(c);+ if (n == L"chrome.exe" || n == L"msedge.exe" || n == L"brave.exe" || n == L"vivaldi.exe") return &browser;+ if (n == L"discord.exe" || n == L"discordptb.exe" || n == L"discordcanary.exe") return &discord;+ if (n.find(L"whatsapp") != std::wstring::npos) return &whatsapp;+ if (n == L"claude.exe") return &electron;+ static const std::vector<MenuDef> spotify = {+ { L"Arquivo", { 5100, 0, 1003 } },+ { L"Editar", { 1010, 1011, 0, 1012, 1013, 1014, 1015, 0, 5108 } },+ { L"Visualizar", { 5015, 5016, 5017 } },+ { L"Reprodução", { 5101, 5102, 5103, 0, 5104, 5105, 0, 5106, 5107 } },+ { L"Janela", {} },+ { L"Ajuda", {} },+ };+ static const std::vector<MenuDef> vscode = {+ { L"Arquivo", { 5120, 5121, 0, 1002, 0, 1004, 5122, 0, 5123 } },+ { L"Editar", { 1010, 1011, 0, 1012, 1013, 1014, 0, 1016, 5124, 0, 5125 } },+ { L"Seleção", { 1015 } },+ { L"Visualizar", { 5126, 0, 5127, 5125, 5128, 5129, 0, 5134, 0, 5016, 5017, 5015 } },+ { L"Ir", { 5130, 5131 } },+ { L"Executar", { 5132, 5133 } },+ { L"Janela", {} },+ { L"Ajuda", {} },+ };+ if (n == L"spotify.exe") return &spotify;+ if (n == L"code.exe" || n == L"cursor.exe" || n == L"code - insiders.exe") return &vscode;+ return nullptr;+}++std::vector<std::wstring> GenericTitles(App* app) {+ if (!g_finderActive)+ if (auto* defs = AppMenus(app)) {+ std::vector<std::wstring> t;+ for (auto& d : *defs) t.push_back(Tr(d.title));+ return t;+ }+ if (g_finderActive) return { Tr(L"Arquivo"), Tr(L"Editar"), Tr(L"Visualizar"), Tr(L"Ir"), Tr(L"Janela"), Tr(L"Ajuda") };+ return { Tr(L"Arquivo"), Tr(L"Editar"), Tr(L"Janela"), Tr(L"Ajuda") };+}++std::vector<ctxmenu::Item> GenericMenu(const std::wstring& title, App* app) {+ std::vector<ctxmenu::Item> pre; // Janela: itens do app antes dos comuns (minimizar, zoom, lista de janelas)+ if (auto* defs = g_finderActive ? nullptr : AppMenus(app))+ for (auto& d : *defs) {+ if (title != Tr(d.title)) continue;+ std::vector<ctxmenu::Item> v;+ for (int id : d.ids) v.push_back(id ? K(id) : Sep());+ if (title != Tr(L"Janela")) {+ if (v.empty()) v.push_back(I(Tr(L"Nenhum item"), 0, true));+ return v;+ }+ if (!v.empty()) { pre = v; pre.push_back(Sep()); }+ break;+ }+ if (title == Tr(L"Arquivo")) {+ if (g_finderActive) return { K(1001), K(1020), K(1021), Sep(), K(1002), K(1003), Sep(), K(1022), Sep(), K(1023) };+ return { K(1001), K(1002), Sep(), K(1003), K(1004), Sep(), K(1005) };+ }+ if (title == Tr(L"Editar")) return { K(1010), K(1011), Sep(), K(1012), K(1013), K(1014), K(1015), Sep(), K(1016) };+ if (title == Tr(L"Visualizar")) return { K(1030), K(1031), K(1032), K(1033), Sep(), K(1034) };+ if (title == Tr(L"Ir")) return { K(1040), K(1041), K(1042), Sep(), K(1043), Sep(), I(Tr(L"Recentes"), 1100), I(Tr(L"Documentos"), 1101), I(Tr(L"Mesa"), 1102), I(Tr(L"Downloads"), 1103), I(Tr(L"Início"), 1104), I(Tr(L"Este Computador"), 1105), I(Tr(L"Aplicativos"), 1106) };+ if (title == Tr(L"Janela")) {+ std::vector<ctxmenu::Item> v{ I(Tr(L"Minimizar"), 1200), I(Tr(L"Zoom"), 1201), Sep(), I(Tr(L"Trazer Tudo para a Frente"), 1202) };+ v.insert(v.begin(), pre.begin(), pre.end());+ if (app && !app->wins.empty()) {+ v.push_back(Sep());+ for (int k = 0; k < (int)app->wins.size() && k < 20; k++) {+ auto it = I(app->wins[k].title, 3000 + k);+ it.checked = app->wins[k].hwnd == g_fg;+ v.push_back(it);+ }+ }+ return v;+ }+ if (title == Tr(L"Ajuda")) return { K(1050) };+ return {};+}++std::vector<ctxmenu::Item> LogoMenu() {+ std::vector<ctxmenu::Item> recent;+ { // Itens Recentes: os atalhos mais novos de shell:Recent+ PWSTR p = nullptr;+ if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Recent, 0, nullptr, &p))) {+ std::wstring dir = p; CoTaskMemFree(p);+ std::vector<std::pair<ULONGLONG, std::wstring>> files;+ WIN32_FIND_DATAW fd;+ HANDLE h = FindFirstFileW((dir + L"\\*.lnk").c_str(), &fd);+ if (h != INVALID_HANDLE_VALUE) {+ do files.push_back({ ((ULONGLONG)fd.ftLastWriteTime.dwHighDateTime << 32) | fd.ftLastWriteTime.dwLowDateTime, dir + L"\\" + fd.cFileName });+ while (FindNextFileW(h, &fd));+ FindClose(h);+ }+ std::sort(files.begin(), files.end(), [](auto& a, auto& b) { return a.first > b.first; });+ static std::vector<std::wstring> s_recent;+ s_recent.clear();+ for (size_t k = 0; k < files.size() && k < 10; k++) {+ std::wstring n = files[k].second.substr(files[k].second.find_last_of(L'\\') + 1);+ n.resize(n.size() - 4);+ s_recent.push_back(files[k].second);+ recent.push_back(I(n, 4000 + (int)k));+ }+ if (recent.empty()) recent.push_back(I(Tr(L"Nenhum item"), 0, true));+ }+ }+ wchar_t user[128] = L""; DWORD n = 128; GetUserNameW(user, &n);+ ctxmenu::Item rec = I(Tr(L"Itens Recentes"), 0); rec.sub = recent;+ return { I(Tr(L"Sobre Este Mac"), 100), Sep(), I(Tr(L"Ajustes do Sistema…"), 101), I(Tr(L"Microsoft Store…"), 102), Sep(),+ rec, Sep(), I(Tr(L"Forçar Encerrar…"), 103), Sep(), I(Tr(L"Repousar"), 104), I(Tr(L"Reiniciar…"), 105), I(Tr(L"Desligar…"), 106), Sep(),+ I(Tr(L"Bloquear Tela"), 107), I(Tr(L"Encerrar Sessão de ") + std::wstring(user) + L"…", 108), Sep(), I(Tr(L"Sair do Shell (voltar à barra do Windows)"), 109) };+}++std::vector<ctxmenu::Item> AppMenu(App* a) {+ std::wstring n = a ? a->name : g_appName;+ return { I(Tr(L"Sobre ") + n, 200), Sep(), K(1051), Sep(), I(Tr(L"Ocultar ") + n, 201), I(Tr(L"Ocultar Outros"), 202), I(Tr(L"Mostrar Tudo"), 203), Sep(), I(Tr(L"Encerrar ") + n, 204) };+}+++void Shutdown(UINT how) {+ HANDLE tok;+ if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tok)) {+ TOKEN_PRIVILEGES tp{ 1 };+ LookupPrivilegeValueW(nullptr, SE_SHUTDOWN_NAME, &tp.Privileges[0].Luid);+ tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;+ AdjustTokenPrivileges(tok, FALSE, &tp, 0, nullptr, nullptr);+ CloseHandle(tok);+ }+ ExitWindowsEx(how, SHTDN_REASON_FLAG_PLANNED);+}++void Open(const wchar_t* what, const wchar_t* args = nullptr) {+ if (!wcsncmp(what, L"ms-settings:", 12)) { shell::OpenSettings(what); return; } // o nosso Ajustes do Sistema+ shell::Abrir(L"open", what, args, nullptr, SW_SHOWNORMAL);+}++void OpenFinder(const std::wstring& args) {+ if (shell::nativo) { shell::AbrirFinder(args); return; }+ for (auto& a : apps::list) if (a.finder) { shell::Abrir(L"open", a.launch.c_str(), args.c_str(), nullptr, SW_SHOWNORMAL); return; }+}++void Run(int id, App* app) {+ for (auto& k : g_keyCmds) if (k.id == id) { // atalho de teclado para o app ativo+ if (g_fg) SetForegroundWindow(g_fg);+ Sleep(30);+ SendKeys(k.keys);+ return;+ }+ if (id >= 1000 && id < 1100) return;+ switch (id) {+ case 100: sobre::Show(); break;+ case 101: shell::OpenSettings(L""); break;+ case 102: Open(L"ms-windows-store:"); break;+ case 103: shell::OpenForceQuit(false); break;+ case 104: SetSuspendState(FALSE, FALSE, FALSE); break;+ // como no Mac: alerta com o ícone do computador, Cancelar | Reiniciar/Desligar (antes era a caixa do Windows). O ícone é+ // o mesmo do Sobre Este Mac: o computador em alumínio (modo "este PC", o padrão) ou o Mac Studio+ case 105: alertas::Confirm(Tr(L"Tem certeza de que deseja reiniciar o computador agora?"), L"", Tr(L"Reiniciar"), [] { Shutdown(EWX_REBOOT); }, IconePC()); break;+ case 106: alertas::Confirm(Tr(L"Tem certeza de que deseja desligar o computador agora?"), L"", Tr(L"Desligar"), [] { Shutdown(EWX_POWEROFF); }, IconePC()); break;+ case 107: bloqueio::Lock(); break; // a nossa tela de bloqueio (o LockWorkStation fica desligado pela política enquanto o Shell roda: não fazia nada, issue #8)+ case 108: alertas::Confirm(Tr(L"Tem certeza de que deseja encerrar todos os aplicativos e sair agora?"), L"", Tr(L"Encerrar Sessão"), [] { ExitWindowsEx(EWX_LOGOFF, 0); }, IconePC()); break;+ case 109: shell::Quit(L"menu do logo"); break;+ case 200: if (app && !app->exe.empty()) shell::Abrir(L"properties", app->exe.c_str(), nullptr, nullptr, SW_SHOWNORMAL); break;+ case 201: if (app) apps::Hide(*app); break;+ case 202: for (auto& a : apps::list) if (&a != app) apps::Hide(a); break;+ case 203: for (auto& a : apps::list) for (auto& w : a.wins) if (w.minimized) ShowWindow(w.hwnd, SW_SHOWNOACTIVATE); break;+ case 204: if (app) apps::Quit(*app); break;+ case 1100: OpenFinder(L"shell:Recent"); break;+ case 1101: OpenFinder(L"shell:Personal"); break;+ case 1102: OpenFinder(L"shell:Desktop"); break;+ case 1103: OpenFinder(L"shell:Downloads"); break;+ case 1104: OpenFinder(L"shell:Profile"); break;+ case 1105: OpenFinder(L"shell:MyComputerFolder"); break;+ case 1106: OpenFinder(L"shell:Common Programs"); break;+ case 1200: if (g_fg) ShowWindow(g_fg, SW_MINIMIZE); break;+ case 1201: if (g_fg) ShowWindow(g_fg, IsZoomed(g_fg) ? SW_RESTORE : SW_MAXIMIZE); break;+ case 1202: if (app) apps::Activate(*app); break;+ }+ if (id >= 3000 && id < 3100 && app && id - 3000 < (int)app->wins.size()) {+ HWND w = app->wins[id - 3000].hwnd;+ if (IsIconic(w)) shell::Restaurar(w);+ SetForegroundWindow(w);+ }+}++int g_closedHit = -1; DWORD g_closedHitAt; // o título cujo menu acabou de fechar (clicar nele de novo só fecha)+void ShowAt(int hit, const std::vector<ctxmenu::Item>& items, std::function<void(int)> done) {+ g_open = hit;+ g_openBar = Cur();+ Render();+ float sc = ui::Scale(Cur());+ RECT wr; GetWindowRect(Cur(), &wr);+ POINT pt{ wr.left + (LONG)std::lround(g_hits[hit].r.left * sc), wr.bottom };+ // Tahoe (guia, seção 35): o menu abre 1 pt abaixo da barra e 4 pt à esquerda do título (o texto fica a 10 da caixa)+ if (liquid::On()) pt = { wr.left + (LONG)std::lround((g_hits[hit].r.left + 6) * sc), wr.bottom + (LONG)std::lround(sc) };+ if (Cur() == g_bar && menubar::Embaixo()) { // na linha do Dock os menus sobem, centrados no item+ pt = { wr.left + (LONG)std::lround((g_hits[hit].r.left + g_hits[hit].r.right) / 2 * sc), wr.top - (LONG)std::lround(4 * sc) };+ ctxmenu::AboveNext();+ }+ SetForegroundWindow(g_owner); // o menu fecha se a janela dona não estiver na frente+ int id = ctxmenu::ShowItems(g_owner, pt, items);+ g_closedHit = hit; g_closedHitAt = GetTickCount();+ g_open = -1;+ Render();+ if (g_fg && IsWindow(g_fg)) SetForegroundWindow(g_fg);+ if (id) done(id);+}++void Click(D2D1_POINT_2F p, bool right) {+ int hit = -1;+ for (int i = 0; i < (int)g_hits.size(); i++)+ if (p.x >= g_hits[i].r.left && p.x < g_hits[i].r.right) { hit = i; break; }+ if (hit < 0) return;+ if (!right && hit == g_closedHit && GetTickCount() - g_closedHitAt < 400) { g_closedHit = -1; return; } // clique no mesmo título: só fechou+ g_closedHit = -1;+ Hit h = g_hits[hit];+ App* app = ActiveApp();+ float sc = ui::Scale(Cur());+ RECT wr; GetWindowRect(Cur(), &wr);+ POINT spt{ wr.left + (LONG)std::lround((h.r.left + h.r.right) / 2 * sc), wr.bottom };+ switch (h.kind) {+ case K_LOGO: ShowAt(hit, LogoMenu(), [&](int id) {+ if (id >= 4000 && id < 4010) { // item recente+ PWSTR p = nullptr; SHGetKnownFolderPath(FOLDERID_Recent, 0, nullptr, &p);+ std::wstring dir = p; CoTaskMemFree(p);+ std::vector<std::pair<ULONGLONG, std::wstring>> files;+ WIN32_FIND_DATAW fd; HANDLE fh = FindFirstFileW((dir + L"\\*.lnk").c_str(), &fd);+ if (fh != INVALID_HANDLE_VALUE) { do files.push_back({ ((ULONGLONG)fd.ftLastWriteTime.dwHighDateTime << 32) | fd.ftLastWriteTime.dwLowDateTime, dir + L"\\" + fd.cFileName }); while (FindNextFileW(fh, &fd)); FindClose(fh); }+ std::sort(files.begin(), files.end(), [](auto& a, auto& b) { return a.first > b.first; });+ if (id - 4000 < (int)files.size()) Open(files[id - 4000].second.c_str());+ } else Run(id, app);+ }); break;+ case K_APP: ShowAt(hit, AppMenu(app), [&](int id) { Run(id, app); }); break;+ case K_MENU:+ if (g_hmenu && IsMenu(g_hmenu)) {+ HMENU sub = GetSubMenu(g_hmenu, h.index);+ if (!sub) break;+ SendMessageTimeoutW(g_fg, WM_INITMENU, (WPARAM)g_hmenu, 0, SMTO_ABORTIFHUNG, 200, nullptr);+ SendMessageTimeoutW(g_fg, WM_INITMENUPOPUP, (WPARAM)sub, h.index, SMTO_ABORTIFHUNG, 200, nullptr);+ HWND target = g_fg;+ ShowAt(hit, FromHmenu(sub, 0), [&](int id) { PostMessageW(target, WM_COMMAND, MAKEWPARAM(id, 0), 0); });+ } else ShowAt(hit, GenericMenu(g_titles[h.index], app), [&](int id) { Run(id, app); });+ break;+ case K_TRAY: tray::Click(h.index, right ? WM_RBUTTONUP : WM_LBUTTONUP, spt); break;+ case K_CC:+ if (!right) { central::Toggle(); break; }+ [[fallthrough]]; // botão direito: a lista dos ícones guardados (a setinha fica desligada, como no Mac)+ case K_MORE: { // lista dos ícones guardados: abrir, menu do app, mostrar na barra+ std::vector<ctxmenu::Item> items;+ std::vector<int> idx;+ for (int i = 0; i < (int)tray::icons.size(); i++) {+ auto& t = tray::icons[i];+ if (t.hidden || !t.icon || tray::IsPrivacy(t)) continue;+ std::wstring name = TrayKey(t);+ if (name.empty()) name = Tr(L"(sem nome)");+ ctxmenu::Item it = I(name, 0);+ { // o ícone do app na linha; os de uma cor só (brancos ou pretos) saem na cor do texto do menu+ it.img = 32;+ it.imgPx = IconPixels(t.icon, it.img);+ auto& p = it.imgPx;+ bool branco = true, preto = true;+ for (size_t k = 0; k + 3 < p.size(); k += 4) {+ if (p[k + 3] < 128) continue;+ for (int c = 0; c < 3; c++) { branco &= p[k + c] >= p[k + 3] * 0.85f; preto &= p[k + c] <= p[k + 3] * 0.15f; }+ }+ if (branco || preto) {+ const bool claro = ui::Dark() && !liquid::Leopard();+ for (size_t k = 0; k + 3 < p.size(); k += 4) p[k] = p[k + 1] = p[k + 2] = claro ? p[k + 3] : 0;+ }+ }+ it.sub = { I(Tr(L"Abrir"), 1000 + i * 4), I(Tr(L"Menu do App"), 1001 + i * 4), Sep(), I(Tr(L"Mostrar na barra de menus"), 1002 + i * 4, false, IsShown(t)) };+ items.push_back(it);+ }+ ShowAt(hit, items, [&](int id) {+ int i = (id - 1000) / 4, op = (id - 1000) % 4;+ if (i < 0 || i >= (int)tray::icons.size()) return;+ if (op == 2) { SetShown(tray::icons[i], !IsShown(tray::icons[i])); return; }+ tray::Click(i, op == 1 ? WM_RBUTTONUP : WM_LBUTTONUP, spt);+ });+ break;+ }+ case K_SPOT: spotlight::Toggle(); break;+ case K_SIRI: siri::Abrir(); break;+ case K_NET: {+ std::wstring ssid = g_st.ssid.empty() ? Tr(L"Conectado") : g_st.ssid; // sem a permissão de localização o nome não vem+ bool wifi = g_st.wifiOn;+ ShowAt(hit, { I(wifi ? L"Wi-Fi: " + ssid : L"Ethernet", 0, true), Sep(), I(Tr(L"Ajustes de Rede…"), 1) }, [](int) { Open(L"ms-settings:network"); });+ break;+ }+ case K_SOUND: { // menu "Som" do Mac (som.cpp): volume, saídas e Ajustes de Som+ RECT ir{ wr.left + (LONG)std::lround(h.r.left * sc), wr.top, wr.left + (LONG)std::lround(h.r.right * sc), wr.bottom };+ som::Toggle(ir);+ break;+ }+ case K_BT: ShowAt(hit, { I(Tr(L"Bluetooth"), 0, true), Sep(), I(Tr(L"Ajustes de Bluetooth…"), 1) }, [](int) { shell::OpenSettings(L"bluetooth"); }); break;+ case K_BATT: {+ wchar_t b[64]; swprintf_s(b, Tr(L"Bateria: %d%%"), g_st.pct);+ ShowAt(hit, { I(b, 0, true), I(g_st.charging ? Tr(L"Fonte de Energia: Carregador") : Tr(L"Fonte de Energia: Bateria"), 0, true), Sep(), I(Tr(L"Ajustes de Bateria…"), 1) },+ [](int) { shell::OpenSettings(L"energia"); });+ break;+ }+ case K_INPUT: { // as fontes de entrada instaladas; a escolhida vai para o app da frente+ HKL list[32]; int n = GetKeyboardLayoutList(32, list);+ std::vector<ctxmenu::Item> items;+ for (int i = 0; i < n; i++) items.push_back(I(InputBadge(list[i]) + L" " + LayoutName(list[i]), 100 + i, false, list[i] == g_st.hkl));+ items.push_back(Sep());+ items.push_back(I(Tr(L"Abrir Ajustes de Teclado…"), 1));+ HWND target = g_fg;+ ShowAt(hit, items, [&](int id) {+ if (id == 1) { shell::OpenSettings(L"teclado"); return; }+ if (id >= 100 && id - 100 < n && target) PostMessageW(target, WM_INPUTLANGCHANGEREQUEST, 0, (LPARAM)list[id - 100]);+ RefreshStatus(); Render();+ });+ break;+ } // painel da Central de Controle (central.cpp)+ case K_CLOCK: {+ if (!right) { notificacoes::Toggle(); break; } // clique: Central de Notificações; botão direito: data e ajustes+ SYSTEMTIME st; GetLocalTime(&st);+ wchar_t full[128] = {};+ GetDateFormatEx(idioma::Locale(), DATE_LONGDATE, &st, nullptr, full, 128, nullptr);+ ShowAt(hit, { I(full, 0, true), Sep(), I(Tr(L"Ajustes de Data e Hora…"), 1) }, [](int) { Open(L"ms-settings:dateandtime"); });+ break;+ }+ }+}++// Desenha todas as barras (a principal por último: os itens dela ficam em g_hits de quem chama sem g_cur)+void RenderAll() {+ HWND keep = g_cur;+ for (HWND b : g_extras) if (IsWindowVisible(b)) { g_cur = b; Render(); }+ g_cur = nullptr;+ Render();+ g_cur = keep;+}++// Redesenha só quando algo visível mudou (antes: a barra inteira a cada segundo)+void RenderIfChanged() {+ static std::wstring last;+ std::wstring sig = g_appName + L"|" + ClockText() + L"|" + std::to_wstring(ui::Dark()) + L"|" + std::to_wstring(g_titles.size());+ for (auto& t : g_titles) sig += t;+ wchar_t b[128];+ swprintf_s(b, L"|%d%d%d%d%d%d%d|%d|%d|%p|%d", g_st.wlan, g_st.wifiOn, g_st.batt, g_st.charging, g_st.bt, g_st.sound, g_st.muted,+ g_st.pct, (int)std::lround(g_st.vol * 3), (void*)g_st.hkl, g_st.phones);+ sig += b;+ for (auto& t : tray::icons) { swprintf_s(b, L"|%p%d%d", (void*)t.icon, t.hidden, IsShown(t)); sig += b; }+ RECT rc; GetClientRect(g_bar, &rc);+ sig += std::to_wstring(rc.right) + L"x" + std::to_wstring(rc.bottom);+ for (HWND b : g_extras) { GetClientRect(b, &rc); sig += L"|" + std::to_wstring(rc.right) + L"x" + std::to_wstring(IsWindowVisible(b)); }+ sig += L"|" + std::to_wstring(g_vaoE) + L"-" + std::to_wstring(g_vaoD);+ if (sig == last) return;+ last = sig;+ RenderAll();+}++const UINT WM_BARDISPLAYS = WM_APP + 41; // monitores mudaram: refaz as barras (fora do WndProc que recebeu o aviso)++// A barra principal no lugar dela: o topo do monitor, ou (barra_embaixo, issue #29) o meio da linha do Dock, com um+// buraco na janela onde o Dock está, para os cliques e o passar do mouse continuarem dele. O Dock muda de largura+// sozinho (app aberto, ampliação): o timer de 1 s chama de novo.+void Assenta() {+ if (!g_bar) return;+ static bool eraEmbaixo;+ static RECT posto;+ const bool baixo = menubar::Embaixo();+ HMONITOR hm = MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY);+ MONITORINFO mi{ sizeof(mi) };+ if (!GetMonitorInfoW(hm, &mi)) return;+ RECT q = mi.rcMonitor;+ const int alt = menubar::HeightOn(hm);+ if (baixo) q.top = q.bottom - menubar::ReservedBottom(hm) / 2 - alt / 2;+ q.bottom = q.top + alt;+ const bool mudou = baixo != eraEmbaixo, moveu = baixo && !EqualRect(&q, &posto);+ int e = 0, d = 0;+ if (baixo) {+ RECT v;+ // com o ponteiro em cima, o Dock está ampliado: o vão fica como estava (senão os menus piscavam)+ if (dock::Vidro(&v) && v.bottom > q.top && v.top < q.bottom) {+ e = std::max<int>(0, v.left - q.left); d = std::min<int>(q.right - q.left, v.right - q.left);+ POINT pt; GetCursorPos(&pt);+ if (!mudou && !moveu && g_vaoD > g_vaoE && PtInRect(&v, pt)) { e = g_vaoE; d = g_vaoD; }+ }+ }+ if (!mudou && !moveu && e == g_vaoE && d == g_vaoD) return;+ eraEmbaixo = baixo; posto = q; g_vaoE = e; g_vaoD = d;+ SetWindowPos(g_bar, HWND_TOPMOST, q.left, q.top, q.right - q.left, q.bottom - q.top, SWP_NOACTIVATE);+ HRGN rg = nullptr;+ if (d > e) {+ rg = CreateRectRgn(0, 0, q.right - q.left, q.bottom - q.top);+ HRGN furo = CreateRectRgn(e, 0, d, q.bottom - q.top);+ CombineRgn(rg, rg, furo, RGN_DIFF);+ DeleteObject(furo);+ }+ SetWindowRgn(g_bar, rg, TRUE); // a janela fica dona da região+ if (mudou) {+ BarGlass(g_bar);+ Log(L"barra de menus: %ls", baixo ? L"embaixo, na linha do Dock" : L"em cima");+ menubar::Displays();+ return;+ }+ if (baixo) Log(L"barra de menus: embaixo em %d,%d-%d,%d, o Dock de %d a %d", q.left, q.top, q.right, q.bottom, e, d);+ RenderAll();+ if (moveu) shell::ApplyWorkArea();+}+++// Barra de menus de vidro (Ajustes > Transparência > "Barra de menus de vidro", barra_vidro=1, só no Liquid Glass):++// como o Dock, uma janela logo atrás de cada barra com o vidro do backdrop (o real: captura da tela, desfoque leve,++// vibrância, borda que refrata e brilho). Sem ela a barra do Tahoe não tem fundo nenhum, e em papel de parede++// cheio de detalhe as letras sumiam (pedido de 22/11/2026).++std::map<HWND, HWND> g_vidro; // barra -> janela de vidro atrás dela++// o último lugar/tinta passados ao vidro de cada barra: o relógio chama SyncVidro a cada segundo e, sem mudança, não se++// mexe em nada (antes: SetWindowPos + backdrop::Set a cada segundo, e cada SetWindowPos fazia o vidro real refazer a++// lista de janelas e remontar o fundo inteiro; o Set igual ainda redesenhava a peça)++struct VidroUlt { RECT r{}; bool white = false, ok = false; };++std::map<HWND, VidroUlt> g_vidroUlt;++bool GlassBarOn() { return backdrop::Liquid() && !liquid::Leopard() && shell::Setting(L"barra_vidro", L"0") == L"1"; }++LRESULT CALLBACK VidroProc(HWND h, UINT m, WPARAM w, LPARAM l) {++ if (m == WM_MOUSEACTIVATE) return MA_NOACTIVATE;++ if (m == WM_NCHITTEST) return HTTRANSPARENT;++ if (m == WM_PAINT) { PAINTSTRUCT ps; BeginPaint(h, &ps); EndPaint(h, &ps); return 0; }++ return DefWindowProcW(h, m, w, l);++}++void SyncVidro(HWND bar) {++ auto it = g_vidro.find(bar);++ HWND v = it != g_vidro.end() ? it->second : nullptr;++ if (!GlassBarOn() || !IsWindow(bar) || !IsWindowVisible(bar)) {++ if (v && IsWindowVisible(v)) ShowWindow(v, SW_HIDE);++ g_vidroUlt[bar].ok = false;++ return;++ }++ if (!v) {++ if (it != g_vidro.end()) return; // já falhou nesta barra++ static bool reg;++ if (!reg) { WNDCLASSW c{}; c.lpfnWndProc = VidroProc; c.hInstance = shell::inst; c.lpszClassName = L"ShellBarraVidro"; RegisterClassW(&c); reg = true; }++ v = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_TRANSPARENT | WS_EX_NOREDIRECTIONBITMAP, L"ShellBarraVidro", L"",++ WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, shell::inst, nullptr);++ if (!v || !backdrop::Attach(v)) {++ if (v) DestroyWindow(v);++ g_vidro[bar] = nullptr;++ Log(L"barra de menus: vidro indisponível");++ return;++ }++ apps::ours.push_back(v);++ g_vidro[bar] = v;++ }++ RECT r; GetWindowRect(bar, &r);++ const int w = r.right - r.left, h = r.bottom - r.top;++ if (w <= 0 || h <= 0) { ShowWindow(v, SW_HIDE); g_vidroUlt[bar].ok = false; return; }++ // tinta pela cor do texto (que segue o papel de parede): letras pretas -> vidro claro; brancas -> vidro escuro++ bool white = WallpaperTopDark(ui::Dark());++ VidroUlt& u = g_vidroUlt[bar];++ const bool same = u.ok && EqualRect(&u.r, &r) && u.white == white && IsWindowVisible(v);++ // logo atrás da barra (o vidro não passa por cima de nada além dela); só se mudou ou se algo entrou entre os dois++ if (!same || GetWindow(bar, GW_HWNDNEXT) != v) SetWindowPos(v, bar, r.left, r.top, w, h, SWP_NOACTIVATE | SWP_SHOWWINDOW);++ if (same) return;++ D2D1_COLOR_F tint = white ? D2D1::ColorF(0.12f, 0.12f, 0.13f, 0.26f) : D2D1::ColorF(0.98f, 0.98f, 0.99f, 0.34f);++ backdrop::Set(v, (float)w, (float)h, 0.f, tint);++ u.r = r; u.white = white; u.ok = true;++}++void DropVidro(HWND bar) {++ auto it = g_vidro.find(bar);++ if (it == g_vidro.end()) return;++ if (it->second) { backdrop::Detach(it->second); DestroyWindow(it->second); }++ g_vidro.erase(it);++ g_vidroUlt.erase(bar);++}+++LRESULT CALLBACK BarProc(HWND h, UINT m, WPARAM w, LPARAM l) {+ switch (m) {+ case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(h, &ps); EndPaint(h, &ps); HWND keep = g_cur; g_cur = h; Render(); g_cur = keep; return 0; }+ case WM_LBUTTONDOWN: case WM_RBUTTONUP: {+ float sc = ui::Scale(h);+ HWND keep = g_cur;+ g_cur = h; // os menus abrem embaixo da barra clicada (no monitor dela)+ Click({ (short)LOWORD(l) / sc, (short)HIWORD(l) / sc }, m == WM_RBUTTONUP);+ g_cur = keep;+ return 0;+ }+ case WM_BARDISPLAYS: menubar::Displays(); return 0;+ case WM_MOUSEACTIVATE: return MA_NOACTIVATE;+ case WM_TIMER:+ if (w == 2) { TiqueOcultar(); return 0; }+ RefreshStatus(); Assenta(); menubar::Update();++ SyncVidro(g_bar); for (HWND b : g_extras) SyncVidro(b); // barra de vidro (PR #18): ligado/desligado nos Ajustes, tinta, monitores+ if (shell::Setting(L"relogio_segundos", L"0") == L"1") { // com segundos: o tique cai logo depois da virada do segundo+ SYSTEMTIME agora; GetLocalTime(&agora);+ SetTimer(h, 1, 1000 - agora.wMilliseconds + 15, nullptr);+ }+ return 0;++ case WM_WINDOWPOSCHANGED: SyncVidro(h); break; // o vidro acompanha a barra (lugar, tamanho, escondida)++ case WM_DESTROY: DropVidro(h); break;+ case WM_BARSTATUS: PegaStatus(); menubar::Update(); return 0;+ case WM_SETTINGCHANGE: // Windows trocou entre claro e escuro+ if (l && !lstrcmpiW((LPCWSTR)l, L"ImmersiveColorSet")) { menubar::ApplyTheme(); dock::ApplyTheme(); }+ break;+ case WM_DPICHANGED: case WM_DISPLAYCHANGE:+ // todas as barras recebem o aviso: só a principal refaz (depois, fora deste WndProc)+ PostMessageW(g_bar, WM_BARDISPLAYS, 0, 0);+ return 0;+ }+ return DefWindowProcW(h, m, w, l);+}++} // namespace++HWND menubar::Hwnd() { return g_bar; }+void menubar::SoundChanged(bool device) {+ if (!g_bar) return;+ if (device) g_audioStale = true;+ RefreshStatus();+ if (g_open < 0) RenderAll();+}+bool menubar::SoundIcon(RECT* out) {+ if (!g_bar || !IsWindowVisible(Cur())) return false;+ for (auto& h : g_hits)+ if (h.kind == K_SOUND) {+ float sc = ui::Scale(Cur());+ RECT wr; GetWindowRect(Cur(), &wr);+ *out = { wr.left + (LONG)std::lround(h.r.left * sc), wr.top, wr.left + (LONG)std::lround(h.r.right * sc), wr.bottom };+ return true;+ }+ return false;+}+void menubar::ApplyTheme() {+ if (!g_bar) return;+ { // tema trocado (Sequoia 26 pt / Tahoe 30 pt): a barra muda de altura+ static float lastPt = 0;+ if (lastPt && lastPt != BAR_PT) menubar::Displays();+ lastPt = BAR_PT;+ }+ BarGlass(g_bar);+ InvalidateRect(g_bar, nullptr, FALSE);+ for (HWND b : g_extras) { BarGlass(b); InvalidateRect(b, nullptr, FALSE); }+}+static bool g_fsOn;+static HMONITOR g_fsMon;+// Ocultar e mostrar automaticamente (barra_ocultar=1, Ajustes > Central de Controle, como no Mac; issue #40): a barra não+// reserva o topo (as janelas maximizadas vão até em cima) e só aparece com o ponteiro encostado no topo da tela; some+// quando ele sai dela (e não há menu dela aberto). Com a barra na linha do Dock não vale.+static bool g_revelada;+static bool Ocultar() { return shell::Setting(L"barra_ocultar", L"0") == L"1" && !menubar::Embaixo(); }+static bool Escondida(HWND b, HMONITOR hm) {+ if (g_fsOn && (!g_fsMon || g_fsMon == hm)) return true;+ return Ocultar() && !g_revelada;+}+static void Revela(bool on) {+ if (on == g_revelada) return;+ g_revelada = on;+ std::vector<HWND> all{ g_bar };+ all.insert(all.end(), g_extras.begin(), g_extras.end());+ auto alheias = shell::AlheiasNoTopo();+ for (HWND b : all) {+ bool hide = Escondida(b, MonitorFromWindow(b, MONITOR_DEFAULTTONEAREST));+ if (hide == !IsWindowVisible(b)) continue;+ ShowWindow(b, hide ? SW_HIDE : SW_SHOWNOACTIVATE);+ if (!hide) SetWindowPos(b, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);+ }+ shell::DevolveAlheias(alheias);+}+// ponteiro no topo de um monitor com barra por ~120 ms: mostra; fora dela (com folga) por ~400 ms: esconde+static void TiqueOcultar() {+ if (!Ocultar()) { Revela(true); return; }+ POINT pt; if (!GetCursorPos(&pt)) return;+ HMONITOR hm = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);+ MONITORINFO mi{ sizeof(mi) }; if (!GetMonitorInfoW(hm, &mi)) return;+ bool temBarra = (mi.dwFlags & MONITORINFOF_PRIMARY) || !g_extras.empty();+ static DWORD noTopo, fora;+ DWORD agora = GetTickCount();+ bool botao = GetAsyncKeyState(VK_LBUTTON) < 0 || GetAsyncKeyState(VK_RBUTTON) < 0;+ if (!g_revelada) {+ bool topo = temBarra && pt.y <= mi.rcMonitor.top + 1 && !botao && !(g_fsOn && (!g_fsMon || g_fsMon == hm));+ if (!topo) { noTopo = 0; return; }+ if (!noTopo) noTopo = agora;+ if (agora - noTopo >= 120) { noTopo = 0; fora = 0; Revela(true); }+ return;+ }+ bool perto = pt.y <= mi.rcMonitor.top + menubar::HeightOn(hm) + 12 || g_open >= 0 || ctxmenu::IsOpen();+ if (perto) { fora = 0; return; }+ if (!fora) fora = agora;+ if (agora - fora >= 400) { fora = 0; Revela(false); }+}+void menubar::SetFullscreen(bool on, HMONITOR mon) {+ if (!g_bar) return;+ g_fsOn = on; g_fsMon = mon;+ std::vector<HWND> all{ g_bar };+ all.insert(all.end(), g_extras.begin(), g_extras.end());+ auto alheias = shell::AlheiasNoTopo(); // as "sempre por cima" de outros apps (issue #33) voltam por cima no fim+ struct Fim { std::vector<HWND>& a; ~Fim() { shell::DevolveAlheias(a); } } fim{ alheias };+ for (HWND b : all) {+ bool hide = (on && (!mon || MonitorFromWindow(b, MONITOR_DEFAULTTONEAREST) == mon)) || (Ocultar() && !g_revelada); // só a barra do monitor em tela cheia+ if (hide == !IsWindowVisible(b)) continue;+ ShowWindow(b, hide ? SW_HIDE : SW_SHOWNOACTIVATE);+ if (!hide) SetWindowPos(b, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);+ }+}+bool shell::Hora12() {+ std::wstring f = shell::Setting(L"relogio_formato", L"auto");+ if (f == L"12") return true;+ if (f == L"24") return false;+ // automático: o formato de hora do Windows ("h:mm tt" = 12 horas; "HH:mm" = 24)+ static std::wstring lido; static bool doze = false; static ULONGLONG quando = 0;+ if (!quando || GetTickCount64() - quando > 60000) {+ wchar_t b[80] = {};+ GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_STIMEFORMAT, b, 80);+ lido = b; quando = GetTickCount64();+ doze = lido.find(L'h') != std::wstring::npos;+ }+ return doze;+}+std::wstring shell::Hora(const SYSTEMTIME& st, bool segundos, bool ampm) {+ wchar_t b[48];+ if (!shell::Hora12()) {+ if (segundos) swprintf_s(b, L"%02d:%02d:%02d", st.wHour, st.wMinute, st.wSecond);+ else swprintf_s(b, L"%02d:%02d", st.wHour, st.wMinute);+ return b;+ }+ int h = st.wHour % 12; if (!h) h = 12;+ wchar_t sufixo[16] = {}; // AM/PM do idioma do Windows (ou AM/PM)+ if (!GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, st.wHour < 12 ? LOCALE_S1159 : LOCALE_S2359, sufixo, 16) || !sufixo[0])+ wcscpy_s(sufixo, st.wHour < 12 ? L"AM" : L"PM");+ if (segundos) swprintf_s(b, L"%d:%02d:%02d", h, st.wMinute, st.wSecond);+ else swprintf_s(b, L"%d:%02d", h, st.wMinute);+ std::wstring r = b;+ if (ampm) r += std::wstring(L" ") + sufixo;+ return r;+}++int menubar::Height() { return g_bar ? (int)std::lround(BAR_PT * ui::Scale(g_bar)) : (int)std::lround(BAR_PT * GetDpiForSystem() / 96.f); }+int menubar::HeightOn(HMONITOR mon) {+ UINT dx = 96, dy = 96;+ if (FAILED(GetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &dx, &dy))) dx = GetDpiForSystem();+ return (int)std::lround(BAR_PT * dx / 96.f);+}++static bool AllMonitors() { return shell::Setting(L"barra_todos_monitores", L"1") != L"0"; }+// O que a barra ocupa no topo do monitor (área de trabalho, Dock lateral): 0 nos secundários sem barra+int menubar::ReservedOn(HMONITOR mon) {+ MONITORINFO mi{ sizeof(mi) };+ bool prim = GetMonitorInfoW(mon, &mi) && (mi.dwFlags & MONITORINFOF_PRIMARY);+ if (menubar::Embaixo()) return 0; // o topo de todos os monitores volta para as janelas+ if (Ocultar()) return 0; // ocultar automaticamente: o topo é das janelas, a barra aparece por cima+ if (prim) return Height();+ return AllMonitors() ? HeightOn(mon) : 0;+}+bool menubar::Embaixo() {+ if (shell::Setting(L"barra_embaixo", L"0") != L"1" || liquid::Leopard()) return false;+ if (!dock::Hwnd() || dock::Posicao() != 0) return false;+ HMONITOR prim = MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY);+ if (dock::MonitorHandle() != prim) return false;+ // Dock largo demais (muitos apps ou janelas minimizadas, tela de notebook): sem lugar dos lados para a maçã, o+ // nome do app e o relógio, a barra ficava por trás do Dock (issue #29, foto de um ThinkPad). Aí ela volta para+ // cima até o Dock encolher. Folga de 30 pt entre entrar e sair, para não ficar pulando.+ static bool cabia = true;+ RECT v; MONITORINFO mi{ sizeof(mi) };+ POINT pt; GetCursorPos(&pt);+ if (dock::Vidro(&v) && !PtInRect(&v, pt) && GetMonitorInfoW(prim, &mi)) { // ampliado pelo ponteiro: não conta+ float sc = GetDpiForWindow(dock::Hwnd()) / 96.f;+ float esq = (v.left - mi.rcMonitor.left) / sc, dir = (mi.rcMonitor.right - v.right) / sc;+ float precisa = cabia ? 150.f : 180.f; // maçã + nome do app à esquerda; relógio e Central à direita+ cabia = esq >= precisa && dir >= precisa;+ }+ return cabia;+}+int menubar::ReservedBottom(HMONITOR mon) {+ if (!menubar::Embaixo() || mon != MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY)) return 0;+ return std::max(dock::ReservedHeight(), HeightOn(mon)); // com o Dock oculto sobra a altura da barra+}+int menubar::TopInset() { return menubar::Embaixo() ? 0 : Height(); }++// Uma barra em cada monitor (como no Mac): a principal no monitor principal e uma igual em cada um dos outros.+void menubar::Displays() {+ if (!g_bar) return;+ struct Mon { HMONITOR hm; RECT r; };+ std::vector<Mon> others;+ Mon prim{};+ std::pair<std::vector<Mon>*, Mon*> ctx{ &others, &prim };+ EnumDisplayMonitors(nullptr, nullptr, [](HMONITOR hm, HDC, LPRECT, LPARAM p) -> BOOL {+ MONITORINFO mi{ sizeof(mi) };+ if (!GetMonitorInfoW(hm, &mi)) return TRUE;+ auto* v = (std::pair<std::vector<Mon>*, Mon*>*)p;+ if (mi.dwFlags & MONITORINFOF_PRIMARY) *v->second = { hm, mi.rcMonitor };+ else v->first->push_back({ hm, mi.rcMonitor });+ return TRUE;+ }, (LPARAM)&ctx);+ if (!prim.hm) { prim.hm = MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY); MONITORINFO mi{ sizeof(mi) }; GetMonitorInfoW(prim.hm, &mi); prim.r = mi.rcMonitor; }+ // "Mostrar a barra de menus em todos os monitores" desligado (barra_todos_monitores=0): só a do principal+ const bool baixo = menubar::Embaixo();+ if (!AllMonitors() || baixo) others.clear();+ Assenta();+ if (!baixo) { auto alheias = shell::AlheiasNoTopo(); SetWindowPos(g_bar, HWND_TOPMOST, prim.r.left, prim.r.top, prim.r.right - prim.r.left, HeightOn(prim.hm), SWP_NOACTIVATE); shell::DevolveAlheias(alheias); }+ // sobrando (monitor desligado): fecha+ while (g_extras.size() > others.size()) {+ HWND b = g_extras.back();+ g_extras.pop_back();+ apps::ours.erase(std::remove(apps::ours.begin(), apps::ours.end(), b), apps::ours.end());+ if (g_cur == b) g_cur = nullptr;+ if (g_openBar == b) g_openBar = nullptr;+ DestroyWindow(b);+ g_state.erase(b);+ }+ // faltando (monitor novo): cria+ while (g_extras.size() < others.size()) {+ HWND b = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, L"ShellBarraDeMenus", L"Barra de menus", WS_POPUP,+ 0, 0, 100, 20, nullptr, nullptr, (HINSTANCE)GetWindowLongPtrW(g_bar, GWLP_HINSTANCE), nullptr);+ if (!b) break;+ g_extras.push_back(b);+ apps::ours.push_back(b);+ g_state[b].s.hwnd = b;+ DWORD corner = 1;+ DwmSetWindowAttribute(b, 33, &corner, sizeof(corner));+ BarGlass(b);+ }+ for (size_t i = 0; i < g_extras.size(); i++) {+ const RECT& r = others[i].r;+ bool hide = Escondida(g_extras[i], others[i].hm);+ SetWindowPos(g_extras[i], HWND_TOPMOST, r.left, r.top, r.right - r.left, HeightOn(others[i].hm),+ SWP_NOACTIVATE | (hide ? SWP_HIDEWINDOW : SWP_SHOWWINDOW));+ }+ if (Ocultar()) { g_revelada = false; if (IsWindowVisible(g_bar)) ShowWindow(g_bar, SW_HIDE); for (HWND b : g_extras) ShowWindow(b, SW_HIDE); SetTimer(g_bar, 2, 50, nullptr); }+ else {+ KillTimer(g_bar, 2);+ g_revelada = false;+ if (!IsWindowVisible(g_bar) && !Escondida(g_bar, prim.hm)) ShowWindow(g_bar, SW_SHOWNOACTIVATE);+ }+ static size_t lastN = (size_t)-1;+ if (lastN != g_extras.size()) { lastN = g_extras.size(); Log(L"barra de menus: %zu monitor(es) a mais", lastN); }+ RenderAll();+ shell::ApplyWorkArea();+}++bool menubar::Create(HINSTANCE hi) {+ WNDCLASSW wc{}; wc.lpfnWndProc = BarProc; wc.hInstance = hi; wc.lpszClassName = L"ShellBarraDeMenus";+ wc.hCursor = LoadCursorW(nullptr, IDC_ARROW);+ RegisterClassW(&wc);+ WNDCLASSW oc{}; oc.lpfnWndProc = DefWindowProcW; oc.hInstance = hi; oc.lpszClassName = L"ShellDonoDosMenus";+ RegisterClassW(&oc);+ g_owner = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, oc.lpszClassName, L"", WS_POPUP | WS_VISIBLE, -32000, -32000, 1, 1, nullptr, nullptr, hi, nullptr);+ SetLayeredWindowAttributes(g_owner, 0, 0, LWA_ALPHA);+ g_bar = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, wc.lpszClassName, L"Barra de menus", WS_POPUP,+ 0, 0, GetSystemMetrics(SM_CXSCREEN), menubar::Height(), nullptr, nullptr, hi, nullptr);+ if (!g_bar) return false;+ apps::ours.push_back(g_bar);+ apps::ours.push_back(g_owner);+ g_s.hwnd = g_bar;+ DWORD corner = 1; // sem cantos arredondados+ DwmSetWindowAttribute(g_bar, 33, &corner, sizeof(corner));+ BarGlass(g_bar);+ g_tf = ui::Format(13.5f, DWRITE_FONT_WEIGHT_MEDIUM); // o Mac desenha a barra com vibrância: as letras parecem mais cheias+ g_tfBold = ui::Format(13.5f, DWRITE_FONT_WEIGHT_BOLD);+ g_tfBadge = ui::Format(10, DWRITE_FONT_WEIGHT_NORMAL, false, DWRITE_TEXT_ALIGNMENT_CENTER); // sem negrito (issue #8)+ if (g_tfBadge) g_tfBadge->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);+ g_tfIcon = ui::Format(14, DWRITE_FONT_WEIGHT_NORMAL, true, DWRITE_TEXT_ALIGNMENT_CENTER);+ RefreshStatus();+ ShowWindow(g_bar, SW_SHOWNOACTIVATE);+ SetTimer(g_bar, 1, 1000, nullptr);+ Update();+ Displays(); // uma barra igual em cada um dos outros monitores+ return true;+}++void menubar::Update() {+ HWND fg = GetForegroundWindow();+ if (fg && !apps::IsShellWindow(fg)) {+ HWND root = GetAncestor(fg, GA_ROOTOWNER);+ if (root) fg = root;+ wchar_t cls[64] = {}; GetClassNameW(fg, cls, 64);+ bool desktop = mesa::IsDeskClass(cls) || !wcscmp(cls, L"Shell_TrayWnd");+ if (desktop) { g_finderActive = true; g_fg = nullptr; }+ else if (fg != g_fg) {+ g_fg = fg;+ App* a = apps::OfWindow(fg);+ g_finderActive = a && a->finder;+ }+ }+ App* a = ActiveApp();+ g_appName = a ? a->name : L"Finder";+ if (wchar_t cls[32] = {}; g_fg && GetClassNameW(g_fg, cls, 32) && !wcscmp(cls, L"AjustesJanela")) g_appName = TrPick(L"Ajustes do Sistema", L"System Settings");+ g_hmenu = (g_fg && !g_finderActive) ? GetMenu(g_fg) : nullptr;+ if (!g_hmenu && g_fg && !g_finderActive) g_hmenu = (HMENU)GetPropW(g_fg, L"MacJanelaMenu"); // tirada da janela pela MacJanela.dll+ g_titles.clear();+ if (g_hmenu && IsMenu(g_hmenu)) {+ int n = GetMenuItemCount(g_hmenu);+ for (int k = 0; k < n; k++) {+ wchar_t buf[128] = {};+ GetMenuStringW(g_hmenu, k, buf, 127, MF_BYPOSITION);+ if (buf[0]) g_titles.push_back(Clean(buf));+ else g_titles.push_back(L"?");+ }+ } else {+ g_hmenu = nullptr;+ g_titles = GenericTitles(a);+ }+ if (g_open < 0) RenderIfChanged();+}diff --cc src/shell/shell.hindex e34d268,4aad0ee..28ae935--- a/src/shell/shell.h+++ b/src/shell/shell.h@@@ -1,741 -1,683 +1,744 @@@-// Shell no estilo do macOS Sequoia: barra de menus (topo), Dock (embaixo) e bandeja.-// Ver docs/dock-e-barra-de-menus.md e docs/estudo-bandeja.md.-#pragma once-#include "../comum/nomes.h"-#include "../comum/abrircom.h" // áudio abre no Música (Finder, mesa, Spotlight, pilha)-#define NOMINMAX-#include <windows.h>-#include <d2d1_1.h>-#include <dwrite.h>-#include <string>-#include <vector>-#include <functional>-#include "../comum/idioma.h"-#include <cstdio>--struct IDXGISwapChain1;-struct IDCompositionTarget;-struct IDCompositionVisual;-struct IDCompositionDevice;-struct IDCompositionSurface;-struct IDCompositionAnimation;-struct ID3D11Device;--void Log(const wchar_t* fmt, ...);--// ---- ui.cpp: Direct2D em DIB de 32 bits (alfa preservado), acrílico, fontes, desenhos comuns.-// ---- anim.cpp: tempo de alta precisão e as curvas do macOS (para todas as animações do Shell)-namespace anim {-double Now(); // ms, QueryPerformanceCounter-double Tick(); // ms na base do GetTickCount, com fração (sem degraus)-float Bezier(float t, float x1, float y1, float x2, float y2);-float Ease(float t); // curva padrão do Core Animation (0.25, 0.1, 0.25, 1)-float EaseInOut(float t); // (0.42, 0, 0.58, 1)-float EaseOut(float t); // (0, 0, 0.58, 1)-float Spring(float tSec, float response = 0.55f, float damping = 0.825f); // mola do SwiftUI, de 0 a 1-float SpringDuration(float response, float damping);-// A mola dos painéis do Shell (Spotlight, Central de Controle, menus de status, alertas...), a mesma em-// todos: abrindo, aparece na curva do Mac em 180 ms e cresce de 96% a 100% numa mola ágil (passa um-// tiquinho e assenta, ~0,5 s); fechando, o caminho de volta em 150 ms, acelerando.-struct Panel { float fade = 1, scale = 1; bool done = true; };-Panel PanelIn(double msSinceOpen);-Panel PanelOut(double msSinceClose);-Panel CCIn(double msSinceOpen); // Central de Controle do Tahoe (medida no macOS 26)-// Ajustes > Acessibilidade > Reduzir movimento (reduzir_movimento=1), lido em LoadSettings: o que move ou escala-// vira corte seco ou fade curto (guia macOS26-Theme-Reference, seção 62); fades de saída continuam-extern bool reduceMotion;-Panel CCOut(double msSinceClose);-const double PANEL_OUT_MS = 150;-}--namespace ui {-extern ID2D1Factory* d2d;-extern IDWriteFactory* dw;-extern std::wstring family; // SF Pro Text / Inter / Segoe UI-extern std::wstring iconFamily; // Segoe Fluent Icons / MDL2-bool Init();-bool Dark(); // tema escuro (ajuste "tema" ou o do Windows)-float Scale(HWND h); // DPI / 96--// Superfície: desenhe em DIPs entre Begin e End.-struct Surface {- HWND hwnd = nullptr;- HDC mem = nullptr;- HBITMAP dib = nullptr;- void* bits = nullptr;- int w = 0, h = 0;- ID2D1DCRenderTarget* rt = nullptr;- float scale = 1;-};-ID2D1RenderTarget* Begin(Surface& s, int w, int h, float scale);-// layered = UpdateLayeredWindow (alfa por pixel, partes vazias deixam o clique passar);-// senão BitBlt sobre o acrílico da janela.-void End(Surface& s, bool layered, POINT screenPos = { 0, 0 });-void Free(Surface& s);--// Superfície na GPU (Direct2D + DirectComposition, alfa pré-multiplicado): para o que anima.-// A janela precisa de WS_EX_NOREDIRECTIONBITMAP. Bitmaps criados com o contexto de Gpu() valem-// para todas as superfícies (o dispositivo é um só).-struct GpuSurface {- HWND hwnd = nullptr;- IDXGISwapChain1* swap = nullptr;- IDCompositionTarget* target = nullptr;- IDCompositionVisual* visual = nullptr;- ID2D1Bitmap1* back = nullptr;- int w = 0, h = 0;-};-ID2D1DeviceContext* Gpu(); // contexto compartilhado (criado na primeira vez)-ID2D1DeviceContext* GpuBegin(GpuSurface& s, int w, int h, float scale); // já limpo e com BeginDraw-void GpuEnd(GpuSurface& s); // EndDraw + Present (sem esperar a tela)-void GpuFree(GpuSurface& s);-// Desloca o conteúdo dentro da janela (px): a janela pode encolher/crescer sem recriar a imagem.-void GpuOffset(GpuSurface& s, float x, float y);-void GpuScale(GpuSurface& s, float scale, float cx, float cy); // escala o desenho em volta de (cx, cy) px (animação dos painéis)-void GpuMotion(GpuSurface& s, float scale, float cx, float cy, float opacity); // escala e opacidade (a mola dos painéis)-// Desliza o conteúdo (px) de (fromX, fromY) até (toX, toY) em `ms`, com ease-out, pelo próprio compositor.-void GpuSlide(GpuSurface& s, float fromX, float fromY, float toX, float toY, float ms);-// Quadros no ritmo do monitor: enquanto `on`, manda `msg` para `hwnd` a cada atualização da tela.-void FrameClock(HWND hwnd, UINT msg, bool on);-void FrameAck(HWND hwnd, UINT msg); // no começo do tratamento do quadro: o próximo só vem depois deste (sem fila)-// Compositor (DirectComposition) do dispositivo de Gpu(): para animações que o DWM faz sozinho.-IDCompositionDevice* Comp();-ID3D11Device* D3D(); // o dispositivo D3D11 de Gpu()-// Superfície do compositor desenhada uma vez com Direct2D (pixels, 96 dpi). nullptr se falhar.-IDCompositionSurface* CompSurface(int w, int h, const std::function<void(ID2D1DeviceContext*)>& draw);-// Curva suave pelos pontos (igualmente espaçados em `durSec`): Hermite com inclinações de Catmull-Rom.-IDCompositionAnimation* CompCurve(const std::vector<float>& v, float durSec);--void Acrylic(HWND h, DWORD tintABGR); // desfoque atrás da janela (SetWindowCompositionAttribute)-IDWriteTextFormat* Format(float size, DWRITE_FONT_WEIGHT w, bool icons = false,- DWRITE_TEXT_ALIGNMENT a = DWRITE_TEXT_ALIGNMENT_LEADING);-IDWriteTextFormat* FormatFace(const wchar_t* face, float size, DWRITE_FONT_WEIGHT w); // família escolhida (Leopard: Lucida)-float TextWidth(IDWriteTextFormat* tf, const std::wstring& s);-ID2D1Bitmap* Bitmap(ID2D1RenderTarget* rt, UINT w, UINT h, const std::vector<BYTE>& bgra);-// Tahoe: Aparência > "Estilo de ícones e widgets" (estilo_icones): padrao | escuro | transparente | tingido.-// Devolve o estilo atual (só com o Liquid Glass; senão "padrao") e aplica nos pixels BGRA pré-multiplicados.-std::wstring IconStyle();-std::wstring IconStyleKey(); // estilo + cor de destaque (para os caches: trocar a cor refaz os ícones Tingidos)-D2D1_COLOR_F Accent(); // Ajustes > Aparência > Cor de destaque (destaque=), "multicor" = azul-void StyleIcon(UINT w, UINT h, std::vector<BYTE>& bgra, const std::wstring& style);--// Pixels BGRA pré-multiplicados de um item do shell (exe, atalho, pasta, shell:AppsFolder\...).-bool ShellImage(const std::wstring& parsingName, int px, UINT& w, UINT& h, std::vector<BYTE>& bgra, bool iconOnly);-// arquivo como no Finder do Mac: miniatura de verdade (foto, vídeo, PDF); sem ela, a folha do Mac com o tipo-// (comum\docicone.h). Pastas e programas: o ícone do Windows (o ícone do próprio app)-bool FileImage(const std::wstring& path, int px, UINT& w, UINT& h, std::vector<BYTE>& bgra);-void TrimToSquare(UINT& w, UINT& h, std::vector<BYTE>& bgra);-void Downscale(UINT& w, UINT& h, std::vector<BYTE>& bgra, UINT maxSide); // reduz (média por área) se passar de maxSide-bool LoadPng(const std::wstring& path, UINT& w, UINT& h, std::vector<BYTE>& bgra); // BGRA pré-multiplicado-// foto inteira (JPG, PNG, WebP, HEIC...) pelo WIC, girada pelo EXIF e reduzida até maxSide (o Quick Look)-bool LoadPhoto(const std::wstring& path, UINT maxSide, UINT& w, UINT& h, std::vector<BYTE>& bgra);-std::wstring PackIcon(const std::wstring& name); // "icones\sequoia\<nome>.png" se existir, senão ""--void DrawFolder(ID2D1RenderTarget* rt, D2D1_RECT_F box, wchar_t glyph); // pasta azul do Arquivos-void DrawTrash(ID2D1RenderTarget* rt, D2D1_RECT_F box, bool full); // lixeira de tela-}--// ---- apps.cpp: apps do Dock (fixos + abertos), janelas, ícones, abrir/ativar/encerrar.-struct AppWin { HWND hwnd; std::wstring title; bool minimized; };-struct App {- std::wstring id; // "aumid:..." ou caminho do .exe em minúsculas- std::wstring launch; // .lnk, .exe ou shell:AppsFolder\AUMID- std::wstring name;- std::wstring exe; // .exe de destino em minúsculas (casa janelas sem AUMID com o atalho fixo)- bool pinned = false;- bool finder = false; // o Arquivos (sempre o primeiro)- bool recent = false; // fechado há pouco (seção de recentes)- std::vector<AppWin> wins;- UINT iw = 0, ih = 0;- std::vector<BYTE> icon; // BGRA pré-multiplicado- bool mac = false; // ícone do pacote do Sequoia (já tem a margem do Mac: desenha no tamanho cheio)- DWORD launchedAt = 0; // pulando enquanto abre- DWORD attentionAt = 0; // pediu atenção (janela piscando)- DWORD lastActive = 0;-};-namespace apps {-extern std::vector<App> list; // ordem do Dock: Arquivos, fixos, abertos/recentes-extern std::vector<std::wstring> recent; // ids dos últimos apps fechados (até 3)-void Load(const std::wstring& finderExe);-void Save();-void Relabel(); // nomes dos nossos apps no idioma escolhido (Ajustes > Geral > Idioma)-bool Refresh(); // relê as janelas; true se algo mudou-std::wstring IdOfWindow(HWND h);-App* FindById(const std::wstring& id);-App* OfWindow(HWND h);-void EnsureIcon(App& a, int px);-void Launch(App& a, const std::wstring& args = L"");-// Apps Chromium/Electron: abre com a opção que mantém a miniatura viva no Mission Control.-// false se o alvo não for um deles (quem chamou abre do jeito normal).-bool LaunchNoOcclusion(const std::wstring& target, const std::wstring& args = L"", const std::wstring& exeHint = L"");-// App empacotado ("shell:AppsFolder\<AUMID com !>": Segurança do Windows, ChatGPT, apps da Loja) pelo ativador-// do Windows. Sem o Explorador, abrir pelo item do shell dá "Classe não registrada". false = não é empacotado-// ou não abriu (quem chamou tenta o jeito comum).-bool ActivatePackaged(const std::wstring& target, const std::wstring& args = L"");-void Activate(App& a); // traz todas as janelas para frente-void Hide(App& a); // Ocultar do Mac: as janelas somem (sem gênio, sem ir para o Dock); clicar no ícone traz de volta-bool IsHidden(HWND h); // janela oculta pelo Ocultar (minimizada por baixo, mas não aparece no Dock)-void Quit(App& a);-void SetPinned(App& a, bool pin);-// programa ou atalho (.lnk, .exe, .url, .appref-ms) solto no Dock: fica fixo antes do app de índice `at` (-1 = no fim-// dos fixos). Já no Dock: só fixa. false = não é programa-bool PinPath(const std::wstring& path, int at);-bool IsProgramFile(const std::wstring& path);-void Move(int from, int to);-void ForgetRecent(const std::wstring& id); // tira um app da seção de recentes-bool OpenAtLogin(const App& a);-void SetOpenAtLogin(const App& a, bool on);-void ShowInFinder(const App& a);-bool IsAppWindow(HWND h); // janela que apareceria na barra de tarefas (regras do Alt+Tab)-bool IsShellWindow(HWND h); // nossas janelas (não entram no Dock nem na barra)-bool LoneOwned(HWND h); // janela com dona escondida (aviso sozinho de um app): conta como janela do app-std::wstring PackIconByName(const std::wstring& name, const std::wstring& exe = L""); // ícone do pacote do Sequoia-// Ícone próprio do app (Dock/Launchpad > Alterar Ícone…), em %APPDATA%\Shell\icones-dock: <exe>.png e <nome>.png-std::wstring CustomIconDir(); // com a barra no fim-std::wstring CustomIcon(const std::wstring& name, const std::wstring& exe); // o PNG escolhido, ou ""-bool HasCustomIcon(const std::wstring& name, const std::wstring& exe);-void ChooseIcon(const std::wstring& name, const std::wstring& exe); // janela de Abrir (outra thread); avisa "ShellIconeMudou"-void RestoreIcon(const std::wstring& name, const std::wstring& exe); // apaga o ícone próprio; avisa "ShellIconeMudou"-void ReloadIcons(); // Dock, Alt+Tab e Launchpad relêem os ícones (thread da interface)-extern std::vector<HWND> ours;-}--// ---- tray.cpp: Shell_TrayWnd próprio (ícones de status dos apps).-struct TrayIcon {- HWND hwnd = nullptr;- UINT uid = 0;- GUID guid{};- UINT callback = 0;- UINT version = 0;- HICON icon = nullptr;- std::wstring tip;- bool hidden = false;-};-namespace tray {-extern std::vector<TrayIcon> icons;-// modo nativo: os ícones chegam pela barra do Windows (MacBarra.dll, ITrayUI::HandleCopyData, na thread da-// barra); true = era da bandeja (res = resposta ao app)-bool DoExplorer(COPYDATASTRUCT* cd, LRESULT* res);-void Start(std::function<void()> changed);-void Stop();-void SemAvisoAoSair(); // reinício: o Shell novo avisa ao abrir; avisar também ao sair confundia o Lively-void Click(int index, UINT button, POINT screenPt); // WM_LBUTTONUP / WM_RBUTTONUP-void Keepalive(); // mantém o nosso Shell_TrayWnd na frente-// O ícone "<app> está usando o microfone/a câmera" do próprio Windows (guid 7820AE82-...): não vai para a barra de-// menus (lá fica a bolinha laranja/verde, como no Mac) e é o sinal de uso; 1 microfone, 2 câmera (pelo texto)-bool IsPrivacy(const TrayIcon& t);-int PrivacyBits();-}--// ---- menubar.cpp / dock.cpp-namespace menubar {-bool Create(HINSTANCE hi);-void Update(); // app ativo mudou, relógio, ícones-HWND Hwnd();-int Height(); // px-void SetFullscreen(bool on, HMONITOR mon = nullptr); // app em tela cheia na frente: some (só no monitor dele; nullptr = todos)-int HeightOn(HMONITOR mon); // px da barra naquele monitor (cada monitor tem a sua barra)-int ReservedOn(HMONITOR mon); // px que a barra ocupa no topo daquele monitor (0: secundário sem barra, barra_todos_monitores=0)-void Displays(); // monitores mudaram: uma barra em cada-void ApplyTheme(); // claro/escuro mudou-void SoundChanged(bool device); // volume/mudo (ou, com device, a saída padrão) mudou, ou o menu Som abriu/fechou: redesenha-bool SoundIcon(RECT* screen); // onde está o ícone de som (tela); false se não está na barra-}-namespace som { // menu "Som" do ícone da barra e o aviso de volume das teclas (som.cpp)-bool Create(HINSTANCE hi);-void Toggle(RECT iconScreen);-bool IsOpen();-bool HudLit(); // aviso do Tahoe na tela: o ícone da barra fica destacado-void Key(UINT vk, bool fine); // VK_VOLUME_UP/DOWN/MUTE (fine: Shift+Alt, quartos de passo)-}-namespace menus { // menus do Windows (#32768) de todos os programas no visual do Mac (menus.cpp)-void Start();-void Stop();+// Shell no estilo do macOS Sequoia: barra de menus (topo), Dock (embaixo) e bandeja.+// Ver docs/dock-e-barra-de-menus.md e docs/estudo-bandeja.md.+#pragma once+#include "../comum/nomes.h"+#include "../comum/abrircom.h" // áudio abre no Música (Finder, mesa, Spotlight, pilha)+#define NOMINMAX+#include <windows.h>+#include <d2d1_1.h>+#include <dwrite.h>+#include <string>+#include <vector>+#include <functional>+#include <atomic>+#include "../comum/idioma.h"+#include <cstdio>++struct IDXGISwapChain1;+struct IDCompositionTarget;+struct IDCompositionVisual;+struct IDCompositionDevice;+struct IDCompositionSurface;+struct IDCompositionAnimation;+struct ID3D11Device;++void Log(const wchar_t* fmt, ...);++// ---- ui.cpp: Direct2D em DIB de 32 bits (alfa preservado), acrílico, fontes, desenhos comuns.+// ---- anim.cpp: tempo de alta precisão e as curvas do macOS (para todas as animações do Shell)+namespace anim {+double Now(); // ms, QueryPerformanceCounter+double Tick(); // ms na base do GetTickCount, com fração (sem degraus)+float Bezier(float t, float x1, float y1, float x2, float y2);+float Ease(float t); // curva padrão do Core Animation (0.25, 0.1, 0.25, 1)+float EaseInOut(float t); // (0.42, 0, 0.58, 1)+float EaseOut(float t); // (0, 0, 0.58, 1)+float Spring(float tSec, float response = 0.55f, float damping = 0.825f); // mola do SwiftUI, de 0 a 1+float SpringDuration(float response, float damping);+// A mola dos painéis do Shell (Spotlight, Central de Controle, menus de status, alertas...), a mesma em+// todos: abrindo, aparece na curva do Mac em 180 ms e cresce de 96% a 100% numa mola ágil (passa um+// tiquinho e assenta, ~0,5 s); fechando, o caminho de volta em 150 ms, acelerando.+struct Panel { float fade = 1, scale = 1; bool done = true; };+Panel PanelIn(double msSinceOpen);+Panel PanelOut(double msSinceClose);+Panel CCIn(double msSinceOpen); // Central de Controle do Tahoe (medida no macOS 26)+// Ajustes > Acessibilidade > Reduzir movimento (reduzir_movimento=1), lido em LoadSettings: o que move ou escala+// vira corte seco ou fade curto (guia macOS26-Theme-Reference, seção 62); fades de saída continuam+extern bool reduceMotion;+Panel CCOut(double msSinceClose);+const double PANEL_OUT_MS = 150;+}++namespace ui {+extern ID2D1Factory* d2d;+extern IDWriteFactory* dw;+extern std::wstring family; // SF Pro Text / Inter / Segoe UI+extern std::wstring iconFamily; // Segoe Fluent Icons / MDL2+bool Init();+bool Dark(); // tema escuro (ajuste "tema" ou o do Windows)+float Scale(HWND h); // DPI / 96++// Superfície: desenhe em DIPs entre Begin e End.+struct Surface {+ HWND hwnd = nullptr;+ HDC mem = nullptr;+ HBITMAP dib = nullptr;+ void* bits = nullptr;+ int w = 0, h = 0;+ ID2D1DCRenderTarget* rt = nullptr;+ float scale = 1;+};+ID2D1RenderTarget* Begin(Surface& s, int w, int h, float scale);+// layered = UpdateLayeredWindow (alfa por pixel, partes vazias deixam o clique passar);+// senão BitBlt sobre o acrílico da janela.+void End(Surface& s, bool layered, POINT screenPos = { 0, 0 });+void Free(Surface& s);++// Superfície na GPU (Direct2D + DirectComposition, alfa pré-multiplicado): para o que anima.+// A janela precisa de WS_EX_NOREDIRECTIONBITMAP. Bitmaps criados com o contexto de Gpu() valem+// para todas as superfícies (o dispositivo é um só).+struct GpuSurface {+ HWND hwnd = nullptr;+ IDXGISwapChain1* swap = nullptr;+ IDCompositionTarget* target = nullptr;+ IDCompositionVisual* visual = nullptr;+ ID2D1Bitmap1* back = nullptr;+ int w = 0, h = 0;+};+ID2D1DeviceContext* Gpu(); // contexto compartilhado (criado na primeira vez)+ID2D1DeviceContext* GpuBegin(GpuSurface& s, int w, int h, float scale); // já limpo e com BeginDraw+void GpuEnd(GpuSurface& s); // EndDraw + Present (sem esperar a tela)+void GpuFree(GpuSurface& s);+void GpuSoltarEscondida(GpuSurface& s); // painel de tela cheia: solta os buffers depois de 2 min escondido (pinte antes de mostrar)+// Desloca o conteúdo dentro da janela (px): a janela pode encolher/crescer sem recriar a imagem.+void GpuOffset(GpuSurface& s, float x, float y);+void GpuScale(GpuSurface& s, float scale, float cx, float cy); // escala o desenho em volta de (cx, cy) px (animação dos painéis)+void GpuMotion(GpuSurface& s, float scale, float cx, float cy, float opacity); // escala e opacidade (a mola dos painéis)+// Desliza o conteúdo (px) de (fromX, fromY) até (toX, toY) em `ms`, com ease-out, pelo próprio compositor.+void GpuSlide(GpuSurface& s, float fromX, float fromY, float toX, float toY, float ms);+// Quadros no ritmo do monitor: enquanto `on`, manda `msg` para `hwnd` a cada atualização da tela.+void FrameClock(HWND hwnd, UINT msg, bool on);+void FrameAck(HWND hwnd, UINT msg); // no começo do tratamento do quadro: o próximo só vem depois deste (sem fila)+// Compositor (DirectComposition) do dispositivo de Gpu(): para animações que o DWM faz sozinho.+IDCompositionDevice* Comp();+ID3D11Device* D3D(); // o dispositivo D3D11 de Gpu()+// Superfície do compositor desenhada uma vez com Direct2D (pixels, 96 dpi). nullptr se falhar.+IDCompositionSurface* CompSurface(int w, int h, const std::function<void(ID2D1DeviceContext*)>& draw);+// Curva suave pelos pontos (igualmente espaçados em `durSec`): Hermite com inclinações de Catmull-Rom.+IDCompositionAnimation* CompCurve(const std::vector<float>& v, float durSec);++void Acrylic(HWND h, DWORD tintABGR); // desfoque atrás da janela (SetWindowCompositionAttribute)+IDWriteTextFormat* Format(float size, DWRITE_FONT_WEIGHT w, bool icons = false,+ DWRITE_TEXT_ALIGNMENT a = DWRITE_TEXT_ALIGNMENT_LEADING);+IDWriteTextFormat* FormatFace(const wchar_t* face, float size, DWRITE_FONT_WEIGHT w); // família escolhida (Leopard: Lucida)+float TextWidth(IDWriteTextFormat* tf, const std::wstring& s);+ID2D1Bitmap* Bitmap(ID2D1RenderTarget* rt, UINT w, UINT h, const std::vector<BYTE>& bgra);+// Tahoe: Aparência > "Estilo de ícones e widgets" (estilo_icones): padrao | escuro | transparente | tingido.+// Devolve o estilo atual (só com o Liquid Glass; senão "padrao") e aplica nos pixels BGRA pré-multiplicados.+std::wstring IconStyle();+std::wstring IconStyleKey(); // estilo + cor de destaque (para os caches: trocar a cor refaz os ícones Tingidos)+D2D1_COLOR_F Accent(); // Ajustes > Aparência > Cor de destaque (destaque=), "multicor" = azul+void StyleIcon(UINT w, UINT h, std::vector<BYTE>& bgra, const std::wstring& style);++// Pixels BGRA pré-multiplicados de um item do shell (exe, atalho, pasta, shell:AppsFolder\...).+bool ShellImage(const std::wstring& parsingName, int px, UINT& w, UINT& h, std::vector<BYTE>& bgra, bool iconOnly);+// o mesmo pelos bytes do PIDL: itens cujo nome não volta a virar item (tarefas do Painel de Controle)+bool ShellImageId(const std::vector<BYTE>& idList, int px, UINT& w, UINT& h, std::vector<BYTE>& bgra);+// arquivo como no Finder do Mac: miniatura de verdade (foto, vídeo, PDF); sem ela, a folha do Mac com o tipo+// (comum\docicone.h). Pastas e programas: o ícone do Windows (o ícone do próprio app)+bool FileImage(const std::wstring& path, int px, UINT& w, UINT& h, std::vector<BYTE>& bgra);+void TrimToSquare(UINT& w, UINT& h, std::vector<BYTE>& bgra);+void Downscale(UINT& w, UINT& h, std::vector<BYTE>& bgra, UINT maxSide); // reduz (média por área) se passar de maxSide+bool LoadPng(const std::wstring& path, UINT& w, UINT& h, std::vector<BYTE>& bgra); // BGRA pré-multiplicado+// foto inteira (JPG, PNG, WebP, HEIC...) pelo WIC, girada pelo EXIF e reduzida até maxSide (o Quick Look)+bool LoadPhoto(const std::wstring& path, UINT maxSide, UINT& w, UINT& h, std::vector<BYTE>& bgra);+std::wstring PackIcon(const std::wstring& name); // "icones\sequoia\<nome>.png" se existir, senão ""++void DrawFolder(ID2D1RenderTarget* rt, D2D1_RECT_F box, wchar_t glyph); // pasta azul do Arquivos+void DrawTrash(ID2D1RenderTarget* rt, D2D1_RECT_F box, bool full); // lixeira de tela+}++// ---- apps.cpp: apps do Dock (fixos + abertos), janelas, ícones, abrir/ativar/encerrar.+struct AppWin { HWND hwnd; std::wstring title; bool minimized; };+struct App {+ std::wstring id; // "aumid:..." ou caminho do .exe em minúsculas+ std::wstring launch; // .lnk, .exe ou shell:AppsFolder\AUMID+ std::wstring name;+ std::wstring exe; // .exe de destino em minúsculas (casa janelas sem AUMID com o atalho fixo)+ bool pinned = false;+ bool finder = false; // o Arquivos (sempre o primeiro)+ bool recent = false; // fechado há pouco (seção de recentes)+ std::vector<AppWin> wins;+ UINT iw = 0, ih = 0;+ std::vector<BYTE> icon; // BGRA pré-multiplicado+ bool mac = false; // ícone do pacote do Sequoia (já tem a margem do Mac: desenha no tamanho cheio)+ DWORD launchedAt = 0; // pulando enquanto abre+ DWORD attentionAt = 0; // pediu atenção (janela piscando)+ DWORD lastActive = 0;+};+namespace apps {+extern std::vector<App> list; // ordem do Dock: Arquivos, fixos, abertos/recentes+extern std::vector<std::wstring> recent; // ids dos últimos apps fechados (até 3)+void Load(const std::wstring& finderExe);+void Save();+void Relabel(); // nomes dos nossos apps no idioma escolhido (Ajustes > Geral > Idioma)+bool Refresh(); // relê as janelas; true se algo mudou+std::wstring IdOfWindow(HWND h);+App* FindById(const std::wstring& id);+App* OfWindow(HWND h);+void EnsureIcon(App& a, int px);+void Launch(App& a, const std::wstring& args = L"");+// Apps Chromium/Electron: abre com a opção que mantém a miniatura viva no Mission Control.+// false se o alvo não for um deles (quem chamou abre do jeito normal).+bool LaunchNoOcclusion(const std::wstring& target, const std::wstring& args = L"", const std::wstring& exeHint = L"");+// App empacotado ("shell:AppsFolder\<AUMID com !>": Segurança do Windows, ChatGPT, apps da Loja) pelo ativador+// do Windows. Sem o Explorador, abrir pelo item do shell dá "Classe não registrada". false = não é empacotado+// ou não abriu (quem chamou tenta o jeito comum).+bool ActivatePackaged(const std::wstring& target, const std::wstring& args = L"");+void Activate(App& a); // traz todas as janelas para frente+void Hide(App& a); // Ocultar do Mac: as janelas somem (sem gênio, sem ir para o Dock); clicar no ícone traz de volta+bool IsHidden(HWND h);+bool OcultaComGenio(HWND h); // a janela da frente que o clique no ícone do Dock está ocultando (vai pelo gênio) // janela oculta pelo Ocultar (minimizada por baixo, mas não aparece no Dock)+void Quit(App& a);+void SetPinned(App& a, bool pin);+// programa ou atalho (.lnk, .exe, .url, .appref-ms) solto no Dock: fica fixo antes do app de índice `at` (-1 = no fim+// dos fixos). Já no Dock: só fixa. false = não é programa+bool PinPath(const std::wstring& path, int at);+bool IsProgramFile(const std::wstring& path);+void Move(int from, int to);+void ForgetRecent(const std::wstring& id); // tira um app da seção de recentes+bool OpenAtLogin(const App& a);+void SetOpenAtLogin(const App& a, bool on);+void ShowInFinder(const App& a);+bool IsAppWindow(HWND h); // janela que apareceria na barra de tarefas (regras do Alt+Tab)+bool IsShellWindow(HWND h); // nossas janelas (não entram no Dock nem na barra)+bool LoneOwned(HWND h); // janela com dona escondida (aviso sozinho de um app): conta como janela do app+std::wstring PackIconByName(const std::wstring& name, const std::wstring& exe = L""); // ícone do pacote do Sequoia+// Ícone próprio do app (Dock/Launchpad > Alterar Ícone…), em %APPDATA%\Shell\icones-dock: <exe>.png e <nome>.png+std::wstring CustomIconDir(); // com a barra no fim+std::wstring CustomIcon(const std::wstring& name, const std::wstring& exe); // o PNG escolhido, ou ""+bool HasCustomIcon(const std::wstring& name, const std::wstring& exe);+void ChooseIcon(const std::wstring& name, const std::wstring& exe); // janela de Abrir (outra thread); avisa "ShellIconeMudou"+void RestoreIcon(const std::wstring& name, const std::wstring& exe); // apaga o ícone próprio; avisa "ShellIconeMudou"+void ReloadIcons(); // Dock, Alt+Tab e Launchpad relêem os ícones (thread da interface)+extern std::vector<HWND> ours;+}++// ---- tray.cpp: Shell_TrayWnd próprio (ícones de status dos apps).+struct TrayIcon {+ HWND hwnd = nullptr;+ UINT uid = 0;+ GUID guid{};+ UINT callback = 0;+ UINT version = 0;+ HICON icon = nullptr;+ std::wstring tip;+ bool hidden = false;+};+namespace tray {+extern std::vector<TrayIcon> icons;+// modo nativo: os ícones chegam pela barra do Windows (MacBarra.dll, ITrayUI::HandleCopyData, na thread da+// barra); true = era da bandeja (res = resposta ao app)+bool DoExplorer(COPYDATASTRUCT* cd, LRESULT* res);+void Start(std::function<void()> changed);+void Stop();+void SemAvisoAoSair(); // reinício: o Shell novo avisa ao abrir; avisar também ao sair confundia o Lively+void Click(int index, UINT button, POINT screenPt); // WM_LBUTTONUP / WM_RBUTTONUP+void Keepalive(); // mantém o nosso Shell_TrayWnd na frente+// O ícone "<app> está usando o microfone/a câmera" do próprio Windows (guid 7820AE82-...): não vai para a barra de+// menus (lá fica a bolinha laranja/verde, como no Mac) e é o sinal de uso; 1 microfone, 2 câmera (pelo texto)+bool IsPrivacy(const TrayIcon& t);+int PrivacyBits();+}++// ---- menubar.cpp / dock.cpp+namespace menubar {+bool Create(HINSTANCE hi);+void Update(); // app ativo mudou, relógio, ícones+HWND Hwnd();+int Height(); // px+void SetFullscreen(bool on, HMONITOR mon = nullptr); // app em tela cheia na frente: some (só no monitor dele; nullptr = todos)+int HeightOn(HMONITOR mon); // px da barra naquele monitor (cada monitor tem a sua barra)+int ReservedOn(HMONITOR mon); // px que a barra ocupa no topo daquele monitor (0: secundário sem barra, barra_todos_monitores=0, ou barra embaixo)+bool Embaixo(); // barra_embaixo: a barra está na linha do Dock (Dock embaixo no monitor principal, fora do Leopard)+int ReservedBottom(HMONITOR mon); // px que a linha do Dock ocupa embaixo com a barra nela (0 = barra em cima)+int TopInset(); // px da barra no topo do monitor principal (0 com ela embaixo): de onde descem os painéis+void Displays(); // monitores mudaram: uma barra em cada+void ApplyTheme(); // claro/escuro mudou+void SoundChanged(bool device); // volume/mudo (ou, com device, a saída padrão) mudou, ou o menu Som abriu/fechou: redesenha+bool SoundIcon(RECT* screen); // onde está o ícone de som (tela); false se não está na barra+}+namespace som { // menu "Som" do ícone da barra e o aviso de volume das teclas (som.cpp)+bool Create(HINSTANCE hi);+void Toggle(RECT iconScreen);+bool IsOpen();+bool HudLit(); // aviso do Tahoe na tela: o ícone da barra fica destacado+void Key(UINT vk, bool fine); // VK_VOLUME_UP/DOWN/MUTE (fine: Shift+Alt, quartos de passo)+}+namespace menus { // menus do Windows (#32768) de todos os programas no visual do Mac (menus.cpp)+void Start();+void Stop();+ // "WacOSMenuVidro": um menu de contexto nosso pede o Liquid Glass atrás dele (true = a mensagem era essa; *res = resposta)+ bool VidroMsg(UINT m, WPARAM w, LPARAM l, LRESULT* res);-}-namespace dialogs { // janela de Abrir/Salvar trocada pelo Finder por fora (dialogs.cpp)-void Start();-void Stop();-std::wstring LastSaved(); // caminho escolhido no último Salvar (até 20 s atrás), para a confirmação de substituir-}-namespace janelas { // barra de título do Mac nas janelas dos outros programas (janelas.cpp + MacJanela.dll)-void Start();-void Stop(); // devolve o visual do Windows e tira os ganchos (reiniciando: só tira os ganchos)-void Foreground(HWND h);-void ManterAoReiniciar(); // o próximo Stop é um reinício: as janelas ficam com a barra (o Shell novo assume)-}-namespace barras { // barra de título do Mac por fora, sem nada dentro dos outros programas (modo nativo; barras.cpp)-void Start();-void Stop();-}-namespace sombras { // sombra do Mac nas janelas que a MacJanela.dll não trata (sombras.cpp)-void Start();-void Stop();-}-namespace central { // Central de Controle: painel embaixo do ícone da barra de menus (central.cpp)-bool Create(HINSTANCE hi);-void Toggle();-bool IsOpen();-}-namespace missioncontrol { // Win+Tab: todas as janelas e as Mesas (missioncontrol.cpp)-bool Create(HINSTANCE hi);-void Warm(); // prepara o fundo (papel de parede) antes da primeira abertura-void Toggle();-// Exposé do app (Ctrl+↓ no Mac; aqui Ctrl+Win+↓, "Mostrar Todas as Janelas" no Dock, Cantos Ativos): só as-// janelas do app `appId` (apps::App::id), espalhadas, sem a faixa de Mesas. De novo com o mesmo app: fecha.-void ToggleApp(const std::wstring& appId, const std::wstring& appName);-bool IsOpen();-}-namespace encaixe { // encaixe.cpp: arrastar a janela até a borda = metade/quarto/preencher, com a prévia do Mac-void Start();-void Stop(); // o encaixe do Windows volta como estava-void Half(HWND h, bool right); // Win+← / Win+→-}-namespace memoria { // memoria.cpp: pressão de memória, soneca de apps (App Nap) e memória descartável, como no Mac-void Start();-void Stop(); // acorda todos os apps em soneca (devolve o estado de antes)-int Level(); // 0 normal, 1 alta, 2 crítica-bool Napping(DWORD pid);-}-namespace limites { // limites.cpp: janelas voltam para dentro da área (não cruzam a barra de menus nem o Dock)-void Start();-void Stop();-}-namespace pastas { // pastas.cpp: janela de pasta do Explorador (Chrome "Mostrar na pasta", explorer /select) vira o Finder-void Start();-void Stop();-}-namespace indice { // índice de arquivos próprio (indice.cpp): pasta do usuário e outros discos, salvo em indice.db-struct Hit { std::wstring path, name; bool dir; int score; };-void Start();-bool Ready();-size_t Count();-// foldedQuery: minúsculas sem acento; para logo se cancelled() der true-void Search(const std::wstring& foldedQuery, size_t max, const std::function<bool()>& cancelled, std::vector<Hit>& out);-}-namespace atualizacao { // aviso de versão nova no GitHub (atualizacao.cpp)-void Start(HWND msgWnd); // thread: confere 90 s depois e a cada 6 h; avisa msgWnd-bool Handle(UINT m); // na MsgProc: mostra a notificação (uma vez por versão); true = era a mensagem-void Avisar(const std::wstring& title, const std::wstring& body); // notificação do WacOS (vira o banner do Mac)-}-namespace migrar { // troca de nome Sequoia → WacOS (migrar.cpp)-bool TrocarPeloNovo(); // rodando como SequoiaShell.exe com o WacOSShell.exe ao lado: abre o novo (true = sair)-void Registro(); // caminhos do nome velho no registro e a tarefa do login-}-namespace alertas { // confirmações de excluir do Explorer no alerta do Mac (alertas.cpp)-bool Create(HINSTANCE hi);-void Stop();-// alerta do Mac para uma pergunta do próprio Shell; onYes roda se a resposta for o botão azul-// icon: "" = Lixeira, "pack:<nome>" = icones\sequoia\<nome>.png, senão o caminho de um programa-void Confirm(const std::wstring& title, const std::wstring& info, const std::wstring& yes, std::function<void()> onYes, const std::wstring& icon = L"");-}-namespace progresso { // janela de progresso do Windows (copiar, mover, apagar...) trocada pela do Finder (progresso.cpp)-bool Create(HINSTANCE hi);-void Stop();-bool Owns(HWND h); // janela do Windows que tiramos da tela (não entra no Dock)-}-namespace spotlight { // Win+Espaço / lupa da barra de menus: busca de apps, ajustes e arquivos (spotlight.cpp)-bool Create(HINSTANCE hi);-void Toggle();-bool IsOpen();-void OpenMode(int mode); // Tahoe: abre direto num modo (1 Aplicativos = o "Apps" do Dock, 2 Arquivos, 3 Ações); de novo fecha-void Rescan(); // relê a lista de apps (um programa foi instalado ou removido)-}-namespace dashboard { // Dashboard do Leopard (dashboard.cpp): Win+F12 / ShellAbrirPainel 16-bool Create(HINSTANCE hi);-void Toggle();-bool IsOpen();-}-namespace espacos { // Spaces do Leopard (espacos.cpp): Win+F8 / ShellAbrirPainel 17-bool Create(HINSTANCE hi);-void Toggle();-bool IsOpen();-}-namespace tempo { // a "viagem no tempo" do Time Machine do Leopard (tempo.cpp): app Time Machine / ShellAbrirPainel 18-bool Create(HINSTANCE hi);-void Enter();-bool IsOpen();-}-namespace sobre { // "Sobre Este Mac" do menu da Apple (sobre.cpp)-bool Create(HINSTANCE hi);-void Show();-}-namespace genio { // efeito gênio ao minimizar e ao restaurar pelo Dock (genio.cpp)-void Create(HINSTANCE hi);-void Stop();-bool Busy(HWND h); // a janela está no meio do gênio (o Dock ainda não mostra)-int Phase(HWND h); // 0 parada, 1 minimizando (indo para o Dock), 2 restaurando (saindo dele)-bool Restore(HWND h, RECT fromSlot);-bool OnMinRect(HWND h, RECT* out); // HSHELL_GETMINRECT: começa o gênio antes da janela sumir-void Pause(DWORD ms); // Win+D: minimiza tudo de uma vez, sem o gênio (pesado em várias janelas)-}-namespace seletor { // Alt+Tab: o seletor de apps do Mac (seletor.cpp)-bool Create(HINSTANCE hi);-bool IsActive();-void Step(int dir); // Tab (+1) / Shift+Tab (-1) com o Alt seguro-void Key(UINT vk); // Q, H, Esc, setas enquanto aberto-void Release(); // soltou o Alt: troca para o escolhido-void IconsChanged(); // o pacote de ícones mudou (tema): solta os ícones guardados-}-namespace revelar { // clique no vazio da área de trabalho mostra a mesa, como no Mac (revelar.cpp)-void Start();-void Stop();-void Pausar(bool p); // modo jogo: sem o gancho global do mouse-void Foreground(HWND h);-bool Owns(HWND h); // janela minimizada por "mostrar a mesa" (não vai para o Dock)-}-namespace mesas { // áreas de trabalho virtuais pela interface interna do Explorer (mesas.cpp); false = use os atalhos-bool Switch(int index);-bool Create();-bool Remove(int index);-bool MoveWindow(HWND h, int index); // leva a janela (de qualquer programa) para outra mesa-}-namespace widgets { // widgets da mesa: Relógio Mundial, Tempo, Relógio, Calendário, Nascer do Sol (widgets.cpp)-void Create(HINSTANCE hi);-std::vector<RECT> Areas(); // onde estão (tela): os ícones da mesa não ficam embaixo deles-void EditMenu(POINT pt); // "Editar Widgets…": ligar/desligar cada widget (também sem nenhum na tela)-void SettingsChanged(); // widget.<id>.on mudou no ajustes.txt (Ajustes > Personalizar a Mesa)-}-namespace mesa { // mesa própria (papel de parede + ícones) e o modo sem explorer.exe (mesa.cpp, docs/sem-explorer.md)-void Start(HINSTANCE hi, HWND msgWnd); // ajuste explorer=0: fecha o Explorador e assume a mesa-void Stop(bool restartExplorer); // false: caiu/fim da sessão (o vigia abre o Explorador)-void Pulse(); // laço principal: a interface andou (o vigia lê; ver mesa.cpp)-void NoExplorerOnExit(); // reiniciando o Shell: ao sair, o Explorador não é aberto (o Shell novo vem já)-void SettingsChanged(); // ajustes.txt mudou (explorer=0/1)-// cor média do papel de parede que a mesa está mostrando, na faixa atrás da barra de menus (0..1); false sem mesa-bool TopColor(int barPx, float& r, float& g, float& b);-bool Standalone(); // sem Explorador agora (qualquer thread)-void WallpaperNow(const std::wstring& path); // o Ajustes escolheu este papel de parede: mostra já-void DepoisDoJogo(); // modo jogo acabou: refaz a mesa se a tela mudou durante o jogo-// App antigo da Loja (UWP: Segurança do Windows...) não abre sem o Explorador (a janela dele vem de uma peça-// que vive no explorer.exe). Abre o Explorador escondido, abre o app de novo e, sem nenhum desses apps-// aberto por 15 s, volta ao modo sem Explorador. Qualquer thread.-void NeedExplorer(const std::wstring& aumid);-bool IsDeskClass(const wchar_t* cls); // Progman, WorkerW ou a nossa SequoiaMesa-bool IsDeskWindow(HWND h);-bool IconAt(POINT screen); // há um ícone da nossa mesa embaixo do ponto-void WinKey(UINT vk); // Win+E / Win+R / Win+D sem o Explorador-bool Watchdog(const wchar_t* cmdLine); // WacOSShell.exe --mesa-vigia <pid>-bool IsWindowsShell(); // HKCU Winlogon Shell aponta para o WacOSShell-void RunStartupApps(); // shell do Windows: Run e pastas Inicializar (uma vez por sessão)-}-namespace notificacoes { // Central de Notificações: clique na data/hora da barra de menus (notificacoes.cpp)-bool Create(HINSTANCE hi);-void Toggle();-bool IsOpen();-bool BannerVisible(); // um banner está na tela (Tahoe: o relógio da barra ganha a pílula de destaque)-void IconsChanged(); // ícone próprio do Dock mudou (apps::ReloadIcons): relê os ícones das notificações-void Stop(); // ao sair: o banner do Windows volta a aparecer (o Shell troca pelo banner do Mac; ajuste "banners_mac")-// Widgets da coluna, embaixo das notificações. Sem chamar, vêm Calendário e Relógio próprios.-// w × h em pt (pequeno 164 × 164, médio 344 × 164); paint desenha em DIPs com a origem no canto do widget-// (o vidro e a borda já vêm desenhados); click roda depois que o painel fecha.-struct Widget {- float w, h;- std::function<void(ID2D1DeviceContext* dc, float w, float h, bool dark)> paint;- std::function<void()> click;-};-void SetWidgets(std::vector<Widget> list, std::function<void()> onEdit); // onEdit: "Editar Widgets…"-struct Brief { std::wstring aumid, app; long long time; }; // notificação do Windows (só o necessário para o badge)-std::vector<Brief> Recentes(); // as notificações da Central agora (qualquer thread)-}-namespace ilha { // Ilha Dinâmica (ilha.cpp): notch/pílula preta no topo (música, timer, avisos, Estante...); ajuste ilha=1, ilha_estilo-bool Create(HINSTANCE hi);-void Reload(); // ajustes mudaram (ilha, ilha_estilo, ilha_notificacoes, ilha_volume, ilha_passar)-void SetFullscreen(bool locked); // a janela da frente mudou: confere tela cheia no monitor principal (jogo, vídeo, app) e some na hora-bool On();-// notificação nova: true = a ilha mostrou (o banner do canto não aparece). icon desenha o ícone do app em r (DIP)-bool Notificacao(const std::wstring& app, const std::wstring& title, const std::wstring& body,- std::function<void(ID2D1DeviceContext*, ID2D1SolidColorBrush*, D2D1_RECT_F)> icon, std::function<void()> click);-bool Volume(float level, bool mute); // teclas de volume: true = a ilha mostrou (sem o aviso de volume)-void CapsLock(); // a tecla Caps Lock foi apertada (gancho de teclado do main.cpp)-void PrivacidadeMudou(); // a bandeja mudou: relê o ícone de privacidade do Windows (tray::PrivacyBits)-void Captura(bool copiada); // a Captura de Tela terminou: aviso rápido "Captura feita" / "Captura copiada"-int Privacidade(); // 1 microfone, 2 câmera em uso (bits); a 1ª chamada liga a vigia; mudou = menubar::Update()-}-namespace palco { // Organizador Visual / Stage Manager (palco.cpp): ajuste organizador=1-bool On();-void Sync(); // liga/desliga conforme o ajuste-void Toggle(); // Central de Controle-void Stop(); // Shell saindo: devolve as janelas-}-namespace quicklook { // Quick Look (quicklook.cpp): painel só com a prévia de um arquivo (espaço abre e fecha)-void Toggle(const std::wstring& path, bool activate = true);-void Close();-bool IsOpen();-std::wstring Path();-}-namespace pilhas { // Pilhas do Dock (pilhas.cpp): Downloads em Leque, Grade ou Lista, como no Mac-void Show(POINT anchorScreen); // anchor: centro de cima do ícone-void ShowApps(POINT anchorScreen); // Leopard: a pasta Aplicativos da Dock como Pilha em Grade-void Menu(POINT anchorScreen); // botão direito: ordenar, ver como, exibir como (pasta/pilha), abrir a pasta-bool IsOpen();-std::vector<std::wstring> Recentes(int max); // os primeiros arquivos de Downloads na ordem escolhida (a pilha no Dock)-}-namespace verde { // menu do botão verde (verde.cpp): encaixar a janela (metades, quartos, preencher)-void Show(HWND target, POINT screenPt);-}-namespace atalhos { // itens do app no menu do Dock: tarefas ("Nova janela") e recentes (atalhos.cpp)-struct Item { std::wstring title, path, args, dir; bool recent = false; };-std::vector<Item> Tasks(const std::wstring& exePath);-std::vector<Item> Recent(const std::wstring& aumid, const std::wstring& exePath, int max = 8);-std::wstring AumidOf(HWND h);-void Run(const Item& it);-// o que o app está tocando (controles de mídia do Windows), como no menu do Spotify no Dock do Mac-struct Media { bool has = false, playing = false, canNext = false, canPrev = false; std::wstring title, artist; };-Media MediaOf(const std::wstring& exePath, const std::wstring& aumid);-void MediaCommand(const std::wstring& exePath, const std::wstring& aumid, int cmd); // 0 tocar/pausar, 1 próxima, 2 anterior-}-namespace cantos { // Cantos Ativos (cantos.cpp): canto_se/sd/ie/id = nada|mission|mesa|launchpad|notificacoes|central|spotlight|bloquear|tela|nota-void Start();-bool NotaRapida(); // o canto inferior direito é o da Nota Rápida-void Pausar(bool p); // modo jogo: sem ler o ponteiro-}-namespace notarapida { // canto inferior direito da tela abre a Nota Rápida (notarapida.cpp); `canto_nota_rapida=0` desliga-void Create(HINSTANCE hi);-}--namespace bloqueio { // tela de bloqueio do Sequoia (bloqueio.cpp); `bloqueio=0` em ajustes.txt usa a do Windows-void Create(HINSTANCE hi);-void Lock(); // Win+L, menu da Apple → Bloquear Tela-bool Active(); // travada agora (o gancho do teclado barra Alt+Tab, Win...)-void Fallback(); // o Shell vai sair/caiu: se travada, bloqueia o Windows de verdade-void Stop(); // Shell saindo: apaga a política do Win+L, dispensa o vigia-bool Watchdog(const wchar_t* cmdLine); // Shell.exe --vigia <pid>: true = era o vigia (sair)-bool RenderPng(const wchar_t* cmdLine); // Shell.exe --bloqueio-png ...: imagem de teste (sair)-int Preview(HINSTANCE hi); // Shell.exe --testar-bloqueio: a tela por ~3,5 s, sem senha-int SetPasswordUi(HINSTANCE hi); // Shell.exe --senha-bloqueio: senha própria da tela (só o resumo é gravado)-}-namespace boot { // tela de inicialização do Mac depois do login (boot.cpp); ajuste boot=0 desliga-void Show(HINSTANCE hi); // começo do WinMain: só aparece se o login foi há pouco-void Progress(float p); // 0..1: partes do Shell já criadas-void Done(); // Shell pronto: a tela espera o Explorador/apps de inicialização e esmaece-int Preview(HINSTANCE hi); // Shell.exe --testar-boot: só a tela, ~6 s-}-namespace launchpad {-bool Create(HINSTANCE hi);-void Warm(); // prepara o fundo desfocado antes da primeira abertura-void Toggle();-bool IsOpen();-int Category(const std::wstring& appName); // categoria do app (1..CategoryCount()-1; 0 = todos)-int CategoryCount();-const wchar_t* CategoryName(int k);-void Rescan(); // relê a lista de apps (um programa foi instalado ou removido)-void IconsChanged(); // um ícone próprio mudou: relê a lista e os ícones (sem reaproveitar os guardados)-// Fora do Launchpad e do painel Apps: tirado à mão (launchpad_ocultos) ou ferramenta do Windows com-// launchpad_sem_sistema=1 (Painel de Controle, Mapa de Caracteres, Ferramentas do Windows...)-bool Escondido(const std::wstring& name, const std::wstring& parsing);-bool AppDoSistema(const std::wstring& name, const std::wstring& parsing);-void Ocultar(const std::wstring& name); // acrescenta a launchpad_ocultos-}-namespace instalados { // vigia o Menu Iniciar e os apps da Store e avisa o Spotlight e o Launchpad (instalados.cpp)-void Start();-}-namespace dock {-bool Create(HINSTANCE hi);-void Update(); // apps mudaram-HWND Hwnd();-HWND Fundo(); // o vidro, a janela mais de baixo do Dock-bool Vidro(RECT* screen); // retângulo do vidro do Dock na tela (todos os temas, também o Leopard); false = fora da tela-int ReservedHeight(); // px reservados na borda do Dock (área de trabalho): embaixo ou do lado (Posicao)-int Posicao(); // 0 embaixo, 1 esquerda, 2 direita (dock_posicao; o Leopard fica sempre embaixo)-HMONITOR MonitorHandle(); // o monitor do Dock (ajuste dock_monitor; vazio = o principal)-void Raise(); // traz o Dock para cima (ex.: por cima do Launchpad)-void OpenAppsStack(); // Leopard: a pasta Aplicativos como Pilha em Grade-void OpenDownloadsStack(); // a pilha Downloads (testes: ShellAbrirPainel 15)-void ReloadSettings(); // o Ajustes do Sistema mudou tamanho, ampliação...-void ApplyTheme(); // claro/escuro mudou-void IconsChanged(); // o pacote de ícones mudou (tema Sequoia/Tahoe): solta os ícones guardados-void SetFullscreen(bool on); // app em tela cheia na frente: some-RECT MinimizeTarget(HWND h = nullptr); // tela: onde a janela minimizada vai parar (h: no ícone do app com dock_minimizar_no_icone)-void BadgesChanged(); // chegou ou saiu notificação: redesenha os badges vermelhos-}--namespace backdrop { // vidro desfocado com recorte arredondado suave (backdrop.cpp)-bool Attach(HWND h); // janela criada com WS_EX_NOREDIRECTIONBITMAP-void Detach(HWND h); // a janela vai ser destruída: solta o vidro dela-void Restart(); // refaz o vidro real do zero (Ajustes: "Reiniciar o Liquid Glass")-void Set(HWND h, float w, float hgt, float radius, D2D1_COLOR_F tint); // px-void Fade(HWND h, float opacity, float scale, float cx, float cy); // animação: opacidade e escala em volta de (cx, cy) px+}+namespace dialogs { // janela de Abrir/Salvar trocada pelo Finder por fora (dialogs.cpp)+void Start();+void Stop();+std::wstring LastSaved(); // caminho escolhido no último Salvar (até 20 s atrás), para a confirmação de substituir+}+namespace janelas { // barra de título do Mac nas janelas dos outros programas (janelas.cpp + MacJanela.dll)+void Start();+void Stop(); // devolve o visual do Windows e tira os ganchos (reiniciando: só tira os ganchos)+void Foreground(HWND h);+void ManterAoReiniciar(); // o próximo Stop é um reinício: as janelas ficam com a barra (o Shell novo assume)+}+namespace barras { // barra de título do Mac por fora, sem nada dentro dos outros programas (modo nativo; barras.cpp)+void Start();+void Stop();+}+namespace sombras { // sombra do Mac nas janelas que a MacJanela.dll não trata (sombras.cpp)+void Start();+void Stop();+}+namespace central { // Central de Controle: painel embaixo do ícone da barra de menus (central.cpp)+bool Create(HINSTANCE hi);+void BrilhoPasso(int dir); // teclas de brilho (F14/F15): -1/+1 de 16 passos, DDC/CI ou WMI, aviso na Ilha+void Toggle();+bool IsOpen();+}+namespace missioncontrol { // Win+Tab: todas as janelas e as Mesas (missioncontrol.cpp)+bool Create(HINSTANCE hi);+void Warm(); // prepara o fundo (papel de parede) antes da primeira abertura+void Toggle();+// Exposé do app (Ctrl+↓ no Mac; aqui Ctrl+Win+↓, "Mostrar Todas as Janelas" no Dock, Cantos Ativos): só as+// janelas do app `appId` (apps::App::id), espalhadas, sem a faixa de Mesas. De novo com o mesmo app: fecha.+void ToggleApp(const std::wstring& appId, const std::wstring& appName);+bool IsOpen();+}+namespace encaixe { // encaixe.cpp: arrastar a janela até a borda = metade/quarto/preencher, com a prévia do Mac+void Start();+void Stop(); // o encaixe do Windows volta como estava+void Half(HWND h, bool right); // Win+← / Win+→+}+namespace memoria { // memoria.cpp: pressão de memória, soneca de apps (App Nap) e memória descartável, como no Mac+void Start();+void Stop(); // acorda todos os apps em soneca (devolve o estado de antes)+int Level(); // 0 normal, 1 alta, 2 crítica+bool Napping(DWORD pid);+}+namespace limites { // limites.cpp: janelas voltam para dentro da área (não cruzam a barra de menus nem o Dock)+void Start();+void Stop();+void Maximizada(HWND h); // a janela da frente mudou de lugar: maximizada por cima da barra/do Dock volta para a área+}+namespace pastas { // pastas.cpp: janela de pasta do Explorador (Chrome "Mostrar na pasta", explorer /select) vira o Finder+void Start();+void Stop();+}+namespace indice { // índice de arquivos próprio (indice.cpp): pasta do usuário e outros discos, salvo em indice.db+struct Hit { std::wstring path, name; bool dir; int score; };+void Start();+bool Ready();+size_t Count();+// foldedQuery: minúsculas sem acento; para logo se cancelled() der true+void Search(const std::wstring& foldedQuery, size_t max, const std::function<bool()>& cancelled, std::vector<Hit>& out);+}+namespace atualizacao { // aviso de versão nova no GitHub (atualizacao.cpp)+void Start(HWND msgWnd); // thread: confere 90 s depois e a cada 6 h; avisa msgWnd+bool Handle(UINT m); // na MsgProc: mostra a notificação (uma vez por versão); true = era a mensagem+void Avisar(const std::wstring& title, const std::wstring& body); // notificação do WacOS (vira o banner do Mac)+}+namespace migrar { // troca de nome Sequoia → WacOS (migrar.cpp)+bool TrocarPeloNovo(); // rodando como SequoiaShell.exe com o WacOSShell.exe ao lado: abre o novo (true = sair)+void Registro(); // caminhos do nome velho no registro e a tarefa do login+}+namespace alertas { // confirmações de excluir do Explorer no alerta do Mac (alertas.cpp)+bool Create(HINSTANCE hi);+void Stop();+// alerta do Mac para uma pergunta do próprio Shell; onYes roda se a resposta for o botão azul+// icon: "" = Lixeira, "pack:<nome>" = icones\sequoia\<nome>.png, senão o caminho de um programa+void Confirm(const std::wstring& title, const std::wstring& info, const std::wstring& yes, std::function<void()> onYes, const std::wstring& icon = L"");+}+namespace progresso { // janela de progresso do Windows (copiar, mover, apagar...) trocada pela do Finder (progresso.cpp)+bool Create(HINSTANCE hi);+void Stop();+bool Owns(HWND h); // janela do Windows que tiramos da tela (não entra no Dock)+}+namespace spotlight { // Win+Espaço / lupa da barra de menus: busca de apps, ajustes e arquivos (spotlight.cpp)+bool Create(HINSTANCE hi);+void Toggle();+bool IsOpen();+void OpenMode(int mode); // Tahoe: abre direto num modo (1 Aplicativos = o "Apps" do Dock, 2 Arquivos, 3 Ações); de novo fecha+void Rescan(); // relê a lista de apps (um programa foi instalado ou removido)+void ClickedDesktop(); // clique na mesa (gancho do revelar.cpp, outra thread): aberto, fecha+}+namespace dashboard { // Dashboard do Leopard (dashboard.cpp): Win+F12 / ShellAbrirPainel 16+bool Create(HINSTANCE hi);+void Toggle();+bool IsOpen();+}+namespace espacos { // Spaces do Leopard (espacos.cpp): Win+F8 / ShellAbrirPainel 17+bool Create(HINSTANCE hi);+void Toggle();+bool IsOpen();+}+namespace tempo { // a "viagem no tempo" do Time Machine do Leopard (tempo.cpp): app Time Machine / ShellAbrirPainel 18+bool Create(HINSTANCE hi);+void Enter();+bool IsOpen();+}+namespace sobre { // "Sobre Este Mac" do menu da Apple (sobre.cpp)+bool Create(HINSTANCE hi);+void Show();+}+namespace genio { // efeito gênio ao minimizar e ao restaurar pelo Dock (genio.cpp)+void Create(HINSTANCE hi);+void Stop();+bool Busy(HWND h); // a janela está no meio do gênio (o Dock ainda não mostra)+int Phase(HWND h); // 0 parada, 1 minimizando (indo para o Dock), 2 restaurando (saindo dele)+bool Restore(HWND h, RECT fromSlot);+bool OnMinRect(HWND h, RECT* out); // HSHELL_GETMINRECT: começa o gênio antes da janela sumir+void Pause(DWORD ms); // Win+D: minimiza tudo de uma vez, sem o gênio (pesado em várias janelas)+}+namespace seletor { // Alt+Tab: o seletor de apps do Mac (seletor.cpp)+bool Create(HINSTANCE hi);+bool IsActive();+void Step(int dir); // Tab (+1) / Shift+Tab (-1) com o Alt seguro+void Key(UINT vk); // Q, H, Esc, setas enquanto aberto+void Release(); // soltou o Alt: troca para o escolhido+void IconsChanged(); // o pacote de ícones mudou (tema): solta os ícones guardados+}+namespace revelar { // clique no vazio da área de trabalho mostra a mesa, como no Mac (revelar.cpp)+void Start();+void Stop();+void Pausar(bool p); // modo jogo: sem o gancho global do mouse+void Foreground(HWND h);+bool Owns(HWND h); // janela minimizada por "mostrar a mesa" (não vai para o Dock)+}+namespace mesas { // áreas de trabalho virtuais pela interface interna do Explorer (mesas.cpp); false = use os atalhos+bool Switch(int index);+bool Create();+bool Remove(int index);+bool MoveWindow(HWND h, int index); // leva a janela (de qualquer programa) para outra mesa+}+namespace widgets { // widgets da mesa: Relógio Mundial, Tempo, Relógio, Calendário, Nascer do Sol (widgets.cpp)+void Create(HINSTANCE hi);+std::vector<RECT> Areas(); // onde estão (tela): os ícones da mesa não ficam embaixo deles+void EditMenu(POINT pt); // "Editar Widgets…": ligar/desligar cada widget (também sem nenhum na tela)+void SettingsChanged(); // widget.<id>.on mudou no ajustes.txt (Ajustes > Personalizar a Mesa)+}+namespace mesa { // mesa própria (papel de parede + ícones) e o modo sem explorer.exe (mesa.cpp, docs/sem-explorer.md)+void Start(HINSTANCE hi, HWND msgWnd); // ajuste explorer=0: fecha o Explorador e assume a mesa+void Stop(bool restartExplorer); // false: caiu/fim da sessão (o vigia abre o Explorador)+void Pulse(); // laço principal: a interface andou (o vigia lê; ver mesa.cpp)+void NoExplorerOnExit(); // reiniciando o Shell: ao sair, o Explorador não é aberto (o Shell novo vem já)+void SettingsChanged(); // ajustes.txt mudou (explorer=0/1)+// cor média do papel de parede que a mesa está mostrando, na faixa atrás da barra de menus (0..1); false sem mesa+bool TopColor(int barPx, float& r, float& g, float& b, bool baixo = false);+// a imagem do papel de parede do monitor principal como a mesa desenhou (BGRA, opaca) e onde fica na tela. key muda+// quando o papel de parede é refeito: com key igual ao que se passou, não copia nada e devolve true+bool Papel(void*& key, int& w, int& h, RECT& tela, std::vector<BYTE>& px);+bool Standalone(); // sem Explorador agora (qualquer thread)+void WallpaperNow(const std::wstring& path); // o Ajustes escolheu este papel de parede: mostra já+void DepoisDoJogo(); // modo jogo acabou: refaz a mesa se a tela mudou durante o jogo+// App antigo da Loja (UWP: Segurança do Windows...) não abre sem o Explorador (a janela dele vem de uma peça+// que vive no explorer.exe). Abre o Explorador escondido, abre o app de novo e, sem nenhum desses apps+// aberto por 15 s, volta ao modo sem Explorador. Qualquer thread.+void NeedExplorer(const std::wstring& aumid);+bool IsDeskClass(const wchar_t* cls); // Progman, WorkerW ou a nossa SequoiaMesa+bool IsDeskWindow(HWND h);+bool IconAt(POINT screen); // há um ícone da nossa mesa embaixo do ponto+void WinKey(UINT vk); // Win+E / Win+R / Win+D sem o Explorador+bool Watchdog(const wchar_t* cmdLine); // WacOSShell.exe --mesa-vigia <pid>+bool IsWindowsShell(); // HKCU Winlogon Shell aponta para o WacOSShell+void RunStartupApps(); // shell do Windows: Run e pastas Inicializar (uma vez por sessão)+}+namespace notificacoes { // Central de Notificações: clique na data/hora da barra de menus (notificacoes.cpp)+bool Create(HINSTANCE hi);+void Toggle();+bool IsOpen();+bool BannerVisible(); // um banner está na tela (Tahoe: o relógio da barra ganha a pílula de destaque)+void IconsChanged(); // ícone próprio do Dock mudou (apps::ReloadIcons): relê os ícones das notificações+void Stop(); // ao sair: o banner do Windows volta a aparecer (o Shell troca pelo banner do Mac; ajuste "banners_mac")+// Widgets da coluna, embaixo das notificações. Sem chamar, vêm Calendário e Relógio próprios.+// w × h em pt (pequeno 164 × 164, médio 344 × 164); paint desenha em DIPs com a origem no canto do widget+// (o vidro e a borda já vêm desenhados); click roda depois que o painel fecha.+struct Widget {+ float w, h;+ std::function<void(ID2D1DeviceContext* dc, float w, float h, bool dark)> paint;+ std::function<void()> click;+};+void SetWidgets(std::vector<Widget> list, std::function<void()> onEdit); // onEdit: "Editar Widgets…"+struct Brief { std::wstring aumid, app; long long time; }; // notificação do Windows (só o necessário para o badge)+std::vector<Brief> Recentes(); // as notificações da Central agora (qualquer thread)+}+namespace ilha { // Ilha Dinâmica (ilha.cpp): notch/pílula preta no topo (música, timer, avisos, Estante...); ajuste ilha=1, ilha_estilo+bool Create(HINSTANCE hi);+void Reload(); // ajustes mudaram (ilha, ilha_estilo, ilha_notificacoes, ilha_volume, ilha_passar)+void SetFullscreen(bool locked); // a janela da frente mudou: confere tela cheia no monitor principal (jogo, vídeo, app) e some na hora+bool On();+// notificação nova: true = a ilha mostrou (o banner do canto não aparece). icon desenha o ícone do app em r (DIP)+bool Notificacao(const std::wstring& app, const std::wstring& title, const std::wstring& body,+ std::function<void(ID2D1DeviceContext*, ID2D1SolidColorBrush*, D2D1_RECT_F)> icon, std::function<void()> click);+bool Volume(float level, bool mute); // teclas de volume: true = a ilha mostrou (sem o aviso de volume)+void BotaoMouse(bool down, POINT pt); // gancho do mouse: botão esquerdo apertado/solto (arrastar arquivo até a Ilha desligada)+void Brilho(int pct); // o brilho da tela mudou (qualquer thread): aviso de brilho, como o de volume+void CapsLock(); // a tecla Caps Lock foi apertada (gancho de teclado do main.cpp)+void PrivacidadeMudou(); // a bandeja mudou: relê o ícone de privacidade do Windows (tray::PrivacyBits)+void Captura(bool copiada); // a Captura de Tela terminou: aviso rápido "Captura feita" / "Captura copiada"+int Privacidade(); // 1 microfone, 2 câmera em uso (bits); a 1ª chamada liga a vigia; mudou = menubar::Update()+}+namespace siri { // siri.cpp: a Siri com a chave do usuário (issue #39); provedores e chave em src/comum/siri.h+bool Pronta(); // um serviço escolhido nos Ajustes (e a chave, se ele pede)+void Perguntar(const std::wstring& q, bool teste = false);+void Abrir(bool teste = false); // o ícone da barra de menus: o painel com o campo para digitar (de novo: fecha)+bool Aberta(); // abre o painel da Siri e faz a pergunta (numa thread)+}+namespace brilho { // brilho.cpp: vigia o brilho da tela do notebook (WMI) e mostra na Ilha+void Start();+}+namespace palco { // Organizador Visual / Stage Manager (palco.cpp): ajuste organizador=1+bool On();+void Sync(); // liga/desliga conforme o ajuste+void Toggle(); // Central de Controle+void Stop(); // Shell saindo: devolve as janelas+}+namespace quicklook { // Quick Look (quicklook.cpp): painel só com a prévia de um arquivo (espaço abre e fecha)+void Toggle(const std::wstring& path, bool activate = true);+void Close();+bool IsOpen();+std::wstring Path();+}+namespace pilhas { // Pilhas do Dock (pilhas.cpp): Downloads em Leque, Grade ou Lista, como no Mac+void Show(POINT anchorScreen); // anchor: centro de cima do ícone+void ShowApps(POINT anchorScreen); // Leopard: a pasta Aplicativos da Dock como Pilha em Grade+void Menu(POINT anchorScreen); // botão direito: ordenar, ver como, exibir como (pasta/pilha), abrir a pasta+bool IsOpen();+std::vector<std::wstring> Recentes(int max); // os primeiros arquivos de Downloads na ordem escolhida (a pilha no Dock)+}+namespace verde { // menu do botão verde (verde.cpp): encaixar a janela (metades, quartos, preencher)+void Show(HWND target, POINT screenPt);+}+namespace atalhos { // itens do app no menu do Dock: tarefas ("Nova janela") e recentes (atalhos.cpp)+struct Item { std::wstring title, path, args, dir; bool recent = false; };+std::vector<Item> Tasks(const std::wstring& exePath);+std::vector<Item> Recent(const std::wstring& aumid, const std::wstring& exePath, int max = 8);+std::wstring AumidOf(HWND h);+void Run(const Item& it);+// o que o app está tocando (controles de mídia do Windows), como no menu do Spotify no Dock do Mac+struct Media { bool has = false, playing = false, canNext = false, canPrev = false; std::wstring title, artist; };+Media MediaOf(const std::wstring& exePath, const std::wstring& aumid);+void MediaCommand(const std::wstring& exePath, const std::wstring& aumid, int cmd); // 0 tocar/pausar, 1 próxima, 2 anterior+}+namespace cantos { // Cantos Ativos (cantos.cpp): canto_se/sd/ie/id = nada|mission|mesa|launchpad|notificacoes|central|spotlight|bloquear|tela|nota+void Start();+bool NotaRapida(); // o canto inferior direito é o da Nota Rápida+void Pausar(bool p); // modo jogo: sem ler o ponteiro+}+namespace notarapida { // canto inferior direito da tela abre a Nota Rápida (notarapida.cpp); `canto_nota_rapida=0` desliga+void Create(HINSTANCE hi);+}++namespace bloqueio { // tela de bloqueio do Sequoia (bloqueio.cpp); `bloqueio=0` em ajustes.txt usa a do Windows+void Create(HINSTANCE hi);+void Lock(); // Win+L, menu da Apple → Bloquear Tela+bool Active(); // travada agora (o gancho do teclado barra Alt+Tab, Win...)+void Fallback(); // o Shell vai sair/caiu: se travada, bloqueia o Windows de verdade+void Stop(); // Shell saindo: apaga a política do Win+L, dispensa o vigia+bool Watchdog(const wchar_t* cmdLine); // Shell.exe --vigia <pid>: true = era o vigia (sair)+bool RenderPng(const wchar_t* cmdLine); // Shell.exe --bloqueio-png ...: imagem de teste (sair)+int Preview(HINSTANCE hi); // Shell.exe --testar-bloqueio: a tela por ~3,5 s, sem senha+int SetPasswordUi(HINSTANCE hi); // Shell.exe --senha-bloqueio: senha própria da tela (só o resumo é gravado)+}+namespace boot { // tela de inicialização do Mac depois do login (boot.cpp); ajuste boot=0 desliga+void Show(HINSTANCE hi); // começo do WinMain: só aparece se o login foi há pouco+void Progress(float p); // 0..1: partes do Shell já criadas+void Done(); // Shell pronto: a tela espera o Explorador/apps de inicialização e esmaece+int Preview(HINSTANCE hi); // Shell.exe --testar-boot: só a tela, ~6 s+}+namespace launchpad {+bool Create(HINSTANCE hi);+void Warm(); // prepara o fundo desfocado antes da primeira abertura+void Toggle();+bool IsOpen();+int Category(const std::wstring& appName); // categoria do app (1..CategoryCount()-1; 0 = todos)+int CategoryCount();+const wchar_t* CategoryName(int k);+void Rescan(); // relê a lista de apps (um programa foi instalado ou removido)+void IconsChanged(); // um ícone próprio mudou: relê a lista e os ícones (sem reaproveitar os guardados)+// Fora do Launchpad e do painel Apps: tirado à mão (launchpad_ocultos) ou ferramenta do Windows com+// launchpad_sem_sistema=1 (Painel de Controle, Mapa de Caracteres, Ferramentas do Windows...)+bool Escondido(const std::wstring& name, const std::wstring& parsing);+bool AppDoSistema(const std::wstring& name, const std::wstring& parsing);+void Ocultar(const std::wstring& name); // acrescenta a launchpad_ocultos+}+namespace instalados { // vigia o Menu Iniciar e os apps da Store e avisa o Spotlight e o Launchpad (instalados.cpp)+void Start();+}+namespace dock {+bool Create(HINSTANCE hi);+void Update(); // apps mudaram+HWND Hwnd();+HWND Fundo(); // o vidro, a janela mais de baixo do Dock+bool Vidro(RECT* screen); // retângulo do vidro do Dock na tela (todos os temas, também o Leopard); false = fora da tela+int ReservedHeight(); // px reservados na borda do Dock (área de trabalho): embaixo ou do lado (Posicao)+int Posicao(); // 0 embaixo, 1 esquerda, 2 direita (dock_posicao; o Leopard fica sempre embaixo)+HMONITOR MonitorHandle(); // o monitor do Dock (ajuste dock_monitor; vazio = o principal)+void Raise(); // traz o Dock para cima (ex.: por cima do Launchpad)+void OpenAppsStack(); // Leopard: a pasta Aplicativos como Pilha em Grade+void OpenDownloadsStack(); // a pilha Downloads (testes: ShellAbrirPainel 15)+void ReloadSettings(); // o Ajustes do Sistema mudou tamanho, ampliação...+void ApplyTheme(); // claro/escuro mudou+void IconsChanged(); // o pacote de ícones mudou (tema Sequoia/Tahoe): solta os ícones guardados+void SetFullscreen(bool on); // app em tela cheia na frente: some+RECT MinimizeTarget(HWND h = nullptr);+RECT AppIconTarget(HWND h); // tela: o ícone do app dono da janela (vazio se não está no Dock) // tela: onde a janela minimizada vai parar (h: no ícone do app com dock_minimizar_no_icone)+void BadgesChanged(); // chegou ou saiu notificação: redesenha os badges vermelhos+}++namespace backdrop { // vidro desfocado com recorte arredondado suave (backdrop.cpp)+bool Attach(HWND h); // janela criada com WS_EX_NOREDIRECTIONBITMAP+void Detach(HWND h); // a janela vai ser destruída: solta o vidro dela+void Restart(); // refaz o vidro real do zero (Ajustes: "Reiniciar o Liquid Glass")+void Set(HWND h, float w, float hgt, float radius, D2D1_COLOR_F tint); // px+void Fade(HWND h, float opacity, float scale, float cx, float cy); // animação: opacidade e escala em volta de (cx, cy) px+ void FadeOutAnim(HWND h, int ms); // some em ms pela Composição (não depende desta thread)-// Conteúdo desenhado DENTRO do vidro (mesma árvore da Composição): vidro e desenho chegam à tela no mesmo-// quadro. Numa janela à parte (swap chain), a borda do vidro ficava um quadro atrás do desenho quando o-// painel mudava de tamanho. Coordenadas em DIP (scale = DPI/96); o contexto é do dispositivo de ui::Gpu()-// (bitmaps de lá valem). Recortado, esmaecido e escalado junto com o vidro. nullptr: desenhe do jeito antigo.-ID2D1DeviceContext* ContentBegin(HWND h, int wpx, int hpx, float scale);-void ContentEnd(HWND h);-// avisa (PostMessage(to, msg)) quando o que foi desenhado no vidro já chegou à tela (commit do compositor);-// quem mostra a janela depois disso não aparece com o vidro da última vez-void AfterCommit(HWND to, UINT msg);-// Transparência e Efeitos (Ajustes do Sistema): Liquid Glass, reduzir transparência, tinta do vidro-struct Style {- bool liquid = false; // liquid_glass: vidro líquido do macOS Tahoe- bool golden = false; // golden_gate (com liquid_glass): tema macOS 27 Golden Gate- bool leopard = false; // leopard (sem liquid_glass): tema Mac OS X Leopard (o Sequoia com o Aqua de 2007)- bool tinted = false; // liquid_estilo: "nitido" ou "tingido"- float refraction = 0.6f; // liquid_refracao 0..1: força da lente nas bordas- bool reduce = false; // reduzir_transparencia- float tintK = 0.5f; // vidro_tinta 0..1 (0,5 = a tinta original de cada janela); no vidro real, também o desfoque- bool real = false; // vidro_real: Liquid Glass com refração de verdade (captura da tela por baixo)-};-struct Piece { // px, nas coordenadas da janela- D2D1_RECT_F r; float radius;- // gosma (comum/vidro.h): a peça é a cápsula `cap` unida aos círculos `circ` (o Spotlight soltando os círculos)- bool goo = false; D2D1_RECT_F cap{}; float capR = 0; std::vector<D2D1_ELLIPSE> circ; unsigned broken = 0;-};-// várias peças de vidro soltas numa janela só (módulos da Central): cada uma com a lente dela e a tinta;-// o contorno fica por conta de quem desenha por cima-void SetPieces(HWND h, float w, float hgt, const std::vector<Piece>& pieces, D2D1_COLOR_F tint, float minFrost = 0); // minFrost: desfoque mínimo (DIP)-bool Real(); // vidro real ativo (senão, o fosco)-void CaptureVisible(bool show); // Captura de Tela do projeto: mostrar as peças só durante a foto-const Style& Current();-bool Liquid(); // Liquid Glass ligado (e transparência não reduzida)-void Reload(); // lê os ajustes e reaplica em todos os vidros-float AdjustAlpha(float a); // opacidade da tinta conforme os ajustes-D2D1_COLOR_F AdjustTint(D2D1_COLOR_F c);-}-namespace liquid { // tema macOS Tahoe nos painéis do Shell (liquid.cpp): detalhes D2D por cima do vidro-bool On(); // Tema = macOS Tahoe (liquid_glass), mesmo com a transparência reduzida-bool Golden(); // Tema = macOS Golden Gate (liquid_glass + golden_gate): o Tahoe com o que mudou no macOS 27-bool Leopard(); // Tema = Mac OS X Leopard (leopard=1, sem liquid_glass): barra de menus clara com a maçã grafite, Dock em prateleira-// contorno especular; spec = força do brilho dos cantos (0 em repouso, 1 com o ponteiro em cima), lx/ly = de onde vem a-// luz (0..1 dentro da peça, a posição do ponteiro; < 0 = canto de cima à esquerda)-void Rim(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, bool dark, float strength = 1, float spec = 1, float lx = -1, float ly = -1);-void Tile(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, bool dark, float fill = 1); // bloco/cápsula de vidro-}--// ---- main.cpp-namespace shell {-// Modo nativo (barra-nativa\MacBarra.dll): o Shell é a barra de tarefas do próprio Windows, rodando numa-// thread dentro do explorer.exe (trocado pelo TrayUI Component). Nada de processo próprio: sem esconder a-// barra do Windows (ela é nossa), sem Shell_TrayWnd falsa, sem mesa própria, sem ganchos com DLL nos outros-// programas, sem TerminateProcess/filtro de falhas (o processo é o explorer).-extern bool nativo;-// Modo "Só Dock e barra de menus" (ajuste modo=dock; Ajustes > Geral): só a barra de menus (com Central de Controle,-// Notificações e Spotlight), o Dock (com Launchpad, gênio e Mission Control). O resto fica com o Windows: a área de-// trabalho e os ícones dele, o Explorador nas pastas, o Alt+Tab, a tecla Windows, a captura de tela e as barras de-// título dos outros apps. Lido na partida do Shell (trocar o modo reinicia o Shell).-bool SoDock();-// Tira a janela de minimizada. Numa janela de administrador o ShowWindow de fora e recusado pelo Windows (o explorer-// nao e administrador); o pedido pelo menu de sistema dela (WM_SYSCOMMAND) passa.-inline void Restaurar(HWND h) { ShowWindow(h, SW_RESTORE); if (IsIconic(h)) PostMessageW(h, WM_SYSCOMMAND, SC_RESTORE, 0); }-int RodarNativo(HINSTANCE dll, const std::wstring& dirBin, const std::wstring& logPath);-// abre o Finder com estes argumentos: no nativo, no Finder de dentro do explorer (MacFinder.dll); senão o WacOSFinder.exe-void AbrirFinder(const std::wstring& args);-// abre o Finder com estes argumentos: no nativo, no Finder de dentro do explorer (MacFinder.dll); senão o WacOSFinder.exe-void AbrirFinder(const std::wstring& args);-DWORD SemProprio(); // WINEVENT_SKIPOWNPROCESS fora do modo nativo (no nativo, o processo é o explorer)-bool Nossa(HWND h); // janela do próprio Shell (no nativo: só as criadas pelo Shell, não as do explorer)-extern HINSTANCE inst;-extern std::wstring dir; // pasta do Shell.exe-void Quit(const wchar_t* why); // sai do shell e devolve a barra do Windows-void ApplyWorkArea();-std::wstring Setting(const wchar_t* key, const wchar_t* def);-void SetSetting(const wchar_t* key, const std::wstring& value);-RECT WorkAreaFor(HMONITOR mon); // a área de trabalho que o Shell reserva (barra de menus em cima, Dock embaixo), px-bool NaoIncomodar(HMONITOR mon); // app em tela cheia nesse monitor (nullptr = qualquer um) ou Windows em "não incomodar"-void Sound(const wchar_t* name);-bool OpenCalculator(const std::wstring& target); // alvo é a Calculadora do Windows: abre a nossa (Calculadora.exe)-void OpenForceQuit(bool memory); // Forçar Encerrar (Ctrl+Alt+Esc, menu da Apple); memory = "ficou sem memória"-void OpenMonitor(); // Monitor de Atividade (Ctrl+Shift+Esc, menu da Apple) // toca sons\mac\<name>.wav (sons do Mac), sem esperar-void OpenSettings(const std::wstring& page); // abre o Ajustes do Sistema (Ajustes.exe) na página // grava em %APPDATA%\Shell\ajustes.txt-}--namespace ampliar { // animação do "ampliar" do Mac nas janelas de outros apps (ampliar.cpp; pedida pela MacJanela.dll)-// Foto da janela no retângulo `from` (tela) animando até `to`. true = a foto já está na tela (a DLL esconde a janela)-bool Start(HWND h, RECT from, RECT to, int flags, COLORREF bar); // flags: 1 barra padrão (botões e título na foto), 2 janela de plug-in-void SecondPhoto(HWND h); // a janela já mudou de tamanho (escondida): foto nova entra por cima, ainda em movimento-void Shown(HWND h); // a janela de verdade reapareceu: as fotos somem-bool Fechar(HWND h, LPARAM bar = 0); // a janela vai sumir: foto dela encolhendo e sumindo, como no Mac (bar: a nossa barra, da DLL)-}-namespace abrir { // janela nova aparecendo como no Mac (abrir.cpp; pedida pela WacOSWindow.dll)-void Open(HWND h, HWND bar = nullptr); // a janela (e a nossa barra, se tiver) escondida e já pintada: anima e manda mostrar-}-namespace foto {-// Foto (BGRA pré-multiplicado, opaca) da parte `src` da janela `h` (coordenadas da miniatura do DWM);-// `corner` > 0: raio (px) dos cantos arredondados. Funciona com a janela minimizada.-bool Window(HWND h, const RECT& src, float corner, std::vector<BYTE>& bgra, UINT& w, UINT& hh);-// Várias janelas de uma vez, na placa de vídeo (Windows.Graphics.Capture), direto em superfícies do-// compositor (dispositivo de ui::Comp()). surf == nullptr na que falhar. Espera até `timeoutMs`.-struct Gpu { IDCompositionSurface* surf = nullptr; UINT w = 0, h = 0; };-std::vector<Gpu> Windows(const std::vector<HWND>& hs, const std::vector<RECT>& srcs, int timeoutMs = 150);-// Capturas que ficam abertas (guardam o último quadro de cada janela): Grab tira as fotos na hora.-struct Live;-Live* Start(const std::vector<HWND>& hs, const std::vector<RECT>& srcs);-std::vector<Gpu> Grab(Live* live, int timeoutMs = 150);-void Stop(Live* live);-}--namespace ponteiro { // ponteiro.cpp: sacudir o mouse faz o ponteiro crescer (como no Mac)-void Start();-void Stop();-// tema Mac OS X Leopard: liga o cursor do Mac OS X (guardando o esquema de antes) ou devolve o de antes-void TemaLeopard(bool on);-void Pausar(bool p); // modo jogo: sem Raw Input do mouse enquanto o jogo roda-}-namespace jogo { // Modo Jogo (jogo.cpp): jogo na frente → desliga o que mais pesa; ajuste modo_jogo, lista %APPDATA%\Shell\jogos.txt-void Start();-void Reload(); // ajustes mudaram-void Foreground(HWND h); // a janela da frente mudou-bool Ativo();-// gancho de EVENT_OBJECT_LOCATIONCHANGE que sai durante o modo jogo (cada movimento do cursor chegava ao Shell)-void GanchoPosicao(WINEVENTPROC fn, DWORD flags);-void SoltarPosicao(WINEVENTPROC fn);-}+// Conteúdo desenhado DENTRO do vidro (mesma árvore da Composição): vidro e desenho chegam à tela no mesmo+// quadro. Numa janela à parte (swap chain), a borda do vidro ficava um quadro atrás do desenho quando o+// painel mudava de tamanho. Coordenadas em DIP (scale = DPI/96); o contexto é do dispositivo de ui::Gpu()+// (bitmaps de lá valem). Recortado, esmaecido e escalado junto com o vidro. nullptr: desenhe do jeito antigo.+ID2D1DeviceContext* ContentBegin(HWND h, int wpx, int hpx, float scale);+void ContentEnd(HWND h);+// avisa (PostMessage(to, msg)) quando o que foi desenhado no vidro já chegou à tela (commit do compositor);+// quem mostra a janela depois disso não aparece com o vidro da última vez+void AfterCommit(HWND to, UINT msg);+// Transparência e Efeitos (Ajustes do Sistema): Liquid Glass, reduzir transparência, tinta do vidro+struct Style {+ bool liquid = false; // liquid_glass: vidro líquido do macOS Tahoe+ bool golden = false; // golden_gate (com liquid_glass): tema macOS 27 Golden Gate+ bool leopard = false; // leopard (sem liquid_glass): tema Mac OS X Leopard (o Sequoia com o Aqua de 2007)+ bool tinted = false; // liquid_estilo: "nitido" ou "tingido"+ float refraction = 0.6f; // liquid_refracao 0..1: força da lente nas bordas+ bool reduce = false; // reduzir_transparencia+ float tintK = 0.5f; // vidro_tinta 0..1 (0,5 = a tinta original de cada janela); no vidro real, também o desfoque+ bool real = false; // vidro_real: Liquid Glass com refração de verdade (captura da tela por baixo)+};+struct Piece { // px, nas coordenadas da janela+ D2D1_RECT_F r; float radius;+ // gosma (comum/vidro.h): a peça é a cápsula `cap` unida aos círculos `circ` (o Spotlight soltando os círculos)+ bool goo = false; D2D1_RECT_F cap{}; float capR = 0; std::vector<D2D1_ELLIPSE> circ; unsigned broken = 0;+};+// várias peças de vidro soltas numa janela só (módulos da Central): cada uma com a lente dela e a tinta;+// o contorno fica por conta de quem desenha por cima+void SetPieces(HWND h, float w, float hgt, const std::vector<Piece>& pieces, D2D1_COLOR_F tint, float minFrost = 0); // minFrost: desfoque mínimo (DIP)+bool Real(); // vidro real ativo (senão, o fosco)+void CaptureVisible(bool show); // Captura de Tela do projeto: mostrar as peças só durante a foto+const Style& Current();+bool Liquid(); // Liquid Glass ligado (e transparência não reduzida)+void Reload(); // lê os ajustes e reaplica em todos os vidros+float AdjustAlpha(float a); // opacidade da tinta conforme os ajustes+D2D1_COLOR_F AdjustTint(D2D1_COLOR_F c);+}+namespace liquid { // tema macOS Tahoe nos painéis do Shell (liquid.cpp): detalhes D2D por cima do vidro+bool On(); // Tema = macOS Tahoe (liquid_glass), mesmo com a transparência reduzida+bool Golden(); // Tema = macOS Golden Gate (liquid_glass + golden_gate): o Tahoe com o que mudou no macOS 27+bool Leopard(); // Tema = Mac OS X Leopard (leopard=1, sem liquid_glass): barra de menus clara com a maçã grafite, Dock em prateleira+// contorno especular; spec = força do brilho dos cantos (0 em repouso, 1 com o ponteiro em cima), lx/ly = de onde vem a+// luz (0..1 dentro da peça, a posição do ponteiro; < 0 = canto de cima à esquerda)+void Rim(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, bool dark, float strength = 1, float spec = 1, float lx = -1, float ly = -1);+void Tile(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, bool dark, float fill = 1); // bloco/cápsula de vidro+}++// ---- main.cpp+namespace shell {+// Modo nativo (barra-nativa\MacBarra.dll): o Shell é a barra de tarefas do próprio Windows, rodando numa+// thread dentro do explorer.exe (trocado pelo TrayUI Component). Nada de processo próprio: sem esconder a+// barra do Windows (ela é nossa), sem Shell_TrayWnd falsa, sem mesa própria, sem ganchos com DLL nos outros+// programas, sem TerminateProcess/filtro de falhas (o processo é o explorer).+extern bool nativo;+// Modo "Só Dock e barra de menus" (ajuste modo=dock; Ajustes > Geral): só a barra de menus (com Central de Controle,+// Notificações e Spotlight), o Dock (com Launchpad, gênio e Mission Control). O resto fica com o Windows: a área de+// trabalho e os ícones dele, o Explorador nas pastas, o Alt+Tab, a tecla Windows, a captura de tela e as barras de+// título dos outros apps. Lido na partida do Shell (trocar o modo reinicia o Shell).+bool SoDock();+// Tira a janela de minimizada. Numa janela de administrador o ShowWindow de fora e recusado pelo Windows (o explorer+// nao e administrador); o pedido pelo menu de sistema dela (WM_SYSCOMMAND) passa.+inline void Restaurar(HWND h) { ShowWindow(h, SW_RESTORE); if (IsIconic(h)) PostMessageW(h, WM_SYSCOMMAND, SC_RESTORE, 0); }+// Libera o SetForegroundWindow: o processo que mandou a última entrada pode trocar a janela da frente. Era só Alt+// apertado e solto, mas Alt sozinho, ao soltar, liga a barra de menus do app da frente (o Firefox abria com a barra+// Arquivo/Editar/Exibir à mostra, igual ao F10; issue #8). Uma tecla sem função (vkE8) no meio desfaz isso. Marcadas+// como nossas: o gancho do teclado do Shell deixa passar.+// Janelas "sempre por cima" de outros programas que estão acima de todas as nossas visíveis (uma ilha dinâmica de outro+// app, um widget flutuante). Ao subir o Dock, a barra de menus ou a camada do revelar, elas iam para baixo da barra e+// sumiam (issue #33: a ilha do Vibrance sumia ao clicar na mesa). Pega antes de subir as nossas; DevolveAlheias as põe+// de volta por cima, na mesma ordem.+std::vector<HWND> AlheiasNoTopo();+void DevolveAlheias(const std::vector<HWND>& v);+inline void LiberaFrente() {+ const ULONG_PTR M = 0x53484C4C;+ keybd_event(VK_MENU, 0, 0, M); keybd_event(0xE8, 0, 0, M); keybd_event(0xE8, 0, KEYEVENTF_KEYUP, M); keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, M);+}+int RodarNativo(HINSTANCE dll, const std::wstring& dirBin, const std::wstring& logPath);+// abre o Finder com estes argumentos: no nativo, no Finder de dentro do explorer (MacFinder.dll); senão o WacOSFinder.exe+void AbrirFinder(const std::wstring& args);+// abre o Finder com estes argumentos: no nativo, no Finder de dentro do explorer (MacFinder.dll); senão o WacOSFinder.exe+void AbrirFinder(const std::wstring& args);+DWORD SemProprio(); // WINEVENT_SKIPOWNPROCESS fora do modo nativo (no nativo, o processo é o explorer)+void ThreadDeGancho(); // a thread atual segura um gancho global de mouse/teclado: prioridade alta e fora do EcoQoS+bool Nossa(HWND h); // janela do próprio Shell (no nativo: só as criadas pelo Shell, não as do explorer)+extern HINSTANCE inst;+extern std::wstring dir; // pasta do Shell.exe+void Quit(const wchar_t* why); // sai do shell e devolve a barra do Windows+void ApplyWorkArea();+std::wstring Setting(const wchar_t* key, const wchar_t* def);+void SetSetting(const wchar_t* key, const std::wstring& value);+// A hora no formato escolhido (relogio_formato: auto = o do Windows, 24 ou 12; issue #43): "14:05" ou "2:05 PM".+// segundos: com os segundos; ampm: false tira o AM/PM (o relógio grande da tela de bloqueio, como no Mac)+std::wstring Hora(const SYSTEMTIME& st, bool segundos = false, bool ampm = true);+bool Hora12();+RECT WorkAreaFor(HMONITOR mon); // a área de trabalho que o Shell reserva (barra de menus em cima, Dock embaixo), px+bool NaoIncomodar(HMONITOR mon); // app em tela cheia nesse monitor (nullptr = qualquer um) ou Windows em "não incomodar"+void Sound(const wchar_t* name);+bool OpenCalculator(const std::wstring& target); // alvo é a Calculadora do Windows: abre a nossa (Calculadora.exe)+void OpenForceQuit(bool memory); // Forçar Encerrar (Ctrl+Alt+Esc, menu da Apple); memory = "ficou sem memória"+void OpenMonitor(); // Monitor de Atividade (Ctrl+Shift+Esc, menu da Apple) // toca sons\mac\<name>.wav (sons do Mac), sem esperar+void OpenSettings(const std::wstring& page); // abre o Ajustes do Sistema (Ajustes.exe) na página // grava em %APPDATA%\Shell\ajustes.txt+// ShellExecute numa thread (com o disco ocupado ele segurou a interface 3,2 s; issue #32). Os textos são copiados na hora.+void Abrir(const wchar_t* verb, const wchar_t* file, const wchar_t* args = nullptr, const wchar_t* dir = nullptr, int show = SW_SHOWNORMAL);+// roda `f` na thread da interface (pela janela de mensagens): o resultado de um trabalho feito numa thread+void NaInterface(std::function<void()> f);+}++namespace sentinela { // sentinela.cpp: registra no shell.log onde a thread da interface ficou parada (1 s ou mais)+void Start(HWND alvo);+extern std::atomic<UINT> ultimaMsg; // o laço principal anota a mensagem que vai tratar+extern std::atomic<HWND> ultimaJanela;+}++namespace ampliar { // animação do "ampliar" do Mac nas janelas de outros apps (ampliar.cpp; pedida pela MacJanela.dll)+// Foto da janela no retângulo `from` (tela) animando até `to`. true = a foto já está na tela (a DLL esconde a janela)+bool Start(HWND h, RECT from, RECT to, int flags, COLORREF bar); // flags: 1 barra padrão (botões e título na foto), 2 janela de plug-in+void SecondPhoto(HWND h); // a janela já mudou de tamanho (escondida): foto nova entra por cima, ainda em movimento+void Shown(HWND h); // a janela de verdade reapareceu: as fotos somem+bool Fechar(HWND h, LPARAM bar = 0); // a janela vai sumir: foto dela encolhendo e sumindo, como no Mac (bar: a nossa barra, da DLL)+}+namespace abrir { // janela nova aparecendo como no Mac (abrir.cpp; pedida pela WacOSWindow.dll)+void Open(HWND h, HWND bar = nullptr); // a janela (e a nossa barra, se tiver) escondida e já pintada: anima e manda mostrar+}+namespace foto {+// Foto (BGRA pré-multiplicado, opaca) da parte `src` da janela `h` (coordenadas da miniatura do DWM);+// `corner` > 0: raio (px) dos cantos arredondados. Funciona com a janela minimizada.+bool Window(HWND h, const RECT& src, float corner, std::vector<BYTE>& bgra, UINT& w, UINT& hh);+// Várias janelas de uma vez, na placa de vídeo (Windows.Graphics.Capture), direto em superfícies do+// compositor (dispositivo de ui::Comp()). surf == nullptr na que falhar. Espera até `timeoutMs`.+struct Gpu { IDCompositionSurface* surf = nullptr; UINT w = 0, h = 0; };+std::vector<Gpu> Windows(const std::vector<HWND>& hs, const std::vector<RECT>& srcs, int timeoutMs = 150);+// Capturas que ficam abertas (guardam o último quadro de cada janela): Grab tira as fotos na hora.+struct Live;+Live* Start(const std::vector<HWND>& hs, const std::vector<RECT>& srcs);+std::vector<Gpu> Grab(Live* live, int timeoutMs = 150);+void Stop(Live* live);+}++namespace ponteiro { // ponteiro.cpp: sacudir o mouse faz o ponteiro crescer (como no Mac)+void Start();+void Stop();+// tema Mac OS X Leopard: liga o cursor do Mac OS X (guardando o esquema de antes) ou devolve o de antes+void TemaLeopard(bool on);+void Pausar(bool p); // modo jogo: sem Raw Input do mouse enquanto o jogo roda+}+namespace jogo { // Modo Jogo (jogo.cpp): jogo na frente → desliga o que mais pesa; ajuste modo_jogo, lista %APPDATA%\Shell\jogos.txt+void Start();+void Reload(); // ajustes mudaram+void Foreground(HWND h); // a janela da frente mudou+bool Ativo();+// gancho de EVENT_OBJECT_LOCATIONCHANGE que sai durante o modo jogo (cada movimento do cursor chegava ao Shell)+void GanchoPosicao(WINEVENTPROC fn, DWORD flags);+void SoltarPosicao(WINEVENTPROC fn);+}++namespace leve { // Modo leve (leve.cpp): PC fraco ou na bateria → sem vidro real, fosco mais barato, animações a ~60 quadros/s+void Start(); // vigia tomada/bateria+bool Atualizar(); // relê modo_leve, a bateria e o PC; true = mudou (quem chama recarrega o vidro)+bool Ativo(); // pode ser lido de qualquer thread+}