mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 14:05:58 +01:00
add desc: to getMonitorFromString
This commit is contained in:
parent
76fc12869d
commit
dea71875e4
1 changed files with 14 additions and 4 deletions
|
@ -1809,21 +1809,31 @@ CMonitor* CCompositor::getMonitorFromString(const std::string& name) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (monID > -1 && monID < (int)g_pCompositor->m_vMonitors.size()) {
|
||||
return g_pCompositor->getMonitorFromID(monID);
|
||||
if (monID > -1 && monID < (int)m_vMonitors.size()) {
|
||||
return getMonitorFromID(monID);
|
||||
} else {
|
||||
Debug::log(ERR, "Error in getMonitorFromString: invalid arg 1");
|
||||
return nullptr;
|
||||
}
|
||||
} else if (name.find("desc:") == 0) {
|
||||
const auto DESCRIPTION = name.substr(5);
|
||||
|
||||
for (auto& m : m_vMonitors) {
|
||||
if (m->output->description && std::string(m->output->description).find(DESCRIPTION) == 0) {
|
||||
return m.get();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
} else {
|
||||
if (name == "current")
|
||||
return g_pCompositor->m_pLastMonitor;
|
||||
|
||||
if (isDirection(name)) {
|
||||
const auto PMONITOR = g_pCompositor->getMonitorInDirection(name[0]);
|
||||
const auto PMONITOR = getMonitorInDirection(name[0]);
|
||||
return PMONITOR;
|
||||
} else {
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto& m : m_vMonitors) {
|
||||
if (m->szName == name) {
|
||||
return m.get();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue