mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-12 21:05:58 +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;
|
||||
}
|
||||
|
||||
SMonitorRule CConfigManager::getMonitorRuleFor(std::string name) {
|
||||
SMonitorRule CConfigManager::getMonitorRuleFor(std::string name, std::string displayName) {
|
||||
SMonitorRule* found = nullptr;
|
||||
|
||||
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());
|
||||
|
||||
for (auto& r : m_dMonitorRules) {
|
||||
if (r.name == "") {
|
||||
if (r.name == "" || (r.name.find("desc:") == 0 && r.name.substr(5) == displayName)) {
|
||||
found = &r;
|
||||
break;
|
||||
}
|
||||
|
@ -1424,7 +1424,7 @@ void CConfigManager::performMonitorReload() {
|
|||
bool overAgain = false;
|
||||
|
||||
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
|
||||
m->setMirror(rule.mirrorOf);
|
||||
|
@ -1477,7 +1477,7 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
|||
|
||||
void CConfigManager::ensureDPMS() {
|
||||
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) {
|
||||
rm->m_pThisWrap = &rm;
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
SConfigValue* getConfigValuePtr(std::string);
|
||||
SConfigValue* getConfigValuePtrSafe(std::string);
|
||||
|
||||
SMonitorRule getMonitorRuleFor(std::string);
|
||||
SMonitorRule getMonitorRuleFor(std::string, std::string displayName = "");
|
||||
|
||||
CMonitor* getBoundMonitorForWS(std::string);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
|||
R"#({
|
||||
"id": %i,
|
||||
"name": "%s",
|
||||
"description": "%s",
|
||||
"width": %i,
|
||||
"height": %i,
|
||||
"refreshRate": %f,
|
||||
|
@ -39,6 +40,7 @@ R"#({
|
|||
},)#",
|
||||
m->ID,
|
||||
escapeJSONStrings(m->szName).c_str(),
|
||||
escapeJSONStrings(m->output->description ? m->output->description : ""),
|
||||
(int)m->vecPixelSize.x, (int)m->vecPixelSize.y,
|
||||
m->refreshRate,
|
||||
(int)m->vecPosition.x, (int)m->vecPosition.y,
|
||||
|
@ -56,8 +58,8 @@ R"#({
|
|||
result += "]";
|
||||
} else {
|
||||
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",
|
||||
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"));
|
||||
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->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;
|
||||
|
||||
// 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_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this);
|
||||
|
@ -297,7 +297,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
|||
pMirrorOf = nullptr;
|
||||
|
||||
// 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;
|
||||
|
||||
|
|
|
@ -1332,7 +1332,7 @@ void CKeybindManager::forceRendererReload(std::string args) {
|
|||
bool overAgain = false;
|
||||
|
||||
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)) {
|
||||
overAgain = true;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue