Skip to content

armgit / WacOS

Public Imported from GitHub
0

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

Rust

Don't show notification banners over full-screen games and videos

Eternity070628171d5177dd39
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index a8a3a63..1124938 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -601,6 +601,18 @@ static bool IsFullscreen(HWND fg) {
return r.left <= mi.rcMonitor.left && r.top <= mi.rcMonitor.top && r.right >= mi.rcMonitor.right && r.bottom >= mi.rcMonitor.bottom;
}
+// Jogo/vídeo em tela cheia no monitor `mon` (ou o Windows em modo "não incomodar": Direct3D exclusivo,
+// apresentação): os banners de notificação não aparecem, só vão para a Central. Uma janela "sempre no topo" por cima
+// do jogo tirava ele da tela cheia (17/11/2026, Fortnite caindo a cada notificação).
+bool shell::NaoIncomodar(HMONITOR mon) {
+ QUERY_USER_NOTIFICATION_STATE q{};
+ if (SUCCEEDED(SHQueryUserNotificationState(&q)) && (q == QUNS_RUNNING_D3D_FULL_SCREEN || q == QUNS_PRESENTATION_MODE || q == QUNS_BUSY))
+ return true;
+ HWND fg = GetForegroundWindow();
+ if (!IsFullscreen(fg)) return false;
+ return !mon || MonitorFromWindow(fg, MONITOR_DEFAULTTONEAREST) == mon;
+}
+
// Com mais de um monitor, só some o que está no monitor do app em tela cheia (a barra daquele monitor; o Dock
// se ele estiver lá). Tela travada: tudo some.
static void CheckFullscreen() {
diff --git a/src/shell/notificacoes.cpp b/src/shell/notificacoes.cpp
index 9c91027..fc67b0b 100644
--- a/src/shell/notificacoes.cpp
+++ b/src/shell/notificacoes.cpp
@@ -1381,6 +1381,8 @@ void ChecarAvisos() {
}
void BannerShowNote(const Note& n) {
+ // jogo ou vídeo em tela cheia no monitor do banner: sem banner (ela fica na Central), senão o jogo sai da tela cheia
+ if (shell::NaoIncomodar(MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY))) { Log(L"notificação: banner calado (app em tela cheia)"); return; }
if (g_open || g_closing || !BannersOn() || !g_bwnd) return;
bool wasIn = g_bshow && !g_bout;
g_bnote = n;
diff --git a/src/shell/shell.h b/src/shell/shell.h
index f1ff513..00efa66 100644
--- a/src/shell/shell.h
+++ b/src/shell/shell.h
@@ -549,6 +549,7 @@ 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);
+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"