mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 04:29:48 +01:00
add desc: to monitor rules
This commit is contained in:
parent
9153a81090
commit
71e2562a41
5 changed files with 12 additions and 10 deletions
|
@ -1296,7 +1296,7 @@ void CConfigManager::setString(std::string v, std::string val) {
|
||||||
configValues[v].strValue = val;
|
configValues[v].strValue = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMonitorRule CConfigManager::getMonitorRuleFor(std::string name) {
|
SMonitorRule CConfigManager::getMonitorRuleFor(std::string name, std::string displayName) {
|
||||||
SMonitorRule* found = nullptr;
|
SMonitorRule* found = nullptr;
|
||||||
|
|
||||||
for (auto& r : m_dMonitorRules) {
|
for (auto& r : m_dMonitorRules) {
|
||||||
|
@ -1312,7 +1312,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(std::string name) {
|
||||||
Debug::log(WARN, "No rule found for %s, trying to use the first.", name.c_str());
|
Debug::log(WARN, "No rule found for %s, trying to use the first.", name.c_str());
|
||||||
|
|
||||||
for (auto& r : m_dMonitorRules) {
|
for (auto& r : m_dMonitorRules) {
|
||||||
if (r.name == "") {
|
if (r.name == "" || (r.name.find("desc:") == 0 && r.name.substr(5) == displayName)) {
|
||||||
found = &r;
|
found = &r;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1424,7 +1424,7 @@ void CConfigManager::performMonitorReload() {
|
||||||
bool overAgain = false;
|
bool overAgain = false;
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||||
auto rule = getMonitorRuleFor(m->szName);
|
auto rule = getMonitorRuleFor(m->szName, m->output->description ? m->output->description : "");
|
||||||
|
|
||||||
// ensure mirror
|
// ensure mirror
|
||||||
m->setMirror(rule.mirrorOf);
|
m->setMirror(rule.mirrorOf);
|
||||||
|
@ -1477,7 +1477,7 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
||||||
|
|
||||||
void CConfigManager::ensureDPMS() {
|
void CConfigManager::ensureDPMS() {
|
||||||
for (auto& rm : g_pCompositor->m_vRealMonitors) {
|
for (auto& rm : g_pCompositor->m_vRealMonitors) {
|
||||||
auto rule = getMonitorRuleFor(rm->szName);
|
auto rule = getMonitorRuleFor(rm->szName, rm->output->description ? rm->output->description : "");
|
||||||
|
|
||||||
if (rule.disabled == rm->m_bEnabled) {
|
if (rule.disabled == rm->m_bEnabled) {
|
||||||
rm->m_pThisWrap = &rm;
|
rm->m_pThisWrap = &rm;
|
||||||
|
|
|
@ -135,7 +135,7 @@ public:
|
||||||
SConfigValue* getConfigValuePtr(std::string);
|
SConfigValue* getConfigValuePtr(std::string);
|
||||||
SConfigValue* getConfigValuePtrSafe(std::string);
|
SConfigValue* getConfigValuePtrSafe(std::string);
|
||||||
|
|
||||||
SMonitorRule getMonitorRuleFor(std::string);
|
SMonitorRule getMonitorRuleFor(std::string, std::string displayName = "");
|
||||||
|
|
||||||
CMonitor* getBoundMonitorForWS(std::string);
|
CMonitor* getBoundMonitorForWS(std::string);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
||||||
R"#({
|
R"#({
|
||||||
"id": %i,
|
"id": %i,
|
||||||
"name": "%s",
|
"name": "%s",
|
||||||
|
"description": "%s",
|
||||||
"width": %i,
|
"width": %i,
|
||||||
"height": %i,
|
"height": %i,
|
||||||
"refreshRate": %f,
|
"refreshRate": %f,
|
||||||
|
@ -39,6 +40,7 @@ R"#({
|
||||||
},)#",
|
},)#",
|
||||||
m->ID,
|
m->ID,
|
||||||
escapeJSONStrings(m->szName).c_str(),
|
escapeJSONStrings(m->szName).c_str(),
|
||||||
|
escapeJSONStrings(m->output->description ? m->output->description : ""),
|
||||||
(int)m->vecPixelSize.x, (int)m->vecPixelSize.y,
|
(int)m->vecPixelSize.x, (int)m->vecPixelSize.y,
|
||||||
m->refreshRate,
|
m->refreshRate,
|
||||||
(int)m->vecPosition.x, (int)m->vecPosition.y,
|
(int)m->vecPosition.x, (int)m->vecPosition.y,
|
||||||
|
@ -56,8 +58,8 @@ R"#({
|
||||||
result += "]";
|
result += "]";
|
||||||
} else {
|
} else {
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\tscale: %.2f\n\ttransform: %i\n\tfocused: %s\n\n",
|
result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tdescription: %s\n\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\tscale: %.2f\n\ttransform: %i\n\tfocused: %s\n\n",
|
||||||
m->szName.c_str(), m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->activeWorkspace, g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName.c_str(), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"));
|
m->szName.c_str(), m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, (m->output->description ? m->output->description : ""), m->activeWorkspace, g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName.c_str(), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ void CMonitor::onConnect(bool noRule) {
|
||||||
szName = output->name;
|
szName = output->name;
|
||||||
|
|
||||||
// get monitor rule that matches
|
// get monitor rule that matches
|
||||||
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name);
|
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name, output->description ? output->description : "");
|
||||||
|
|
||||||
hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this);
|
hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this);
|
||||||
hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this);
|
hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this);
|
||||||
|
@ -297,7 +297,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
||||||
pMirrorOf = nullptr;
|
pMirrorOf = nullptr;
|
||||||
|
|
||||||
// set rule
|
// set rule
|
||||||
const auto RULE = g_pConfigManager->getMonitorRuleFor(this->szName);
|
const auto RULE = g_pConfigManager->getMonitorRuleFor(this->szName, this->output->description ? this->output->description : "");
|
||||||
|
|
||||||
vecPosition = RULE.offset;
|
vecPosition = RULE.offset;
|
||||||
|
|
||||||
|
|
|
@ -1332,7 +1332,7 @@ void CKeybindManager::forceRendererReload(std::string args) {
|
||||||
bool overAgain = false;
|
bool overAgain = false;
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
auto rule = g_pConfigManager->getMonitorRuleFor(m->szName);
|
auto rule = g_pConfigManager->getMonitorRuleFor(m->szName, m->output->description ? m->output->description : "");
|
||||||
if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule, true)) {
|
if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule, true)) {
|
||||||
overAgain = true;
|
overAgain = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue