kickingvegas / clocktalk

Command line utility to configure and enable periodic macOS time announcements
Apache License 2.0
1 stars 0 forks source link

Using defaults won't actually work. 😞 #1

Open kickingvegas opened 1 year ago

kickingvegas commented 1 year ago

While defaults will configure the properties used by the "Announce the time" feature, changes to the configuration are not reloaded by the "Announce the time" feature. It seems to only work from the GUI Settings app.

Filing an Apple feedback to get clarification if this will actually work.

kickingvegas commented 1 year ago

Submitted Apple feedback FB12218609

Unable to configure 'Announce the time' via the defaults command line utility

Description

Typically, enabling the 'Announce the time' feature requires GUI interaction via the following path in the macOS Settings app:

Settings > Control Center > Clock > Clock Options > Announce the time

I wish to be able to control this via the defaults command line utility so that I can schedule turning on and off this feature via launchd.

I have gone so far as to write a Python script that invokes defaults and as far as I understand it properly configures the domain com.apple.speech.synthesis.general.prefs. However updating this configuration from defaults does not trigger the 'Announce the time' feature (process/daemon) to reload said configuration.

Environment

HW: MacBook Pro 14', 2021 OS: 13.4 (22F66) Ventura

Steps to Reproduce

  1. Initialize from the GUI Settings app to make sure the 'Announce the time' feature is disabled.

    Settings > Control Center > Clock > Clock Options > Announce the time > Off

  2. Invoke the following defaults command to configure the 'Announce the time' feature using the temp.plist file attached to this issue.

    $ defaults import com.apple.speech.synthesis.general.prefs temp.plist

    The contents of temp.plist are as follows which configures the 'Announce the time' feature to be enabled and announce every quarter hour.

    $  plutil -p temp.plist 
    {
      "TimeAnnouncementPrefs" => {
        "TimeAnnouncementsEnabled" => 1
        "TimeAnnouncementsIntervalIdentifier" => "EveryQuarterHourInterval"
        "TimeAnnouncementsPhraseIdentifier" => "ShortTime"
        "TimeAnnouncementsVoiceSettings" => {
          "CustomRelativeRate" => 0.9
          "CustomVolume" => 0.6
        }
      }
    }
  3. Open the GUI Settings app and check the 'Announce the time' setting. It is on.

Expected Result

The 'Announce the time' feature should announce the time at every quarter hour, as configured above.

Actual Result

There is no activity from the 'Announce the time' feature. Inspection of the file $HOME/Library/Preferences/com.apple.speech.synthesis.general.prefs.plist shows that the configuration is set to the contents of temp.plist.

Code to exercise this behavior can be found at the following repo: https://github.com/kickingvegas/clocktalk

Open Questions

  1. Should defaults be able to reconfigure the 'Announce the time' feature? Or is the GUI Settings app the only intended tool to configure it?
  2. Perhaps a feature enhancement to be able to schedule when the time is announced during the day/week?
  3. Is there a means of getting the 'Announce the time' feature to reload the updated configuration from the command line?
  4. Is there another domain that actually should be touched to enable this feature?

Thanks and I look forward to hearing back from you!