From e1829230afb78a9b097e25f29c828b427051fafc Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 15 Apr 2016 12:41:23 -0400 Subject: Fix up lumina-xconfig so it works better with multiple (3+) monitors and custom settings. --- lumina-xconfig/MainUI.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++----- lumina-xconfig/MainUI.h | 2 ++ 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/lumina-xconfig/MainUI.cpp b/lumina-xconfig/MainUI.cpp index d2216fa7..f4aa1c49 100644 --- a/lumina-xconfig/MainUI.cpp +++ b/lumina-xconfig/MainUI.cpp @@ -48,6 +48,24 @@ void MainUI::loadIcons(){ ui->tool_applyconfig->setIcon( LXDG::findIcon("dialog-ok-apply","") ); } +QStringList MainUI::currentOpts(){ + //Read all the settings and create the xrandr options to maintain these settings + QStringList opts; + for(int i=0; i 0){ + //Get the ID of the previous screen + QString id; + for(int j=0; jlist_screens->currentItem(); if(item!=0){ @@ -190,8 +208,16 @@ void MainUI::MoveScreenLeft(){ item = ui->list_screens->item( ui->list_screens->row(item)-1 ); if(item == 0){ return; } //no item on the left (can't go left) QString LID = item->whatsThis(); //left ID + //Adjust the order of the two screens + for(int i=0; ilist_screens->item( ui->list_screens->row(item)+1 ); if(item == 0){ return; } //no item on the right (can't go right) QString RID = item->whatsThis(); //right ID + //Adjust the order of the two screens + for(int i=0; iwhatsThis(); } if(device.isEmpty()){ return; } //nothing found - LUtils::runCmd("xrandr", QStringList() << "--output" << device << "--off"); + //Remove the screen from the settings + for(int i=0; icombo_cscreens->currentText(); QString loc = ui->combo_location->currentData().toString(); if(ID.isEmpty() || DID.isEmpty() || loc.isEmpty()){ return; } //invalid inputs - LUtils::runCmd("xrandr", QStringList() << "--output" << ID << loc << DID <<"--auto"); + QStringList opts = currentOpts(); + opts << "--output" << ID << loc << DID <<"--auto"; + //qDebug() << "Activate Options:" << opts; + LUtils::runCmd("xrandr", opts ); QTimer::singleShot(500, this, SLOT(UpdateScreens()) ); } void MainUI::ApplyChanges(){ + //NOTE: need to re-specifiy the QListWidgetItem *it = ui->list_screens->currentItem(); if(it==0){ return; } //nothing to do QString newres = ui->combo_resolution->currentData().toString(); if(newres.isEmpty()){ return; } //nothing to do - qDebug() << "Apply Screen Changes" << it->whatsThis() << "->" << newres; - LUtils::runCmd("xrandr", QStringList() << "--output" << it->whatsThis() << "--mode" << newres); + //qDebug() << "Apply Screen Changes" << it->whatsThis() << "->" << newres; + //Adjust the order of the two screens + for(int i=0; iwhatsThis()){ + SCREENS[i].geom.setWidth(newres.section("x",0,0).toInt()); + SCREENS[i].geom.setHeight(newres.section("x",1,1).toInt()); + } + } + //Now run the command + QStringList opts = currentOpts(); + LUtils::runCmd("xrandr", opts); QTimer::singleShot(500, this, SLOT(UpdateScreens()) ); } \ No newline at end of file diff --git a/lumina-xconfig/MainUI.h b/lumina-xconfig/MainUI.h index 363cf257..0563c4ca 100644 --- a/lumina-xconfig/MainUI.h +++ b/lumina-xconfig/MainUI.h @@ -46,6 +46,8 @@ private: QList SCREENS; ScreenInfo currentScreenInfo(); + QStringList currentOpts(); + private slots: void UpdateScreens(); void ScreenSelected(); -- cgit