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

前端 未结 2 1229
礼貌的吻别
礼貌的吻别 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: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
    

提交回复
热议问题