Giter Club home page Giter Club logo

devonthink-search-launchbar's Introduction

DEVONthink Launchbar Search Tool

What does it do?

The tool aims to let you search and navigate through DEVONthink effectively. It learns from your habit so that the items get hitted most will show at the top.

How does it work?

Just enter the keyword and it will do a live and prefix search then nicely present the results for you. Search Result

Create shortcuts for DEVONthink items

It is a pitty that we cannot create direct entries for DEVONthink items in LaunchBar. We have to first open this action then search then select one... What if we can create a shortcut for the item and make it accessible directly from LaunchBar without using this tool.

Well, you can! Just press ⌘ + ⌥ + ↵ on that item.

Make shortcut

Next time that item will be searchable directly from LaunchBar by its name.

Appears in LaunchBar result

You can later assign an abbreviation for it to access it faster.

Make sure ~/Documents/ is in the index of you LaunchBar otherwise it would not work. See here for more details.

Requirements

This tool requires Python3 to be installed at the path /usr/bin/python3. If you are using macOS Catalina or higher version, you can run this command in terminal

xcode-select --install

to install Python3.

See https://installpython3.com/mac/ for more details.

If you use homebrew or other ways to install Python3, make sure it is accessible via /usr/bin/python3.

Download

It can be downloaded here.

Modifier keys

If it is not a group:

  • ⌘ + ⌥ + ↵ to create shortcut for that item.
  • ⌘ + ↵ to reveal that item in DEVONthink
  • ⇧ + ↵ to reveal that item in Finder
  • ⌥ + ↵ to open that item externally

If it is a group:

  • ⌘ + ⌥ + ↵ to create shortcut for that item.
  • ⌘ + ↵ to reveal that item in DEVONthink
  • ⌥ + ↵ to navigate through that group in Launchbar

Note that if you are already in "navigation mode" (when you have pressed ⌥ + ↵ on a group), just press ↵ and you can continue navigate, press ⌥ + ↵ will instead open that group in DEVONthink.

Excluded tag

If you tag a file/group exclude-from-launchbar, it will not be shown in the result.

Config

You can adjust all those values in the config file config.py.

Config

config.py file:

# Do not change this class
class DefaultConfig:
    a = 0.8
    b = 0.5
    frequency_weight = 2
    excluded_tag = 'exclude-from-launchbar'
    max_result_num = 80 # Set to None to cancel the limit. Note that this may cause performance issue!
    shortcut_path = '~/Documents/DEVONthink' # Set to None to disable shortcut creation


# change this one
class UserConfig(DefaultConfig):
    a = 0.8
    b = 0.5
    frequency_weight = 2
    excluded_tag = 'exclude-from-launchbar'
    max_result_num = 80
    shortcut_path = '~/Documents/DEVONthink'

Do not change the DefaultConfig class. Instead change the properties of UserConfig.

The max_result_num option can be set to None so that all the results will be presented in LaunchBar. Note that too many results may cause performance issue!

More details

The "shorcuts"

As you may notice, the so-called shortcut is just a inetloc file created in your filesystem with the name and item link of the corresponding DEVONthink item. The default creation path is set to be ~/Documents/DEVONthink. You can change it to any other locations that you have write permission to, and make sure it is in your LaunchBar's index list. Set it to None will prevent the creation of any "shortcuts".

Frequency score

Except for the search score given by DEVONthink, the tool will adjust that score based on the frequency you open items.

final_score = search_score + weight * frequency_score

How do the tool calcuate the frequency_score?

Every time you choose a item, it update the frequency score of every item appears using the following formula.

frequency_score = old_score * a + (1 - a) * (1 if is_chosen else 0)

The initial value is 0. The frequency_score is set to b (in config.py) the first time it is selected. Later if it is not selected, the score will decrease according the the formula. But it will not drop below b.

Search query

The query template used is name:({}) tags!={}. So only the name is searched and the specific tag is excluded (default to exclude-from-launchbar). In more detail, each keyword entered is prepended with a ~. For example, if the text you type in LaunchBar is hello world, then the actual query will be name:(~hello ~world) tags!=exclude-from-launchbar.

devonthink-search-launchbar's People

Contributors

felidknight avatar thekoc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devonthink-search-launchbar's Issues

How to install

Sorry, this shouldn't an issue but I didn't know where else to put it.

I am being unbelievably thick and can't work out how to turn this collection of files into an installable LB action. Instructions would be really appreciated. Thank you.

Error in action.py ?

This looks really useful, but LaunchBar gives the error" "Script is invalid".

When I run action.py from BBEdit I get the log below. Is that of any help?

Traceback (most recent call last):
File "/Users/charles/Library/Application Support/LaunchBar/Actions/Search DEVONthink 3.lbaction/Contents/Scripts/action.py", line 56, in
main()
File "/Users/charles/Library/Application Support/LaunchBar/Actions/Search DEVONthink 3.lbaction/Contents/Scripts/action.py", line 24, in main
argument = json.loads(sys.argv[1])
IndexError: list index out of range

macOS 10.14.6 and I don't know the first thing about Python. which python3 gives /Users/charles/.pyenv/shims/python3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.