• Stars
    star
    917
  • Rank 49,814 (Top 1.0 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Programmable tooltip that can be used with any Mac OS app

Universal Tip icon Universal Tip

Download from Mac App Store

Tip (or its full name, Universal Tip) is a programmable tooltip that can be used with any Mac OS app. You can select the text and hit the shortcuts to activate a tooltip with useful info.

"Useful info" is programmed by you using your favourite programming language.

For me, who is prone to Repetitive strain injury and Carpal tunnel syndrome, Tip reduces hand movement which helps reduce the risk of the injury.

I'd love for you to try it!

Questions? please don't hesitate to open a Github issue.

Examples

Convert the seconds from epoch to the human-readable time and copy it to clipboard

Tip is used within Chrome.

Convert seconds from epoch to time and copy

If you've installed Tip, try converting seconds from epoch to time by triggering Tip on the following string: 1577733633

Open Github code search on the selected text

Tip is used within Sublime.

Open Github code search with the selected text

Open a file on Github from an error stacktrace line

Tip is used within Terminal.

Open file on Github from an error stacktrace line

Open a JIRA ticket on the selected text

Tip is used within Terminal.

Open JIRA with the selected text

You can make your own info provider. The possibility is endless!

Installation

  1. Install Tip from Mac App Store
    • You can also download it from the release page and move Tip.app to under /Applications
  2. Download and copy scripts/provider.script to ~/Library/Application\ Scripts/tanin.tip/provider.script. Run chmod 755 ~/Library/Application\ Scripts/tanin.tip/provider.script.
    • Or you can simply run: curl -o ~/Library/Application\ Scripts/tanin.tip/provider.script --create-dirs https://raw.githubusercontent.com/tanin47/tip/master/scripts/provider.script && chmod 755 ~/Library/Application\ Scripts/tanin.tip/provider.script
  3. Go to System Preferences > Keyboard > Shortcuts > Services > Scroll down to the "Text" section. You should see "Tip: open tips" under the "Text" section.
    • Please make sure to check it.
    • You can also set the shortcuts here.

The sample provider script is in Ruby, so you need Ruby to run it. Otherwise, you can make your own provider as well.

See how to develop the provider script here.

Usage

  1. Select the text
  2. Hit the configured short key. The default shortcut is Cmd + &.
  3. The tooltip with relevant info will show
  4. Use arrow keys to choose an item in the tooltip and hit 'Enter' to perform the appropriate action. Alternatively, you can click an item as well

Currently, Tip supports 3 actions: (1) Copy to clipboard if the item is text, (2) Open URL if the item is URL, and (3) Execute a command.

See how to develop the provider script here.

Customize the shortcut

Go to System Preferences > Keyboard > Shortcuts > Services and set the shortcut for "Tip: open tips".

If your shortcut doesn't include the Command key, you will need to activate it manually by:

  1. Selecting a text
  2. Clicking on the application menu > Services > "Tip: open tips"

Now you'll be able to use the new shortcut for Tip.

Choosing a good shortcut

I've found that Cmd + F3 is a good shortcut. I haven't encountered an application that uses this shortcut yet.

My setup, which enables me to use Tip seamlessly, is:

  • An extra mouse button emits Cmd + F3
  • 4-finger touch on the trackpad emits Cmd + F3

I use Noo.app to configure my mouse buttons and trackpad.

Privacy

There are 3 components that enables Tip to maintain a high degree of privacy: App Sandbox, NSService, and NSUserUnixTask

  1. Tip runs in App Sandbox without requesting for an additional permission. With App Sandbox, Tip can only read/write files from a few predefined directories and, specifically, can only execute (not write) the files within ~/Library/Application\ Scripts/tanin.tip. This is the reason why the provider script is under ~/Library/Application\ Scripts/tanin.tip/.

  2. Tip is based on NSServices. Tip doesn't (and cannot) see the content of other applications. When you explicit trigger Tip, Mac OS gives Tip the selected text.

  3. Tip uses NSUserUnixTask, which is intended to execute user-supplied scripts, and will execute them outside of the application's sandbox, if any. This enables provider.script (a user-supplied script) many more use cases because it runs outside of the sandbox.

Great design by Apple. It is a huge win in terms of privacy.

Technical detail

Tip is an NSServices. When user selects text and hits the shortcut, the selected text is sent to Tip. Then, Tip invokes the command-line tool with the selected text as the first argument, i.e ~/Library/Application\ Scripts/tanin.tip/provider.script [selected-text] --bundle-id [the-app-that-you-activate-tip-on].

The command-line tool processes the input, decides which info to show, and prints the tip items as JSON that looks like below:

[
  {"type": "text", "value": "Some text"},
  {"type": "url", "label": "Go to JIRA", "value": "https://your-jira-url/JIRA-0001"},
]

Tip processes the JSON and renders the tooltip at the mouse location.

Tip on the internet

FAQ

Why is Tip written in Objective-C instead of Swift?

Because I don't know how to write Swift. I'd like to switch to Swift though.

What does Tip mean?

Tip is a Thai word that means magical and divine. The word is derived from the word, divya, which exists in both Pali and Sanskrit.

More Repositories

1

UIGridView

UIGridView offers a simple way to use a grid (multiple-column UITableView) on iOS
Objective-C
124
star
2

git-notes

Sync your personal notes through Git automatically
Go
55
star
3

wiky.js

Wiky.js - a simple Javascript library to convert Wiki MarkUp language to HTML
JavaScript
47
star
4

noo

Mouse and touchpad configuration for Mac OS
Swift
36
star
5

whowish_word

whowish_word is a Rails gem to make static content editable
JavaScript
21
star
6

silver

An MVC framework for Titanium SDK that gives you a Facebook-alike app on both iOS and Android
JavaScript
18
star
7

javaparser.rs

[work-in-progress] Java parser written in Rust
Rust
16
star
8

sbt-svelte

The best way to integrate Svelte with Playframework.
Scala
12
star
9

bazel-pex-pip

Python
11
star
10

wiky

Wiky - A simple Ruby library to convert Wiki markup to HTML
Ruby
7
star
11

lilit-lang

[Work in progress] A programming language. Ideal for command-line tools
Rust
6
star
12

superintendent

Write SQL on CSV files
6
star
13

watir-webdriver-rails

watir-webdriver-rails provides a dead-simple way to use Watir with Rails 3
Ruby
6
star
14

scala-interpreter

Build your own language and API in Scala.
Scala
6
star
15

zeus

An RTMP server that receives a streamed video from a Flash client and writes the video to an FLV file
JavaScript
5
star
16

lilit-browser-extension

Lilit's Chrome browser extension
Scala
3
star
17

UIHorizontalTableView

Objective-C
3
star
18

backward-modal

iOS 4 to support self.presentingViewController
Objective-C
3
star
19

birdstagram

Objective-C
3
star
20

php_db_migrate

PHP Database Migration Library helps you manage changes in your database schemas.
PHP
3
star
21

loading.js

An elegant javascript that show a loading image on a button, an icon, or a textbox
JavaScript
2
star
22

dynonamics

Ruby
2
star
23

ruby_redis_lock

A distributed lock for Ruby (using Redis)
HTML
2
star
24

flash_hack

Java
2
star
25

sbt-web-test-js

Run Jasmine tests within playframework (or sbt-web-based project)
JavaScript
1
star
26

yabac

Yet a better auto-complete library
JavaScript
1
star
27

writepub_editor

A WYSIWYG editor for a public website
JavaScript
1
star
28

watir_labs

Techniques for Watir-WebDriver
JavaScript
1
star
29

dynonamics-rails-234

Dynonamics on Rails 2.3.4
Ruby
1
star
30

HopIn

JavaScript
1
star
31

pagination_helper

A library to generate pagination toolbar for WritePub
Ruby
1
star
32

loca_ios

Objective-C
1
star
33

wiky_editor

Wiky Editor - A jQuery-plugin that converts textarea into Wiki markup editor
JavaScript
1
star
34

UISuperTableView

UITableView with loading screen and no-data screen
Objective-C
1
star
35

thai-breakiterator

Java
1
star
36

whowish_foundation

JavaScript
1
star
37

writepub_editor_ruby

A HTML parser for Writepub editor
Ruby
1
star
38

dynonamics-server-3

JavaScript
1
star
39

loca_web

Ruby
1
star
40

jquery.default_text

jQuery.default_text - A jQuery plugin, which make a default input text by cloning the original
JavaScript
1
star
41

UILoader

Put a loading icon on any UIView
Objective-C
1
star
42

sass_fix_ie

It automatically includes zoom:1 and *display:inline for you, when you have display: inline-block. This is to fix the inline-block problem on IE7.
Ruby
1
star
43

dynonamics-rails-303

Dynonamics on Rails 3.0.3
Ruby
1
star