Commit 1c62a826 authored by Sebastian Kügler's avatar Sebastian Kügler

Allow setting mode by widthxheight@refreshrate

This makes the mode setting through kscreen-doctor a bit more intuitive
and documents it
parent 3ff01856
......@@ -404,16 +404,19 @@ bool Doctor::setMode(int id, const QString &mode_id)
if (output->id() == id) {
// find mode
Q_FOREACH (const KScreen::ModePtr mode, output->modes()) {
if (mode->id() == mode_id) {
qCDebug(KSCREEN_DOCTOR) << "Taddaaa! Found mode" << mode->id() << mode->name();
auto name = QString("%1x%2@%3").arg(QString::number(mode->size().width()),
QString::number(mode->size().height()),
QString::number(qRound(mode->refreshRate())));
if (mode->id() == mode_id || name == mode_id) {
qCDebug(KSCREEN_DOCTOR) << "Taddaaa! Found mode" << mode->id() << name;
output->setCurrentModeId(mode->id());
m_changed = true;
return true;
}
}
}
}
}
cout << "Output mode " << id << " not found." << endl;
cout << "Output mode " << mode_id << " not found." << endl;
return false;
}
......
......@@ -55,7 +55,9 @@ int main(int argc, char **argv)
"\n Disable the hdmi output, enable the laptop panel and set it to a specific mode\n"
" $ kscreen-doctor output.HDMI-2.disable output.eDP-1.mode.1 output.eDP-1.enable\n"
"\n Position the hdmi monitor on the right of the laptop panel\n"
" $ kscreen-doctor output.HDMI-2.position.0,1280 output.eDP-1.position.0,0\n";
" $ kscreen-doctor output.HDMI-2.position.0,1280 output.eDP-1.position.0,0\n"
"\n Set resolution mode\n"
" $ kscreen-doctor output.HDMI-2.mode.1920x1080@60 \n";
/*
"\nError codes:\n"
" 2 : general parse error\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment