Created
November 6, 2021 07:43
-
-
Save byte-sourcerer/e3af17cc471fbff2c3823eaf968b207c to your computer and use it in GitHub Desktop.
macOS Monterey Toggle Cursor Size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see https://apple.stackexchange.com/a/430338/433504 | |
function fn() { | |
const cursorSizeSmall = 1 | |
const cursorSizeLarge = 4 | |
const isRunningSystemPreferences = Application('System Preferences').running() | |
Application('System Preferences').panes.byId('com.apple.preference.universalaccess').anchors.byName('Seeing_Cursor').reveal() | |
const process = Application('System Events').processes.byName('System Preferences') | |
while (process.windows.length == 0) {} | |
const window = process.windows[0] | |
while (window.groups.length == 0) {} | |
const group = window.groups[0] | |
while (group.tabGroups.length == 0) {} | |
const tabGroup = group.tabGroups[0] | |
while (tabGroup.sliders.length == 0) {} | |
const slider = tabGroup.sliders[0] | |
if (slider.value() == cursorSizeSmall) { | |
slider.value = cursorSizeLarge | |
} else { | |
slider.value = cursorSizeSmall | |
} | |
if (!isRunningSystemPreferences) { | |
Application('System Preferences').quit() | |
} | |
} | |
fn() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment