From a6f092c08c7c34e9a160156acbdbf8e42ef3324a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 27 Mar 2018 14:26:40 -0400 Subject: A bunch of CLI updates to lumina-xconfig: 1. Add option to list all profiles from CLI 2. Add option to apply a profile from the CLI 3. Add an option to setup all monitors in a "mirror" arrangement from the CLI --- .../core-utils/lumina-xconfig/ScreenSettings.cpp | 46 ++++++++++++++++++++-- src-qt5/core-utils/lumina-xconfig/ScreenSettings.h | 1 + src-qt5/core-utils/lumina-xconfig/lumina-xconfig.1 | 11 +++++- src-qt5/core-utils/lumina-xconfig/main.cpp | 8 ++++ 4 files changed, 62 insertions(+), 4 deletions(-) (limited to 'src-qt5/core-utils') diff --git a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp index a8f94680..a5740eae 100644 --- a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp +++ b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp @@ -21,12 +21,52 @@ void RRSettings::ApplyPrevious(){ RRSettings::Apply(screens); } +void RRSettings::ApplyProfile(QString profile){ + //Make sure the profile exists first + if( !RRSettings::savedProfiles().contains(profile) ){ return; } + //Now load/apply the profile + QList screens = RRSettings::PreviousSettings(profile); + RRSettings::Apply(screens); +} + void RRSettings::MirrorAll(){ - QList screens; + QList screens = RRSettings::CurrentScreens(); //Now find the highest resolution supported by all connected monitors - + QStringList combined; + bool starting = true; + for(int i=0; i=max.width() && tmp.height()>=max.height()){ max = tmp; } + } + qDebug() << "Detected max unified resolution:" << max; //Setup one monitor with that resolution, and mirror the rest of them - + for(int i=0; i +Apply the given monitor profile (will do nothing if profile does not exist) .El .Sh DEPENDENCIES diff --git a/src-qt5/core-utils/lumina-xconfig/main.cpp b/src-qt5/core-utils/lumina-xconfig/main.cpp index 64c70cfc..0508692b 100644 --- a/src-qt5/core-utils/lumina-xconfig/main.cpp +++ b/src-qt5/core-utils/lumina-xconfig/main.cpp @@ -22,6 +22,14 @@ int main(int argc, char ** argv) RRSettings::MirrorAll(); CLIdone = true; break; + }else if(QString(argv[i]) == "--list-profiles"){ + qDebug() << RRSettings::savedProfiles().join("\n"); + CLIdone = true; + break; + }else if(QString(argv[i]) == "--apply-profile" && argc > (i+1) ){ + RRSettings::ApplyProfile( QString(argv[i+1]) ); + CLIdone = true; + break; } } if(CLIdone){ return 0; } -- cgit