Created
September 19, 2019 04:08
-
-
Save fallroot/0a1220f8ac273332eb24a925c7e37117 to your computer and use it in GitHub Desktop.
Get running apps ordered by most recently used first in macOS
This file contains hidden or 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
ObjC.import('Cocoa') | |
const windows = ObjC.deepUnwrap($.CGWindowListCopyWindowInfo($.kCGWindowListOptionOnScreenOnly | $.kCGWindowListExcludeDesktopElements, $.kCGNullWindowID)) | |
Array.from(new Set(windows.map(w => w.kCGWindowOwnerName))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Was getting a
TypeError
on macOS 12.3.1. Had to addObjC.castRefToObject
: