Giter Club home page Giter Club logo

windows-display-orientation-script's Introduction

Windows Display Orientation Script

Windows Powershell / .NET script

Instantly flip screen orientation horizontal / vertical with a shortcut icon or command. Because switching between landscape and portrait mode using Display settings on windows takes too many clicks.

Works with multiple monitors and all display orientation modes (landscape, landscape inverted, portrait, portrait inverted).

Download script <-- right click, Save as

preview2

usage examples (as commands or as shortcuts) :

switch second screen to portrait mode (rotate counter clockwise) :

powershell.exe -ExecutionPolicy Bypass -File "C:\PATH\windows-display-orientation-script.ps1" 1 270

switch second screen to portrait inverted mode (rotate clockwise) :

powershell.exe -ExecutionPolicy Bypass -File "C:\PATH\windows-display-orientation-script.ps1" 1 90

switch second screen back to landscape mode (horizontal) :

powershell.exe -ExecutionPolicy Bypass -File "C:\PATH\windows-display-orientation-script.ps1" 1 0

reset all screens to default landscape mode :

powershell.exe -ExecutionPolicy Bypass -File "C:\PATH\windows-display-orientation-script.ps1"

needs 2 arguments! :

  • argument 1 : display id (0: first main screen, 1: second screen, 2: third etc.)
  • argument 2 : rotation (0: default landscape, 90: portrait inverted, 180: landscape inverted, 270: portrait)

so :

  • ... windows-display-orientation-script.ps1" 0 270 means first primary display, 90 degrees ccw to vertical
  • ... windows-display-orientation-script.ps1" 1 90 means second display, 90 degrees cw to vertical inverted

running script without arguments resets all displays to default landscape orientation

notes :

  • doesn't need to be run as admin
  • rotation can only be set to 4 available values (0, 90, 180, 270), any other value won't work.
  • can only rotate by 90 degrees in one go for some reason, can't go from 0 straight to 180, needs 2 steps for that.
  • can't set screen xy position in relation to other screens as possible with Display settings menu.
  • you can rename script file and keep in any folder, just use full proper path when running it

disclaimer :

i didn't write 90% of this code myself, i barely know how any of it works. i just mashed various pieces of code i've found on the internet that worked for me and added or modified some parts to my needs. as well as i was able. works as it is, no guarantees.

sharing it with anyone that might find it useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.