I'd like to get the list of running applications in the same order they appear when doing ⌘ + ⇥
I.e. if I use TextEdit, then Preview, then iCal, the order is
- iCal
- Preview
- TextEdit
Using [[NSWorkspace sharedWorkspace] launchedApplications]
does not work as applications are sorted by launch date/process id. Enumerating with GetNextProcess
does not work either as it is also ordered by pid.
Registering for notifications and maintaining a list myself is not an option as I must know the list right after the application launches. Well, the first element of the list would be enough actually, but I think it is pretty much the same question.
Is there some API available to get this information?