| Index: monitor_reconfigure_main.cc
|
| diff --git a/monitor_reconfigure_main.cc b/monitor_reconfigure_main.cc
|
| index b73e7eaa3ada95cef569f0a38d4c4f6b4dabe2fd..64c7058fdb4f9edb5b3362f808470728f57882ae 100644
|
| --- a/monitor_reconfigure_main.cc
|
| +++ b/monitor_reconfigure_main.cc
|
| @@ -54,8 +54,16 @@ void MonitorReconfigureMain::Run() {
|
| &screen_resolution));
|
|
|
| SetDeviceResolution(lcd_output_->name, lcd_resolution);
|
| +
|
| + // If there's no external output connected, disable the device before we try
|
| + // to set the screen resolution; otherwise xrandr will complain if we're
|
| + // trying to set the screen to a smaller size than what the now-unplugged
|
| + // device was using.
|
| if (IsExternalMonitorConnected())
|
| SetDeviceResolution(external_output_->name, external_resolution);
|
| + else
|
| + DisableDevice(external_output_->name);
|
| +
|
| SetScreenResolution(screen_resolution);
|
| }
|
|
|
| @@ -122,6 +130,13 @@ bool MonitorReconfigureMain::SetScreenResolution(
|
| return system(command.c_str()) == 0;
|
| }
|
|
|
| +bool MonitorReconfigureMain::DisableDevice(const std::string& device_name) {
|
| + string command = StringPrintf("xrandr --output %s --off",
|
| + device_name.c_str());
|
| + LOG(INFO) << "Running " << command.c_str();
|
| + return system(command.c_str()) == 0;
|
| +}
|
| +
|
| } // end namespace monitor_reconfig
|
|
|
| int main(int argc, char** argv) {
|
|
|