diff options
author | vaxerski <[email protected]> | 2023-03-18 01:33:48 +0000 |
---|---|---|
committer | vaxerski <[email protected]> | 2023-03-18 01:34:06 +0000 |
commit | 6e6971606d9613f6b5aa1df9ecf68327d079c2cc (patch) | |
tree | 458b32dd9aba0f623ae647329d190393fb446b7a | |
parent | e5ad53ac4242a5ee0b536bdd2c368ef8171d894d (diff) | |
download | Hyprland-6e6971606d9613f6b5aa1df9ecf68327d079c2cc.tar.gz Hyprland-6e6971606d9613f6b5aa1df9ecf68327d079c2cc.zip |
windowrules: allow monitor by str
-rw-r--r-- | src/events/Windows.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 5b96d279..be75dfd9 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -125,11 +125,21 @@ void Events::listener_mapWindow(void* owner, void* data) { if (MONITORSTR == "unset") { PWINDOW->m_iMonitorID = PMONITOR->ID; } else { - const long int MONITOR = std::stoi(MONITORSTR); - if (!g_pCompositor->getMonitorFromID(MONITOR)) - PWINDOW->m_iMonitorID = 0; - else - PWINDOW->m_iMonitorID = MONITOR; + if (isNumber(MONITORSTR)) { + const long int MONITOR = std::stoi(MONITORSTR); + if (!g_pCompositor->getMonitorFromID(MONITOR)) + PWINDOW->m_iMonitorID = 0; + else + PWINDOW->m_iMonitorID = MONITOR; + } else { + const auto PMONITOR = g_pCompositor->getMonitorFromName(MONITORSTR); + if (PMONITOR) + PWINDOW->m_iMonitorID = PMONITOR->ID; + else { + Debug::log(ERR, "No monitor in monitor %s rule", MONITORSTR.c_str()); + continue; + } + } } PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace; |