How to change the pointer type (crosshair, hand, arrow, etc.)?

Is there a way to force the pointer to change from, say, a crosshair to a hand? I use the VS Code editor and it has a tendency to keep my pointer as a white crosshair if I move it quickly to the Chrome window. Since the background is usually white I have a lot of trouble finding it and I’m looking for a workaround.

Hard to test here without VS Code editor, but I would tend to use a KM Execute … Script action to experiment with methods of the NSCursor object.

https://developer.apple.com/documentation/appkit/nscursor?language=objc

In JavaScript for Automation, for example, you should find that you can get references to properties of the current cursor:

(() => {
    'use strict';

    ObjC.import('AppKit')
    
    
    return $.NSCursor.currentCursor.image.backgroundColor    
    
})();

and it’s possible that you might be able to pop a lingering guest cursor off the stack with something like:

(() => {
    'use strict';

    ObjC.import('AppKit')
    
    // $.NSCursor.pop
    $.NSCursor.currentCursor.pop    
    
})();

Or in AppleScript

use framework "Foundation"
use scripting additions


on run
    
    set ca to current application
    
    -- ca's NSCursor's currentCursor's image's backgroundColor
    
    -- ca's NSCursor's pop()
    
    ca's NSCursor's currentCursor's pop()
    
end run
1 Like