mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 18:26:00 +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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monID > -1 && monID < (int)g_pCompositor->m_vMonitors.size()) {
|
if (monID > -1 && monID < (int)m_vMonitors.size()) {
|
||||||
return g_pCompositor->getMonitorFromID(monID);
|
return getMonitorFromID(monID);
|
||||||
} else {
|
} else {
|
||||||
Debug::log(ERR, "Error in getMonitorFromString: invalid arg 1");
|
Debug::log(ERR, "Error in getMonitorFromString: invalid arg 1");
|
||||||
return nullptr;
|
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 {
|
} else {
|
||||||
if (name == "current")
|
if (name == "current")
|
||||||
return g_pCompositor->m_pLastMonitor;
|
return g_pCompositor->m_pLastMonitor;
|
||||||
|
|
||||||
if (isDirection(name)) {
|
if (isDirection(name)) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorInDirection(name[0]);
|
const auto PMONITOR = getMonitorInDirection(name[0]);
|
||||||
return PMONITOR;
|
return PMONITOR;
|
||||||
} else {
|
} else {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->szName == name) {
|
if (m->szName == name) {
|
||||||
return m.get();
|
return m.get();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue