NSRunningApplication,是否返回最近使用过的应用程序列表? [英] NSRunningApplication, return list of recently used applications?
问题描述
我正在尝试获取最近使用的应用程序列表. NSWorkspace
返回活动应用程序的列表,我可以使用NSRunningApplication
在几个选项上对它们进行排序.参见下面的列表:
I'm trying to get a list of the most recently used applications. NSWorkspace
returns a list of active applications and I can sort them on a few options using NSRunningApplication
. see list below:
- launchDate
- finishedLaunching
- processIdentifier
我不需要启动日期,但需要最新的活动"日期(例如 cmd - tab 排序的方式). 有人知道解决方案吗?
I don't want the launch date but the most recent 'active' date (like the way cmd-tab sorts). Does anyone know the solution for this?
推荐答案
我不知道有记录的方式来做到这一点,但是我确切地写了您要使用私有API的要求:
There is no documented way of doing this that I'm aware of, but I wrote exactly what you are asking for using private APIs: http://gist.github.com/163918
此外,请参见获得正在运行的应用程序的列表对于不使用私有API的解决方案,按最后使用顺序排序.
这篇关于NSRunningApplication,是否返回最近使用过的应用程序列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!