Add monitor disabled option

This commit is contained in:
vaxerski 2022-04-17 10:19:46 +02:00
parent 2118628d58
commit 4a966c945b
3 changed files with 19 additions and 3 deletions

View File

@ -142,6 +142,14 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
nextItem();
if (curitem == "disable") {
newrule.disabled = true;
m_dMonitorRules.push_back(newrule);
return;
}
newrule.resolution.x = stoi(curitem.substr(0, curitem.find_first_of('x')));
newrule.resolution.y = stoi(curitem.substr(curitem.find_first_of('x') + 1, curitem.find_first_of('@')));

View File

@ -26,6 +26,7 @@ struct SMonitorRule {
float scale = 1;
float refreshRate = 60;
int defaultWorkspaceID = -1;
bool disabled = false;
};
struct SWindowRule {

View File

@ -45,6 +45,16 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
// new monitor added, let's accomodate for that.
const auto OUTPUT = (wlr_output*)data;
// get monitor rule that matches
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(OUTPUT->name);
// if it's disabled, disable and ignore
if (monitorRule.disabled) {
wlr_output_enable(OUTPUT, 0);
wlr_output_commit(OUTPUT);
return;
}
SMonitor newMonitor;
newMonitor.output = OUTPUT;
newMonitor.ID = g_pCompositor->m_lMonitors.size();
@ -52,9 +62,6 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
// get monitor rule that matches
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(OUTPUT->name);
wlr_output_set_scale(OUTPUT, monitorRule.scale);
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale);
wlr_output_set_transform(OUTPUT, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms