docs » ToggleScreenRotation

Toggle rotation on external screens

Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/ToggleScreenRotation.spoon.zip

Makes the following simplifying assumptions:

API Overview

API Documentation

Variables

rotating_angles
Signature ToggleScreenRotation.rotating_angles
Type Variable
Description

Two-element table containing the rotation angles for "normal" and "rotated". Defaults to { 0, 90 } and should only be changed if you really know what you are doing.

Source Source/ToggleScreenRotation.spoon/init.lua line 35
screens_to_skip
Signature ToggleScreenRotation.screens_to_skip
Type Variable
Description

Lua patterns for screens that shouldn't be rotated, even if they match one of the patterns.

Notes
  • Defaults to { "Color LCD", "iMac" }, which excludes the built-in display on laptops and iMacs.
Source Source/ToggleScreenRotation.spoon/init.lua line 27

Methods

bindHotkeys
Signature ToggleScreenRotation:bindHotkeys(mapping)
Type Method
Description

Binds hotkeys for ToggleScreenRotation.

Parameters
  • mapping - A table containing hotkey modifier/key details to rotate screens. Instead of fixed "key names", each key must be the name of a screen to rotate, or a Lua pattern - in this case the first screen to match the pattern will be rotated. The value is a table containing the hotkey modifier/key details as usual. You can use the special key first (or the Lua pattern [".*"]) to match the first external screen, which should be sufficient unless you have more than one external screen. Example (bind Ctrl-Cmd-Alt-F15 to rotate the first external screen): [".*"] = { {"ctrl", "cmd", "alt"}, "f15" }
Returns
Source Source/ToggleScreenRotation.spoon/init.lua line 97