How to Identify if the process in User Interface Process?

后端 未结 3 1264
执笔经年
执笔经年 2021-01-15 15:47

How can I get information from a process that it is UI(User Interface) process or non-ui?

With UI process I mean, Finder, Dock, System UI server, or any other mac a

3条回答
  •  有刺的猬
    2021-01-15 16:27

    Try the following.

    #include 
    
      if (isatty(STDIN_FILENO) || isatty(STDOUT_FILENO) || isatty(STDERR_FILENO))
        // Process associated with a terminal
      else
        // No terminal - probably UI process
    

提交回复
热议问题