A lightweight Windows utility that adds keyboard shortcuts for screen rotation using Python and the Windows API.
- Rotate the Windows display using keyboard shortcuts.
- Supports all four standard display orientations:
- Landscape
- Portrait
- Landscape (Flipped)
- Portrait (Flipped)
- Works on both laptops and desktop PCs.
- On laptops, the hotkeys continue to work on both AC power and battery power.
- No third-party Python packages required.
- Uses the Windows Display API directly through Python
ctypes. - Can run silently in the background with
pythonw. - Can be configured to start automatically when you sign in to Windows.
- Designed for Windows 10 and Windows 11.
| Shortcut | Action |
|---|---|
Ctrl + Alt + ↑ |
Landscape |
Ctrl + Alt + → |
Rotate 90° |
Ctrl + Alt + ↓ |
Landscape (Flipped) |
Ctrl + Alt + ← |
Rotate 270° |
Right Alt + ↑/→/↓/← |
Same rotation actions as the corresponding Ctrl + Alt shortcut |
Note: The exact behavior of the Right Alt/AltGr key can depend on the keyboard layout and Windows input configuration.
- Windows 10 / Windows 11
- Python 3.10 or newer
- A display driver that supports Windows display orientation
- Permission to create a startup task in Windows Task Scheduler
- Press
Win + I. - Go to System → Display.
- Find Display orientation.
- If Windows provides options such as Landscape, Portrait, Landscape (flipped), or Portrait (flipped), your system supports display orientation changes.
If Display orientation is missing or unavailable, this utility may not work correctly on that system.
Download or clone this repository and extract it to a convenient folder.
The important file is:
ScreenRotate.py
Open Command Prompt and run:
python --versionYou should see Python 3.10 or newer.
If python is not recognized, install Python and make sure Add Python to PATH is enabled during installation.
Open C:\ and create a new folder :
C:\Screen Rotate
Put ScreenRotate.py inside it:
C:\Screen Rotate\ScreenRotate.py
Do not install the program as a startup task immediately. Test it first.
This confirms that the utility works on your PC before you configure it to run automatically.
Open Command Prompt:
cd "C:\Screen Rotate"Run:
python ScreenRotate.pyOr, you can run the script by right-clicking ScreenRotate.py and selecting Run with Python.
Now test all Ctrl + Alt + Arrow and Right Alt + Arrow shortcuts.
If everything works, press Ctrl + C to stop the test and close cmd.
Run:
pythonw.exe "C:\Screen Rotate\ScreenRotate.py"Hit enter & simply close cmd.
Test the shortcuts again.
-
Stop here and confirm that all shortcuts work correctly.
-
Only after the test is successful should you continue to the manual installation below.
- Do not configure Task Scheduler yet.
Check the troubleshooting section at the bottom first.
Open Command Prompt and run:
where pythonwWindows should return a path similar to:
"C:\Program Files\Python314\pythonw.exe"
Copy the path shown on your computer or you can minimize the cmd.
Do not copy the example path above. Use the actual path returned by
where pythonw.
- Click the Start button.
- In the Windows Search box, type:
Task Scheduler - Open Task Scheduler from the search results.
- Open Task Scheduler Library.
- Click on Create Task...
Set:
- Name:
Display Rotation Hotkey - Run only when user is logged on: Checked✅
- Run with highest privileges: Unchecked❌
Open Triggers → Click New...
Set:
- Begin the task:
At log on - Select Any user
- At bottom Enabled: Checked✅
Click OK.
Open Actions → Click New...
Set:
-
Action: → Start a program
-
Program/script:
Now enter the exact
pythonw.exepath perviously you copy from:where pythonwFor example:
"C:\Program Files\Python314\pythonw.exe"or you can Browse
pythonw.exefile location -
Add arguments:
"C:\Screen Rotate\ScreenRotate.py"
Click OK.
For both laptops and desktop PCs:
- Unchecked❌ Start the task only if the computer is idle
- Unchecked❌ Start the task only if the computer is on AC power
- Unchecked❌ Stop if the computer switches to battery power
- Unchecked❌ Wake the computer to run this task
- Unchecked❌ Start only if a network connection is available
Make sure:
Start the task only if the computer is on AC power is unchecked.
And:
Stop if the computer switches to battery power is unchecked.
This keeps the hotkeys working on both battery and AC power in laptops.
Use:
- Checked✅ Allow task to be run on demand
- Checked✅ Run task as soon as possible after a scheduled start is missed
- Checked✅ If the task fails, restart every:
1 minute - Attempt to restart up to:
3 times - Unchecked❌ Stop the task if it runs longer than
- Unchecked❌ If the task it is not scheduled to run again, delete it after
- If the task is already running:
Do not start a new instance
Click OK.
- Select Display Rotation Hotkey showing in the photo.

- Right-click → Run.
- Test all rotation shortcuts.
- If everything works, restart Windows.
- Log in and test the shortcuts again.
- Open:
Task Scheduler
- Click Task Scheduler Library.
- Select Display Rotation Hotkey.
- Right-click → Delete.
- Delete:
C:\Screen Rotate
Check Task Scheduler:
- The task exists.
- The trigger is At log on.
- The action points to the correct
pythonw.exe. - The script path is correct.
- Start in is
C:\ScreenRotate.
Run:
where pythonIf nothing is returned, Python may not be installed correctly or may not be in PATH.
Run:
where pythonwUse the full returned path in Task Scheduler.
First check:
Settings → System → Display → Display orientation
If Windows itself cannot change the orientation, this utility cannot force the rotation through the same Windows display API.
Normally the background utility should spend almost no CPU while idle.
Open:
Task Manager → Details
Check for multiple pythonw.exe processes.
If more than one copy is running, make sure you are not using both Task Scheduler and another startup method.
The Right Alt key may be interpreted as AltGr depending on the Windows keyboard layout.
Try the normal:
Ctrl + Alt + Arrow
shortcuts first.
- This project uses the Windows API through Python
ctypes. - No third-party Python package is required.
- Use Task Scheduler as the automatic startup method.
- Do not run multiple copies of
ScreenRotate.pyat the same time. - The hotkeys are designed to work on laptops and desktop PCs.
- On laptops, the Task Scheduler configuration allows the program to work on AC power and battery power simultaneously.
- On laptops with multiple graphics adapters, behavior can depend on which adapter controls the active display.
- The task does not require an Internet connection or an idle computer.
- If Windows does not provide a Display orientation option, the display/driver configuration may not support this method.
- If you modify the script, test it manually before changing the startup configuration.
MIT License.