简体   繁体   English

检测正在进行的屏幕截图

[英]Detecting screen capture in progress

How can I detect when a screen shot selection (cmd-shift-4) is in progress? 如何检测正在进行的屏幕快照选择(cmd-shift-4)?

I have a custom window that I'm trying to make behave like a menu (it comes out of a status item). 我有一个自定义窗口,试图使它像菜单一样工作(它来自状态项)。 Part of this behavior is dismissing it when the user clicks on something else, which I detect using a CGEventTap. 这种行为的部分原因是,当用户单击其他内容(我使用CGEventTap检测到该内容)时将其关闭。 One case where I don't want a click to dismiss is when it's the start of a screen shot selection. 希望点击消失的一种情况是,它是屏幕快照选择的开始。 Is there any way to detect this? 有什么办法可以检测到这一点?

I'm talking about the "capture some of your screen" feature described here: http://support.apple.com/kb/HT5775 我说的是这里描述的“捕获屏幕的一部分”功能: http : //support.apple.com/kb/HT5775

I believe I've found the answer: check whether /usr/sbin/screencapture is running. 我相信已经找到了答案:检查/usr/sbin/screencapture是否正在运行。

I opened Activity Monitor, sorted by process ID, and hit cmd-shift-4. 我打开了活动监视器,按进程ID排序,然后单击cmd-shift-4。 screencapture appeared at the top of the list for the duration of the screen capture. screencapture出现在列表屏幕捕获的持续时间的顶部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM