获取上次使用时运行的应用程序列表 [英] Getting the list of running applications ordered by last use
问题描述
我想以运行⌘+⇥
时显示的顺序获取正在运行的应用程序列表。如果我使用 TextEdit ,预览和 iCal ,订单为
<
使用 [[NSWorkspace sharedWorkspace] launchedApplications]
不工作,因为应用程序按发射日期/进程ID排序。枚举 GetNextProcess
不起作用,因为它也由pid排序。
注册通知和维护列表我不是一个选项,因为我必须知道的应用程序启动后的列表。嗯,列表的第一个元素实际上是足够的,但我认为这是几乎相同的问题。
有一些API可用于获取此信息? / p>
可能是这样的:
cd /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework
nm LaunchServices | grep __LSCopyApplicationArrayInFrontToBackOrder
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?
Maybe something like this:
cd /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework
nm LaunchServices | grep __LSCopyApplicationArrayInFrontToBackOrder
这篇关于获取上次使用时运行的应用程序列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!