I don't have enough space to use a monitor next to the laptop in normal orientation, so I mounted the laptop on the left-hand wall (my desk is in a corner) and I'm using it in portrait mode as the secondary display.

I like having a second screen, which i why I want to keep using it, and also I can't keep the lid closed because sometimes the laptop won't wake up from sleep mode by USB mouse and keyboard input, but only when I engage the laptop's own keyboard or mouse pad.

But for times when I disconnect the laptop, naturally I need it in landscape mode.

Currently I use a Display shortcut to rotate the screen as needed (Windows 10 with Intel graphics + Nvidia card, but the ctrl+alt+arrows no longer exist in either of the control panels), but I'd like to have the process somehow automated, i.e. to have the screen switch to portrait mode when the monitor is plugged in, and to landscape mode when it is unplugged.

Does anyone know of a way to do that?

Edit: To clarify, I'd like the screen rotation to be triggered by the hdmi being plugged in / unplugged.


There should be a setting in display properties in windows that rotates sceen (windows 10). Otherwise try the nvidia control panel, it has one as well

  • Thanks, I do have those settings, but I'd like to avoid too many steps for rotating the screen every time when I plug in or unplug the hdmi - that's why I'm using a shortcut (and since the usual default shortcut isn't there in the new intel drivers, I use Noel's Display) - but my question was about a way to automate the switch. – Dejan Jan 13 '19 at 0:47
  • Windows or nvidia should remember positioning/rotation settings for the device even if you disconnect it and reconnect it. I'm running a tri- screen setup on my laptop and when i connect the screens again (after using the laptops without the external screens), windows automatically remembers the settings. Though i do notice that when i connect only one of the screens at a time, windows will position it wrong until the second screen is connected. Must be that windows only applies the settings as you configered them when all the screens were connected – user2657667 Jan 17 '19 at 16:05
  • I thought that would be the case too, and it actually is so for the positioning and even the resolution (when the monitor is plugged in, I keep the laptop at a lower res.), but not the orientation. Maybe because I make the monitor the primary screen, I dunno. – Dejan Jan 17 '19 at 20:05
  • NOT because the laptop is the secondary display, I just checked. – Dejan Jan 17 '19 at 20:13

This can be achieved using an AutoHotKey script, so that must be installed first.

OnMessage(0x219, "MsgMonitor")
MsgMonitor(wParam, lParam, msg)
    Sysget, numMon, MonitorCount
    if (numMon > 1) {
        Run "C:\Program Files\AutoHotkey\display64.exe" /rotate 90,,Hide
    } else {
        Run "C:\Program Files\AutoHotkey\display64.exe" /rotate 0,,Hide

This script runs every time there's a new device connected, checks how many monitors are connected to the system, and if there's more then 1, rotates the screen. This requires Display.exe or Display64.exe, available here, I placed the executable in the AutoHotkey folder but it can be placed anywhere. The angle can be changed, and /device n can be used if the incorrect display is being rotated. To run this, paste the code into a file with a .ahk extension, and place the script in the Startup Folder to have it run on startup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.