Are you sick and tired of staying up late because of your mac? This script suggests you to wind down using customizable voice annoucements. If your mac is still on during sleep hours - this script will shut your mac down for you. You are welcome.
- Your computer will be shut down during hours 12am - 6am
- 2.5hr, 1hr, and 10 minutes before the sleep hours start the computer will warn you, if your sound is on
- Open an issue if you want customizable sleep hours, for now edit the shutdown-job.sh
Warning: Before you install, please understand that it might be hard to turn the computer back on during sleep hours. Every time the computer is turned on, you will have 1 minute to disable it from shutting down your computer.
In your terminal run:
echo "Cloning the repo"
git clone https://github.com/bra1nDump/kill-my-mac.git
cd kill-my-mac
echo "Setting up"
./install.sh
TODO: Currently you can change the sleep hours to be closer to current time in the shutdown-job.sh script. You can also change the warning times.
I got you! How agressive?
- To make sure I get asked for the password / touch id after every sleep - search in System Settings for Lock Screen and set to 'Immediately'
- To make the computer shut down instead of sleeping, uncomment piece of shutdown-job.sh, this line:
osascript -e 'tell application "System Events" to shut down'
You can do either option:
- In terminal run
rm ~/Library/LaunchAgents/com.bra1ndump.kill-my-mac.plist
, this will prevent the script from running. You can run./install.sh
to enable again - In the directory where you cloned the project run
./uninstall.sh
. Same as above. - Open the shutdown-job.sh script where you installed this project and comment out the last if statement that has this line:
osascript -e 'tell application "System Events" to shut down'
. Uncomment it again to re-enable
- It installs a LaunchAgent that runs shutdown-job every minute
- You can find the agent configuration here
ls ~/Library/LaunchAgents
- You can find the agent configuration here
- shutdown-job.sh
- If computer is already asleep (uses
pmset
), do nothing - If close to sleep hours, warns the user
- If in sleep hours, shut down using apple script
osascript -e 'tell application "System Events" to shut down'
- If computer is already asleep (uses
- Post about it
- TELL MY FRIENDS TO TRY IT
-
Package with Homebrew tap
- More user trust because of the brew prefix
- Easier upgrading (not sure if the taps get auto-upgraded though)
-
Allow configuring sleep time - will need to symlink the cli bash script that will update the configurations so its accessible from anywhere
- Prompted:
- Choose a time when you want to ensure your computer is not running
- Format is: 00:20-06:00, no spaces, period start, period end, 24 hr format
- In this example starting at 20 past midnight until 6, if your computer is not asleep, it will be forcefully shut down
- Enter the time - default is 00:00-06:00 (midnight until 6am): Get
- Prompted:
-
How can I make editing the configuration difficult?
-
By allowing to skip the shutdown once by looking at a message to self you wrote when setting this up, and forcing to look at it for 5 minutes before allowing to skip
-
Maybe switch to python? Since it will be installed by brew, I can just set python as a dependency. Its installed everywhere already so does not really matter. Bash is fucking ridiculous. Functions are unlike in any other programming language
- Work on the discipline in other ways
pmset repeat shutdown TWRFS 11:00:00
- Almighty https://indiegoodies.com/almighty - many different shortcuts