docs » SiriSays

Use "Type to Siri" through Hammerspoon

Download: SiriSays.spoon.zip

README: README.md

API Overview

API Documentation

Constants

notificationCenterBundleID
Signature SiriSays.notificationCenterBundleID
Type Constant
Description

Bundle ID of Apple Notification Center, used to detect when "Type to Siri"

Source Source/SiriSays.spoon/init.lua line 18

Variables

logger
Signature SiriSays.logger
Type Variable
Description

Logger object used within the Spoon. Can be accessed to set the default log

Source Source/SiriSays.spoon/init.lua line 24
logLevel
Signature SiriSays.logLevel
Type Variable
Description

Spacer specific log level override, see hs.logger.setLogLevel for options.

Source Source/SiriSays.spoon/init.lua line 30
previouslyFocusedWindow
Signature SiriSays.previouslyFocusedWindow
Type Variable
Description

The previously focused window stored prior to starting the macro, used for

Source Source/SiriSays.spoon/init.lua line 41
typeToSiriCloseDelay
Signature SiriSays.typeToSiriCloseDelay
Type Variable
Description

int representing the time in seconds to wait before "auto closing"

Source Source/SiriSays.spoon/init.lua line 35
typeToSiriCloseTimer
Signature SiriSays.typeToSiriCloseTimer
Type Variable
Description

hs.timer that waits typeToSiriCloseDelay seconds before auto closing the TTS

Source Source/SiriSays.spoon/init.lua line 52
typeToSiriOpenTimer
Signature SiriSays.typeToSiriOpenTimer
Type Variable
Description

hs.timer that waits unto the TTS prompt is open.

Source Source/SiriSays.spoon/init.lua line 47

Methods

siri
Signature SiriSays:siri(prompt)
Type Method
Description

Initiate a macro for sending text to Siri.

Parameters
  • prompt - string prompt to send to Siri
Returns
  • None
Notes
  • This "function" is really a multi-step macro that does the following
    • Presses Fn+Space to open the TTS prompt
    • Waits until "Notification Center" is the focused application (TTS prompt)
    • Sends the provided prompt as keystrokes
    • Presses return to submit prompt
    • Waits typeToSiriCloseDelay seconds before "auto closing" the prompt
    • Auto close focuses the window from before TTS prompt then clicks the center
      • Will not occur if prompt is already unfocused
  • This requires the following settings to be enabled
    • Accessibility
      • Type to Siri
        • On
    • Siri & Spotlight
      • Siri Responses
        • Voice Feedback
          • Off
        • Always show Siri captions
          • On
        • Keyboard Shortcut
          • Press Fn (Globe) Space
Source Source/SiriSays.spoon/init.lua line 115
siri_cli
Signature SiriSays:siri_cli(args)
Type Method
Description

Initiate a siri prompt from the Hammerspoon CLI.

Parameters
  • args - Args provided to hs CLI after "--" via _cli.args.
Returns
  • None
Notes
  • This is intended to be invoked via the Hammerspoon CLI with the prompt after
  • ie alias siri='hs -c "spoon.SiriSays:siri_cli(_cli.args)" --'
Source Source/SiriSays.spoon/init.lua line 165