获取上次使用时运行的应用程序列表 [英] Getting the list of running applications ordered by last use

查看:143
本文介绍了获取上次使用时运行的应用程序列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以运行⌘+⇥



时显示的顺序获取正在运行的应用程序列表。如果我使用 TextEdit 预览 iCal ,订单为



<
  • iCal

  • 预览

  • TextEdit

  • 使用 [[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

    1. iCal
    2. Preview
    3. 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屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆