compositor: check for monitor layout issues post rule apply

fixes #12108
This commit is contained in:
Vaxry 2025-10-26 13:52:09 +00:00
parent 748d2f656e
commit 05aa4e1c54
No known key found for this signature in database
GPG key ID: 665806380871D640
3 changed files with 37 additions and 3 deletions

View file

@ -2842,6 +2842,38 @@ PHLWINDOW CCompositor::getForceFocus() {
return nullptr;
}
void CCompositor::scheduleMonitorStateRecheck() {
static bool scheduled = false;
if (!scheduled) {
scheduled = true;
g_pEventLoopManager->doLater([this] {
arrangeMonitors();
checkMonitorOverlaps();
scheduled = false;
});
}
}
void CCompositor::checkMonitorOverlaps() {
CRegion monitorRegion;
for (const auto& m : m_monitors) {
if (!monitorRegion.copy().intersect(m->logicalBox()).empty()) {
Debug::log(ERR, "Monitor {}: detected overlap with layout", m->m_name);
g_pHyprNotificationOverlay->addNotification(std::format("Your monitor layout is set up incorrectly. Monitor {} overlaps with other monitor(s) in the "
"layout.\nPlease see the wiki (Monitors page) for more. This will cause issues.",
m->m_name),
CHyprColor{}, 15000, ICON_WARNING);
break;
}
monitorRegion.add(m->logicalBox());
}
}
void CCompositor::arrangeMonitors() {
static auto* const PXWLFORCESCALEZERO = rc<Hyprlang::INT* const*>(g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling"));