forked from albertlauncher/python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zeal.py
35 lines (26 loc) · 831 Bytes
/
zeal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- coding: utf-8 -*-
"""Open and search in Zeal offline docs.
Synopsis: <trigger> <query>"""
from shutil import which
from subprocess import run
from albertv0 import *
__iid__ = "PythonInterface/v0.1"
__prettyname__ = "Zeal"
__version__ = "1.0"
__trigger__ = "zl "
__author__ = "Manuel Schneider"
__dependencies__ = ["zeal"]
if which("zeal") is None:
raise Exception("'zeal' is not in $PATH.")
iconPath = iconLookup('zeal')
def handleQuery(query):
if query.isTriggered:
return Item(
id=__prettyname__,
icon=iconPath,
text=__prettyname__,
subtext="Look up %s" % __prettyname__,
completion=query.rawString,
actions=[ProcAction("Start query in %s" % __prettyname__,
["zeal", query.string])]
)