Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: allow mon description for monitor value #216

Merged
merged 2 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/core/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ static void handleName(void* data, wl_output* output, const char* name) {
}

static void handleDescription(void* data, wl_output* output, const char* description) {
const auto POUTPUT = (COutput*)data;
Debug::log(LOG, "output {} description {}", POUTPUT->name, description ? description : "");
const auto POUTPUT = (COutput*)data;
POUTPUT->stringDesc = description ? std::string{description} : "";
Debug::log(LOG, "output {} description {}", POUTPUT->name, POUTPUT->stringDesc);
}

static const wl_output_listener outputListener = {
Expand All @@ -61,4 +62,4 @@ static const wl_output_listener outputListener = {

COutput::COutput(wl_output* output, uint32_t name) : name(name), output(output) {
wl_output_add_listener(output, &outputListener, this);
}
}
3 changes: 2 additions & 1 deletion src/core/Output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class COutput {
int scale = 1;
std::string stringName = "";
std::string stringPort = "";
std::string stringDesc = "";

std::unique_ptr<CSessionLockSurface> sessionLockSurface;

wl_output* output = nullptr;

private:
};
};
5 changes: 3 additions & 2 deletions src/renderer/AsyncResourceGatherer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ CAsyncResourceGatherer::CAsyncResourceGatherer() {
}

for (auto& mon : mons) {
const auto MON = std::find_if(g_pHyprlock->m_vOutputs.begin(), g_pHyprlock->m_vOutputs.end(), [mon](const auto& other) { return other->stringPort == mon; });
const auto MON = std::find_if(g_pHyprlock->m_vOutputs.begin(), g_pHyprlock->m_vOutputs.end(),
[mon](const auto& other) { return other->stringPort == mon || other->stringDesc.starts_with(mon); });

if (MON == g_pHyprlock->m_vOutputs.end())
continue;
Expand All @@ -65,7 +66,7 @@ void CAsyncResourceGatherer::recheckDMAFramesFor(COutput* output) {
if (std::string{std::any_cast<Hyprlang::STRING>(c.values.at("path"))} != "screenshot")
continue;

if (c.monitor.empty() || c.monitor == output->stringPort) {
if (c.monitor.empty() || c.monitor == output->stringPort || output->stringDesc.starts_with(c.monitor)) {
shouldMake = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ std::vector<std::unique_ptr<IWidget>>* CRenderer::getOrCreateWidgetsFor(const CS
const auto CWIDGETS = g_pConfigManager->getWidgetConfigs();

for (auto& c : CWIDGETS) {
if (!c.monitor.empty() && c.monitor != surf->output->stringPort)
if (!c.monitor.empty() && c.monitor != surf->output->stringPort && !surf->output->stringDesc.starts_with(c.monitor))
continue;

// by type
Expand Down
Loading