lauix
V2EX  ›  macOS

谁知道怎么获取 Mac 锁屏 or 解锁的事件?

  •  
  •   lauix · Feb 23, 2018 · 3624 views
    This topic created in 3144 days ago, the information mentioned may be changed or developed.
    /Library/LaunchAgents
    /Library/LaunchDaemons

    只有登录的时候才会执行,就是开机启动。

    我想知道锁屏事件和解锁事件怎么设置?

    -------------

    https://sspai.com/post/32828
    这是 MacID 的方式,就是不知道原理是什么
    2 replies  •  2018-02-23 15:46:39 +08:00
    zj299792458
        1
    zj299792458  
       Feb 23, 2018
    cocoa 框架里面有事件监听,用 oc 写个 daemon 即可
    [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:@"com.apple.screenIsLocked" object:nil];
    xream
        2
    xream  
       Feb 23, 2018
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   800 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:21 · PVG 06:21 · LAX 15:21 · JFK 18:21
    ♥ Do have faith in what you're doing.