#tip #tooltip

tippytap

Library to help write Tip tooltips

2 unstable releases

0.2.0 Jun 1, 2020
0.1.0 Apr 20, 2020

#6 in #tooltip

MIT/Apache

7KB
75 lines

Tippytap

Tippytap is a Rust library to help you write tooltips for Tip, the "programmable tooltip that can be used with any Mac OS app".

Installation

Via cargo-edit:

cargo add tippytap

Example program

main.rs

use tippytap::prelude::*;

pub fn sci_hub_tooltip(doi: &str) -> TipUrlLine {
    TipUrlLine {
        label: "SciHub".to_owned(),
        value: format!("https://sci-hub.tw/{}", doi),
    }
}

fn main() {
    let input = std::env::args().nth(1).expect("Missing input");

    let output = vec![
        TipTextLine {
            value: format!("Input {}", input),
        }
        .into(),
        sci_hub_tooltip(&input).into(),
    ];
    print_tooltips(&output);
}

Dependencies

~0.7–1.5MB
~33K SLoC