Skip to main content

Posts

Showing posts from 2019

Volume Zero after Login or Unlock in Mac

After reaching office, as soon you opened your laptop it resumes the video/audio you left last night. Sometimes it can be embarrassing, So what we can do is write a script to set volume zero every time your laptop wakes up from login or unlock. The following script is for macOS only. The idea is the same for every OS, you just need to find the right hook and commands. First, we will install the software sleepwatcher which provides the hook for sleep and wakeup events in the OS. Open the terminal and execute the below command. brew install sleepwatcher brew services start sleepwatcher If everything executed correctly. The sleepwatcher has been installed and running in the background. Now we need to figure out how to execute the desired commands on sleep and wakeup events. If we execute below command ps -ef | grep 'sleepwatcher' you will see output something like this.   502   510     1   0 12:07PM ??         0:16.26 /usr/local/sbin/sleepwatcher -V -s ~/.sleep -w