A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Issue #38: Siri gets the local date, time and the widget weather with every question
Eternity07062886dc4d2de278
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txtindex f5a3b1c..7017539 100644--- a/docs/registro-mudancas.txt+++ b/docs/registro-mudancas.txt@@ -1894,3 +1894,7 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sem- #68: Ajustes > Central de Controle > "Altura da barra de menus" (Menor -3 pt / Padrão / Maior +6 pt, barra_altura);menubar.cpp BAR_PT soma BarExtra(); main.cpp refaz as barras e a área de trabalho quando muda. Não testado na tela.DESFAZER: reverter o commit e compilar.+[2026-11-24 23:15] Issue #38 (a Siri disse 14:37 quando eram 23:56): siri.cpp Contexto() manda junto com cada pergunta a data+ e a hora locais com o fuso e o tempo da cidade do widget (widgets::ResumoTempo, o mesmo Open-Meteo da mesa), nos+ serviços por HTTP e nos apps locais. Não testado na tela.+ DESFAZER: reverter o commit e rodar build.cmd shell.diff --git a/src/shell/shell.h b/src/shell/shell.hindex 0b20ec6..ee4eb1f 100644--- a/src/shell/shell.h+++ b/src/shell/shell.h@@ -412,7 +412,9 @@ 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)+namespace widgets { // widgets da mesa: Relógio Mundial, Tempo, Relógio, Calendário, Nascer do Sol (widgets.cpp)+// o tempo de agora em uma frase (inglês, para a Siri: issue #38), ou "" se ainda não chegou+std::wstring ResumoTempo();void Create(HINSTANCE hi);std::vector<RECT> Areas(); // onde estão (tela): os ícones da mesa não ficam embaixo delesvoid EditMenu(POINT pt); // "Editar Widgets…": ligar/desligar cada widget (também sem nenhum na tela)diff --git a/src/shell/siri.cpp b/src/shell/siri.cppindex 130e8f1..b3bbab8 100644--- a/src/shell/siri.cpp+++ b/src/shell/siri.cpp@@ -103,9 +103,25 @@ std::wstring Reserva(const std::vector<std::wstring>& lista, const std::wstring&return alt;}+// O que a Siri precisa saber do PC (issue #38: perguntou a hora e ela inventou 14:37 às 23:56): a data e a hora daqui,+// com o fuso, e o tempo da cidade do widget (o mesmo que a mesa mostra). Vai junto com cada pergunta.+std::wstring Contexto() {+ SYSTEMTIME st; GetLocalTime(&st);+ wchar_t data[120] = {}, hora[40] = {};+ GetDateFormatEx(L"en-US", 0, &st, L"dddd, MMMM d, yyyy", data, 120, nullptr);+ GetTimeFormatEx(L"en-US", 0, &st, L"HH:mm", hora, 40);+ TIME_ZONE_INFORMATION tz{}; DWORD z = GetTimeZoneInformation(&tz);+ long bias = -(tz.Bias + (z == TIME_ZONE_ID_DAYLIGHT ? tz.DaylightBias : 0));+ wchar_t b[400];+ swprintf_s(b, L"Current local date and time on the user's PC: %ls, %ls (UTC%c%02ld:%02ld).", data, hora, bias < 0 ? L'-' : L'+', std::labs(bias) / 60, std::labs(bias) % 60);+ std::wstring s = b;+ if (std::wstring t = widgets::ResumoTempo(); !t.empty()) s += L" " + t;+ return s;+}+std::wstring PerguntaCli(const siri::Provedor& pv, const std::wstring& q, bool& erro, int num) {const std::wstring instr = siri::ComInstrucoes(L"Answer briefly and clearly, in the same language as the question, in plain text without Markdown. "- L"Do not run commands or edit files.") + L"\n\nQuestion: ";+ L"Do not run commands or edit files. " + Contexto()) + L"\n\nQuestion: ";DWORD codigo = 0; bool tempo = false;wchar_t tmp[MAX_PATH]; GetTempPathW(MAX_PATH, tmp);std::wstring ultima = std::wstring(tmp) + L"WacOS-Siri\\ultima.txt";@@ -150,7 +166,7 @@ std::wstring Pergunta(const std::wstring& q, bool& erro, int num) {if (!l.empty()) modelo = l[0];}const std::wstring sistema = siri::ComInstrucoes(L"You are Siri inside WacOS, a macOS-style desktop for Windows. Answer briefly and clearly, "- L"in the same language as the question. Use plain text, without Markdown.");+ L"in the same language as the question. Use plain text, without Markdown. " + Contexto());std::wstring cab = siri::Cabecalhos(pv, chave);SecureZeroMemory(chave.data(), chave.size() * sizeof(wchar_t));siri::Resposta r;diff --git a/src/shell/widgets.cpp b/src/shell/widgets.cppindex 2ce5663..b8fa549 100644--- a/src/shell/widgets.cpp+++ b/src/shell/widgets.cpp@@ -62,7 +62,25 @@ std::mutex g_mx;Weather g_wx;std::atomic<bool> g_fetching{ false };-std::wstring City() { static cidade::Padrao def; return shell::Setting(L"tempoCidade", def.nome.c_str()); } // sem cidade: a do fuso do Windows+std::wstring City() { static cidade::Padrao def; return shell::Setting(L"tempoCidade", def.nome.c_str()); } // sem cidade: a do fuso do Windows+} // namespace++// Para a Siri (issue #38: ela não sabia nada do PC): a condição do código WMO do Open-Meteo, em inglês (o modelo responde+// no idioma da pergunta)+std::wstring widgets::ResumoTempo() {+ Weather w;+ { std::lock_guard<std::mutex> lk(g_mx); w = g_wx; }+ if (!w.ok) return L"";+ int c = w.code;+ const wchar_t* cond = c == 0 ? L"clear sky" : c <= 2 ? L"partly cloudy" : c == 3 ? L"overcast" : c <= 48 ? L"fog"+ : c <= 57 ? L"drizzle" : c <= 67 ? L"rain" : c <= 77 ? L"snow" : c <= 82 ? L"rain showers"+ : c <= 86 ? L"snow showers" : L"thunderstorm";+ wchar_t b[300];+ swprintf_s(b, L"Weather now in %ls: %.0f°C, %ls; today's high %.0f°C, low %.0f°C.", City().c_str(), w.temp, cond, w.hi, w.lo);+ return b;+}++namespace {std::string Section(const std::string& j, const char* key) {size_t p = j.find(std::string("\"") + key + "\":{");