Programmable Tooltip is a Mac app that enables you to select text, open the tooltip, and choose a Tip to perform the corresponding useful action. You program what Tips are based on the shape of the selected text. This manual shows how to configure Tips and the shortcut. Table of Contents 1. How to set up Tips 1.1 Set up the pre-configured Tips 1.2 Set up custom Tips through code 2. How to set up the shortcut 2.1 Test the shortcut 2.2 Use a mouse button and the 3-finger touch 3. Understand our strong privacy through App Sandbox
How to set up Tips Tip is an item within the tooltip. The tooltip may contain one or more Tips. The list of Tips is programmed by you based on the shape on the selected text. There are 2 types of Tips: 1. Textual Tip enables you to see useful and copiable information about the selected text e.g. showing the human-readable date based on the UNIX timestamp. 2. OpenUrl Tip enables you to open a pre-defined URL based on the selected text e.g. opening a Google search based on the selected text. You can program your Tips using the pre-configured Tips, the custom script, or both. Set up the pre-configured Tips For your convenience, 3 pre-configured Tips have been provided: 1. Convert Unix Timestamp interprets the selected text as a Unix timestamp and convert it to a human-readable date. 2. Text Length calculates the length of the selected text. 3. Open URL allows you to open your browser to the defined URL. For Open URL, you can have multiple instances that open to different URLs (configurable) based on the shape of the selected text (also configurable). You can add more Open URL by clicking on "Add a pre-configured tip" and choosing "Create URL configuration": With Open URL, you can configure the matching rule and the destination URL. The Tip would only show if the selected text fulfills the matching rule. The destination URL can contain the variable {input} which will be replaced with the selected text. Set up custom Tips through code You can program your Tips using a programming script of any programming language of your choice. Please note that you don't need to set up custom Tips if the pre-configured Tips suffice for your needs. The programming script must be located at: /Users/tanin/Library/Application Scripts/tanin.tip/provider.script, and it must be executable (i.e. chmod 755) The script must accept one command-line argument, which is the selected text, and print to STDOUT the JSON string that follows the below spec:
[
	{
		"type": "url" | "text",
		"label": string | null, // Must exist if type is url,
		"value": string
	}
]
For example, the below JSON would result in 2 Tips. The first one shows the human-readable date, and the second one opens a Google search:
[
	{
		"type": "text",
		"value": "19 July 2024 13:37:50 UTC"
	},
	{
		"type": "url",
		"value": "https://google.com/search?q=1721396270"
	}
]
Here's an example script in Ruby:
#!/usr/bin/env ruby

# Please copy this file to the folder: ~/Library/Application\ Scripts/tanin.tip/

require 'json'
require 'cgi'

def main(input)
  input = input.strip.force_encoding('UTF-8')
  # The force encoding prevents the error: ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
  
  items = [
    {
      type: 'text',
      label: 'Copy uppercase',
      value: input.upcase
    },
    {
      type: 'url',
      label: "Open Google search",
      value: "https://google.com/search?q=#{input}"
    },
  ]

  puts items.to_json
end

if __FILE__ == $0
  main(ARGV[0])
end
You can find example scripts for both Ruby and Python here: Example Scripts How to set up the shortcut Programmable Tooltip is a service. The shortcut can be configured in System Settings. First, we open 'System Settings': Then, we click on 'Keyboard' located in the left navigation panel: Then, we click on 'Keyboard Shortcuts...': Next, we click on 'Services': Next, we expand 'Text': Lastly, we select 'Programmable Tooltip: Open the tooltip' and configure the shortcut. Test the shortcut You can test your shortcut in our Settings panel. You can go to the Settings panel by clicking on the status item on the top right and select 'Settings': The Settings panel has the test text "Phoenix Dragon Garuda" that you can select and press your shortcut to open the tooltip. Use a mouse button and the 3-finger touch You can use a mouse configuration app like Noo Mouse in order to map a mouse button and the 3-finger touch to the shortcut. Here's an example of using Noo to map a mouse button and the 3-finger touch to the shortcut, Cmd + F3: With the above setting in Noo, you will be able to open the tooltip with a single hand (i.e. from your mouse and your touchpad). Understand our strong privacy through App Sandbox Programmable Tooltip runs in App Sandbox. By running in App Sandbox, it is NOT allowed to read, write, or execute files in any user's directory except the directories whose permission is explicitly granted by the users. Since we don't require any permission, we cannot see user's activity. The app sees only the selected text when the user opens the tooltip. More importantly, since Programmable Tooltip is distributed in the App Store, it has gone through Apple's rigorous review process. The strong degree of privacy is what sets us apart from our alternatives.