diff options
-rw-r--r-- | port-files/pkg-plist | 63 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/MainUI.cpp | 18 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/MainUI.h | 12 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/MainUI.ui | 13 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/lumina-xconfig.pro | 6 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-xconfig/main.cpp | 16 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaX11.h | 14 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/main.cpp | 4 |
8 files changed, 114 insertions, 32 deletions
diff --git a/port-files/pkg-plist b/port-files/pkg-plist index 4dd64830..0c983ff1 100644 --- a/port-files/pkg-plist +++ b/port-files/pkg-plist @@ -7,6 +7,7 @@ bin/lumina-search bin/lumina-info bin/lumina-xconfig bin/lumina-fileinfo +bin/lumina-textedit etc/luminaDesktop.conf.dist lib/libLuminaUtils.so lib/libLuminaUtils.so.1 @@ -426,6 +427,68 @@ share/Lumina-DE/i18n/lumina-search_zh_CN.qm share/Lumina-DE/i18n/lumina-search_zh_HK.qm share/Lumina-DE/i18n/lumina-search_zh_TW.qm share/Lumina-DE/i18n/lumina-search_zu.qm +share/Lumina-DE/i18n/lumina-textedit_af.qm +share/Lumina-DE/i18n/lumina-textedit_ar.qm +share/Lumina-DE/i18n/lumina-textedit_az.qm +share/Lumina-DE/i18n/lumina-textedit_bg.qm +share/Lumina-DE/i18n/lumina-textedit_bn.qm +share/Lumina-DE/i18n/lumina-textedit_bs.qm +share/Lumina-DE/i18n/lumina-textedit_ca.qm +share/Lumina-DE/i18n/lumina-textedit_cs.qm +share/Lumina-DE/i18n/lumina-textedit_cy.qm +share/Lumina-DE/i18n/lumina-textedit_da.qm +share/Lumina-DE/i18n/lumina-textedit_de.qm +share/Lumina-DE/i18n/lumina-textedit_el.qm +share/Lumina-DE/i18n/lumina-textedit_en_GB.qm +share/Lumina-DE/i18n/lumina-textedit_en_ZA.qm +share/Lumina-DE/i18n/lumina-textedit_es.qm +share/Lumina-DE/i18n/lumina-textedit_et.qm +share/Lumina-DE/i18n/lumina-textedit_eu.qm +share/Lumina-DE/i18n/lumina-textedit_fa.qm +share/Lumina-DE/i18n/lumina-textedit_fi.qm +share/Lumina-DE/i18n/lumina-textedit_fr.qm +share/Lumina-DE/i18n/lumina-textedit_fr_CA.qm +share/Lumina-DE/i18n/lumina-textedit_gl.qm +share/Lumina-DE/i18n/lumina-textedit_he.qm +share/Lumina-DE/i18n/lumina-textedit_hi.qm +share/Lumina-DE/i18n/lumina-textedit_hr.qm +share/Lumina-DE/i18n/lumina-textedit_hu.qm +share/Lumina-DE/i18n/lumina-textedit_id.qm +share/Lumina-DE/i18n/lumina-textedit_is.qm +share/Lumina-DE/i18n/lumina-textedit_it.qm +share/Lumina-DE/i18n/lumina-textedit_ja.qm +share/Lumina-DE/i18n/lumina-textedit_ka.qm +share/Lumina-DE/i18n/lumina-textedit_ko.qm +share/Lumina-DE/i18n/lumina-textedit_lt.qm +share/Lumina-DE/i18n/lumina-textedit_lv.qm +share/Lumina-DE/i18n/lumina-textedit_mk.qm +share/Lumina-DE/i18n/lumina-textedit_mn.qm +share/Lumina-DE/i18n/lumina-textedit_ms.qm +share/Lumina-DE/i18n/lumina-textedit_mt.qm +share/Lumina-DE/i18n/lumina-textedit_nb.qm +share/Lumina-DE/i18n/lumina-textedit_nl.qm +share/Lumina-DE/i18n/lumina-textedit_pa.qm +share/Lumina-DE/i18n/lumina-textedit_pl.qm +share/Lumina-DE/i18n/lumina-textedit_pt.qm +share/Lumina-DE/i18n/lumina-textedit_pt_BR.qm +share/Lumina-DE/i18n/lumina-textedit_ro.qm +share/Lumina-DE/i18n/lumina-textedit_ru.qm +share/Lumina-DE/i18n/lumina-textedit_sk.qm +share/Lumina-DE/i18n/lumina-textedit_sl.qm +share/Lumina-DE/i18n/lumina-textedit_sr.qm +share/Lumina-DE/i18n/lumina-textedit_sv.qm +share/Lumina-DE/i18n/lumina-textedit_sw.qm +share/Lumina-DE/i18n/lumina-textedit_ta.qm +share/Lumina-DE/i18n/lumina-textedit_tg.qm +share/Lumina-DE/i18n/lumina-textedit_th.qm +share/Lumina-DE/i18n/lumina-textedit_tr.qm +share/Lumina-DE/i18n/lumina-textedit_uk.qm +share/Lumina-DE/i18n/lumina-textedit_uz.qm +share/Lumina-DE/i18n/lumina-textedit_vi.qm +share/Lumina-DE/i18n/lumina-textedit_zh_CN.qm +share/Lumina-DE/i18n/lumina-textedit_zh_HK.qm +share/Lumina-DE/i18n/lumina-textedit_zh_TW.qm +share/Lumina-DE/i18n/lumina-textedit_zu.qm share/Lumina-DE/i18n/lumina-info_af.qm share/Lumina-DE/i18n/lumina-info_ar.qm share/Lumina-DE/i18n/lumina-info_az.qm diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp index f4aa1c49..2aed4d30 100644 --- a/src-qt5/core-utils/lumina-xconfig/MainUI.cpp +++ b/src-qt5/core-utils/lumina-xconfig/MainUI.cpp @@ -54,6 +54,7 @@ QStringList MainUI::currentOpts(){ for(int i=0; i<SCREENS.length(); i++){ if(SCREENS[i].order <0){ continue; } //skip this screen - non-active opts << "--output" << SCREENS[i].ID << "--mode" << QString::number(SCREENS[i].geom.width())+"x"+QString::number(SCREENS[i].geom.height()); + if(SCREENS[i].isprimary){ opts << "--primary"; } if(SCREENS[i].order > 0){ //Get the ID of the previous screen QString id; @@ -79,8 +80,8 @@ ScreenInfo MainUI::currentScreenInfo(){ void MainUI::UpdateScreens(){ //First probe the server for current screens - SCREENS.clear(); - QStringList info = LUtils::getCmdOutput("xrandr -q"); + SCREENS = RRSettings::CurrentScreens(); + /*QStringList info = LUtils::getCmdOutput("xrandr -q"); ScreenInfo cscreen; for(int i=0; i<info.length(); i++){ if(info[i].contains("connected") ){ @@ -105,6 +106,7 @@ void MainUI::UpdateScreens(){ UpdateScreens(); return; }else if( !devres.isEmpty() ){ + cscreen.isprimary = info[i].contains(" primary "); //Device that is connected and attached (has a resolution) qDebug() << "Create new Screen entry:" << dev << devres; cscreen.ID = dev; @@ -121,9 +123,9 @@ void MainUI::UpdateScreens(){ //available resolution for a device cscreen.resList << info[i].section("\t",0,0,QString::SectionSkipEmpty); } - } + } //end loop over info lines if(!cscreen.ID.isEmpty()){ SCREENS << cscreen; } //make sure to add the last screen to the array - + */ //Now go through the screens and arrange them in order from left->right in the UI bool found = true; int xoffset = 0; //start at 0 @@ -138,7 +140,7 @@ void MainUI::UpdateScreens(){ else if(SCREENS[i].geom.x()==xoffset){ found = true; //make sure to look for the next one xoffset = xoffset+SCREENS[i].geom.width(); //next number to look for - SCREENS[i].order = cnum; //assign the currrent order to it + SCREENS[i].order = cnum; //assign the current order to it cnum++; //get ready for the next one QListWidgetItem *it = new QListWidgetItem(); it->setTextAlignment(Qt::AlignCenter); @@ -170,6 +172,7 @@ void MainUI::UpdateScreens(){ } if(ui->list_screens->currentItem()==0){ ui->list_screens->setCurrentRow(0); } ScreenSelected(); //update buttons + RRSettings::SaveScreens(SCREENS); } void MainUI::ScreenSelected(){ @@ -196,6 +199,7 @@ void MainUI::ScreenSelected(){ else{ui->combo_resolution->addItem(res, res); } if(cur.resList[i].contains(cres)){ ui->combo_resolution->setCurrentIndex(i); } } + ui->check_primary->setChecked( cur.isprimary ); } } @@ -282,14 +286,16 @@ void MainUI::ApplyChanges(){ if(newres.isEmpty()){ return; } //nothing to do //qDebug() << "Apply Screen Changes" << it->whatsThis() << "->" << newres; //Adjust the order of the two screens + bool setprimary = ui->check_primary->isChecked(); for(int i=0; i<SCREENS.length(); i++){ if(SCREENS[i].ID == it->whatsThis()){ SCREENS[i].geom.setWidth(newres.section("x",0,0).toInt()); SCREENS[i].geom.setHeight(newres.section("x",1,1).toInt()); } + if(setprimary){ SCREENS[i].isprimary = SCREENS[i].ID==it->whatsThis(); } } //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/src-qt5/core-utils/lumina-xconfig/MainUI.h b/src-qt5/core-utils/lumina-xconfig/MainUI.h index 0563c4ca..b8be8701 100644 --- a/src-qt5/core-utils/lumina-xconfig/MainUI.h +++ b/src-qt5/core-utils/lumina-xconfig/MainUI.h @@ -12,17 +12,7 @@ #include <QString> #include <QList> -class ScreenInfo{ - public: - QString ID; - QRect geom; //screen geometry - int order; //left to right - QStringList resList; - ScreenInfo(){ - order = -1; //initial value is invalid - } - ~ScreenInfo(){} -}; +#include "ScreenSettings.h" namespace Ui{ class MainUI; diff --git a/src-qt5/core-utils/lumina-xconfig/MainUI.ui b/src-qt5/core-utils/lumina-xconfig/MainUI.ui index c1c4b614..de1cc18d 100644 --- a/src-qt5/core-utils/lumina-xconfig/MainUI.ui +++ b/src-qt5/core-utils/lumina-xconfig/MainUI.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>408</width> - <height>316</height> + <height>321</height> </rect> </property> <property name="windowTitle"> @@ -142,7 +142,7 @@ </item> </layout> </item> - <item row="1" column="1"> + <item row="2" column="1"> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -155,7 +155,7 @@ </property> </spacer> </item> - <item row="2" column="1"> + <item row="3" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_4"> <item> <spacer name="horizontalSpacer_2"> @@ -182,6 +182,13 @@ </item> </layout> </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="check_primary"> + <property name="text"> + <string>Primary Screen</string> + </property> + </widget> + </item> </layout> </widget> <widget class="QWidget" name="tab_new"> diff --git a/src-qt5/core-utils/lumina-xconfig/lumina-xconfig.pro b/src-qt5/core-utils/lumina-xconfig/lumina-xconfig.pro index 676f237c..2661c19b 100644 --- a/src-qt5/core-utils/lumina-xconfig/lumina-xconfig.pro +++ b/src-qt5/core-utils/lumina-xconfig/lumina-xconfig.pro @@ -9,9 +9,11 @@ target.path = $${L_BINDIR} TEMPLATE = app SOURCES += main.cpp \ - mainUI.cpp + mainUI.cpp \ + ScreenSettings.cpp -HEADERS += mainUI.h +HEADERS += mainUI.h \ + ScreenSettings.h FORMS += mainUI.ui diff --git a/src-qt5/core-utils/lumina-xconfig/main.cpp b/src-qt5/core-utils/lumina-xconfig/main.cpp index 699665fb..f30486f4 100644 --- a/src-qt5/core-utils/lumina-xconfig/main.cpp +++ b/src-qt5/core-utils/lumina-xconfig/main.cpp @@ -9,20 +9,18 @@ #include <LuminaUtils.h> #include <LuminaSingleApplication.h> +#include "ScreenSettings.h" int main(int argc, char ** argv) { - /*QStringList in; + bool CLIdone = false; for(int i=1; i<argc; i++){ //skip the first arg (app binary) - QString path = argv[i]; - if(path=="."){ - //Insert the current working directory - in << QDir::currentPath(); - }else{ - if(!path.startsWith("/")){ path.prepend(QDir::currentPath()+"/"); } - in << path; + if(QString(argv[i]) == "--reset-monitors"){ + RRSettings::ApplyPrevious(); + CLIdone = true; + break; } } - if(in.isEmpty()){ in << QDir::homePath(); }*/ + if(CLIdone){ return 0; } LTHEME::LoadCustomEnvSettings(); LSingleApplication a(argc, argv, "lumina-xconfig"); //loads translations inside constructor if( !a.isPrimaryProcess()){ return 0; } diff --git a/src-qt5/core/libLumina/LuminaX11.h b/src-qt5/core/libLumina/LuminaX11.h index b0a5d588..b7310abd 100644 --- a/src-qt5/core/libLumina/LuminaX11.h +++ b/src-qt5/core/libLumina/LuminaX11.h @@ -69,6 +69,14 @@ public: } }; +//simple data structure for passing around the XRANDR information +/*class monitor_info{ +public: + QString ID; + bool active; + QRect geometry; +};*/ + //XCB Library replacement for LX11 (Qt5 uses XCB instead of XLib) class LXCB{ @@ -393,6 +401,12 @@ public: WId WM_Get_CM_Owner(); void WM_Set_CM_Owner(WId win); + //============ + // RANDR Functions (directly reading changing monitor outputs) + //============ + //QList<monitor_info> RR_List_Monitors(); + //void RR_Set_Monitors(QList<monitor_info> monitors); + private: QList<xcb_atom_t> ATOMS; QStringList atoms; diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp index 8f89e95c..27eaf537 100644 --- a/src-qt5/core/lumina-session/main.cpp +++ b/src-qt5/core/lumina-session/main.cpp @@ -40,7 +40,9 @@ int main(int argc, char ** argv) //Start X11 if needed //Configure X11 monitors if needed - + if(LUtils::isValidBinary("lumina-xconfig")){ + QProcess::execute("lumina-xconfig --reset-monitors"); + } //Startup the session QCoreApplication a(argc, argv); LSession sess; |