how can i start the screensaver (and lock the screen) from the os x terminal?

前端 未结 2 1228
礼貌的吻别
礼貌的吻别 2021-01-31 03:22

Is there a way to start the screensaver (and lock the screen) from a bash script?

相关标签:
2条回答
  • 2021-01-31 03:44

    Have you tried this?

    /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine
    

    Update for macOS High Sierra:

    /System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine
    
    0 讨论(0)
  • 2021-01-31 03:54

    Here is a bash script that does exactly what you are asking for: maclock

    It is called from the command line as follows:

    maclock
    

    Under the covers it calls:

    open -a ScreenSaverEngine
    

    It can also be used to mute the system, or put the display to sleep:

    maclock --mute --display
    
    0 讨论(0)
提交回复
热议问题