Skip to main content
added 3 characters in body
Source Link
0xZ3RR0
  • 305
  • 3
  • 7

Schedule Do Not Disturb

Just to add that you can also schedule Do Not Disturb from the command line to activate/deactivate each day at set times.

To set the time when DND will be enabled:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer <start_time_in_minutes>

To set the time when DND will be disabled:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer <end_time_in_minutes>

NOTE: replace <start_time_in_minutes> and <end_time_in_minutes> with the desired value (explained below).


Example:

To schedule DND to start each day at 15:00 and to end at 18:30 do the following:

Convert 15:00 and 18:30 to minutes to get the value of <start_time_in_minutes> and <end_time_in_minutes>. That is, multiply the number of hours by 60 and add the number of minutes.

For 15:00 that would be: 15 * 60 + 0 = 900 and for 18:30 that would be: 18 * 60 + 30 = 1110. Giving us the commands below:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer 900
defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer 1110
killall NotificationCenter # resets'resets' NotificatioCenterNotificatio Center so that it reads the DND change

Schedule Do Not Disturb

Just to add that you can also schedule Do Not Disturb from the command line to activate/deactivate each day at set times.

To set the time when DND will be enabled:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer <start_time_in_minutes>

To set the time when DND will be disabled:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer <end_time_in_minutes>

NOTE: replace <start_time_in_minutes> and <end_time_in_minutes> with the desired value (explained below).


Example:

To schedule DND to start each day at 15:00 and to end at 18:30 do the following:

Convert 15:00 and 18:30 to minutes to get the value of <start_time_in_minutes> and <end_time_in_minutes>. That is, multiply the number of hours by 60 and add the number of minutes.

For 15:00 that would be: 15 * 60 + 0 = 900 and for 18:30 that would be: 18 * 60 + 30 = 1110. Giving us the commands below:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer 900
defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer 1110
killall NotificationCenter # resets NotificatioCenter so that it reads the DND change

Schedule Do Not Disturb

Just to add that you can also schedule Do Not Disturb from the command line to activate/deactivate each day at set times.

To set the time when DND will be enabled:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer <start_time_in_minutes>

To set the time when DND will be disabled:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer <end_time_in_minutes>

NOTE: replace <start_time_in_minutes> and <end_time_in_minutes> with the desired value (explained below).


Example:

To schedule DND to start each day at 15:00 and to end at 18:30 do the following:

Convert 15:00 and 18:30 to minutes to get the value of <start_time_in_minutes> and <end_time_in_minutes>. That is, multiply the number of hours by 60 and add the number of minutes.

For 15:00 that would be: 15 * 60 + 0 = 900 and for 18:30 that would be: 18 * 60 + 30 = 1110. Giving us the commands below:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer 900
defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer 1110
killall NotificationCenter # 'resets' Notificatio Center so that it reads the DND change
Source Link
0xZ3RR0
  • 305
  • 3
  • 7

Schedule Do Not Disturb

Just to add that you can also schedule Do Not Disturb from the command line to activate/deactivate each day at set times.

To set the time when DND will be enabled:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer <start_time_in_minutes>

To set the time when DND will be disabled:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer <end_time_in_minutes>

NOTE: replace <start_time_in_minutes> and <end_time_in_minutes> with the desired value (explained below).


Example:

To schedule DND to start each day at 15:00 and to end at 18:30 do the following:

Convert 15:00 and 18:30 to minutes to get the value of <start_time_in_minutes> and <end_time_in_minutes>. That is, multiply the number of hours by 60 and add the number of minutes.

For 15:00 that would be: 15 * 60 + 0 = 900 and for 18:30 that would be: 18 * 60 + 30 = 1110. Giving us the commands below:

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer 900
defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer 1110
killall NotificationCenter # resets NotificatioCenter so that it reads the DND change