How you can put a sleep timer shortcut in your Mac desktop


Taylor Martin/CNET

When you ever end up in a scenario the place you need to shut down your Mac after a time-consuming course of has completed, comparable to downloading and putting in updates, or exporting a video, what you want is a shutdown timer.

A couple of functions for this exist within the Mac App Retailer, comparable to Timer Growth and the aptly named Shutdown Timer. However you do not want any devoted software program. All you want is this easy trick.

Learn extra: When you’re in search of a shutdown timer on Home windows, there’s a fast tip for that, as effectively.

A built-in energy schedule

Below Vitality Saver settings, MacOS has a built-in wake and sleep schedule.

power-schedule-mac

Taylor Martin/CNET

To allow it and create a schedule, go to System Preferences > Vitality Saver and click on Schedule… within the decrease proper nook of the window. There you’ll be able to set a time and day (weekends or weekdays, too) that the Mac will begin up or wake, in addition to a time and day(s) when it is going to restart, shut down or sleep.

As helpful because the schedule function is, it is restricted in the way it can work. Nonetheless, you could possibly use it to close down your laptop at a selected time. Simply choose a time for the sleep or shutdown to occur after the method is predicted to complete.

Make your individual shutdown timer

If you would like a shutdown timer that is extra adaptable, you solely must know a couple of terminal instructions.

The shutdown command will, as anticipated, shut down your Mac when utilized in Terminal. However there are some essential choices that additionally, you will need to use to make this shutdown timer meet your wants.

  • -h will halt the system at a specified time.
  • -r will reboot as a substitute of shutdown.
  • -s will put the Mac to sleep as a substitute of shutdown.

There are different choices, which you’ll be able to learn extra about in Apple’s shutdown documentation, however for the aim of a shutdown timer, -h-r and -s are possible all you have to to know.

It is a shutdown timer command for 15 minutes with a pid of 842.


Taylor Martin/CNET

When you keep in mind this shutdown command, you’ll be able to merely open Terminal and enter the command to create a shutdown timer. Some instance shutdown timer instructions would seem like: 

  • A 15-minute shutdown timer: sudo shutdown -h +15
  • A 30-minute restart timer: sudo shutdown -r +30
  • A 1-hour sleep timer: sudo shutdown -s +60

While you enter one in all these instructions, you have to to enter the password for the consumer account and press return. The shutdown timer will then be created, supplying you with the precise time and date that the shutdown/restart/sleep course of will happen. It’s going to additionally provide the course of ID, also called a pid, which is a three- to four-digit quantity.

When you want to cancel a shutdown timer, pay attention to its pid and enter this command in Terminal: sudo kill [pid number].

Create a shutdown timer desktop shortcut

If you end up utilizing the identical shutdown timer usually, you might need to create a desktop shortcut for the timer.

To do that, open TextEdit and click on New Doc. This opens a clean textual content doc. If the doc isn’t in plain textual content, press command + shift + T to modify to plain textual content.

shutdown-timer-mac-script

full script for a shutdown timer.


Taylor Martin/CNET

On the very prime line of the textual content file, sort #!/bin/bash. This tells the working system that the command must be executed utilizing Bash.

Press return twice, and on the third line, enter your shutdown timer command, comparable to sudo shutdown -h +15. Save the file to Desktop and provides it a easy identify, like shutdown. Earlier than clicking Save, be certain to uncheck the field beside If no extension is supplied, use “.txt”. Click on Save.

Lastly, we have to make the file executable. Open terminal and alter listing to Desktop by typing cd /Customers/[username]/Desktop and press enter. Subsequent, sort chmod 774 shutdown and press enter.

Now if you happen to double-click the shutdown shortcut in your desktop, Terminal will open, prompting you to enter your consumer password. As soon as entered, the timer will start.

If you wish to exchange the default icon of an executable file, click on to spotlight the icon and press command + I. This opens the information web page for the shortcut. Open the picture you need to use in Preview and press command + A to pick out all and command + C to repeat. Lastly, within the information window for the shutdown timer, click on the brand within the prime left nook to spotlight it, then press command + V to stick the picture.

قالب وردپرس

author
Author: 

    Leave a reply "How you can put a sleep timer shortcut in your Mac desktop"