Exemplo n.º 1
0
paste_action = u"\u2325 Paste clipboard"
quicklook_action = u"\u21E7 Quicklook"

if notes.useZettelId():
    query_alt = query
    query = u"{0} {1}".format(zettel_id, query_alt)
    zettel_action = u"\u2318 Remove Zettel ID"

items.setItem(
    arg=u"{0}||".format(query),
    subtitle=u"\"{0}\" ({1}, {2})".format(query, zettel_action, paste_action),
    title="Create note",
)
items.addMod(
    arg=u"{0}||".format(query_alt),
    key="cmd",
    subtitle=u"\"{0}\" ({1})".format(query_alt, paste_action),
)
items.addMod(
    arg=u"{0}||paste".format(query),
    icon_path="icons/new_from_clipboard.png",
    icon_type="image",
    key="alt",
    subtitle=u"\"{0}\" ({1})".format(query, zettel_action),
)
items.addMod(
    arg=u"{0}||paste".format(query_alt),
    icon_path="icons/new_from_clipboard.png",
    icon_type="image",
    key="cmd+alt",
    subtitle=u"\"{0}\"".format(query_alt),
Exemplo n.º 2
0
    wf.setItem(
        title="3rd Party Integration in 1Password is disabled!",
        subtitle=
        u'1Password > Preferences > Advanced > Integratons > [x] Enable Spotlight and 3rd party app integrations',
        valid=False)
    wf.addItem()
    passwords = list()

for p in passwords:
    # Add Password item if no vaultNames are defined OR item's vault name in valutName config
    # AND
    # query empty OR query match item title
    if ((vaults[0] == str() or p.get('vaultName') in vaults) and
        (query == str() or query.lower() in p.get('itemTitle').lower())):
        uuid = p.get('uuid')
        itemTitle = p.get('itemTitle')
        itemDesc = p.get('itemDescription')

        url = p.get('websiteURLs')[0] if p.get('websiteURLs') else str()

        wf.setItem(title=itemTitle,
                   subtitle=itemDesc,
                   arg=uuid,
                   quicklookurl=url)
        if url:
            wf.setIcon('purl.png', "image")
            wf.addMod(key="cmd", subtitle='OPEN: {0}'.format(url), arg=url)
            wf.addModsToItem()
        wf.addItem()
wf.write()
Exemplo n.º 3
0
        links = m.get('links')
        for l in links:
            url_title = l.get('url_title')
            url = l.get('url')
            # subtitle = '%s > %s' % (url_title, url) if url_title != url else url
            subtitle = 'NOTE: {0} URL: {1}...'.format(note_title, url[:30])
            alf.setItem(
                title=url_title,
                subtitle=subtitle,
                arg=url,
                quicklookurl=url
            )
            alf.addMod(
                'cmd',
                note_path,
                'Open MD Note',
                icon_path='icons/markdown.png',
                icon_type='image'
            )
            alf.addMod(
                'alt',
                url,
                "Copy URL to Clipboard",
                icon_path='icons/clipboard.png',
                icon_type='image'
            )
            alf.addItem()
else:
    alf.setItem(
        title='No Bookmarks found...',
        subtitle='try again',
Exemplo n.º 4
0
todos = md_search.todoSearch(query)

wf = Items()
if len(todos) > 0:
    for i in todos:
        md_path = urllib.pathname2url(i['path'])
        md_title = i['title'] if i['title'] != str() else Tools.chop(
            i['filename'], ext)
        wf.setItem(title=i['todo'],
                   subtitle=u'\u2192 {0} (Created: {1})'.format(
                       md_title.decode('utf-8'), Tools.getDateStr(i['ctime'])),
                   arg=i['path'],
                   valid=True,
                   type='file')
        wf.setIcon('icons/unchecked.png', 'image')
        # Mod for CMD - new action menu
        wf.addMod(key="cmd",
                  arg="{0}>{1}".format(i['path'], query),
                  subtitle="Actions..",
                  icon_path="icons/action.png",
                  icon_type="image")
        # TODO: REmove
        # wf.addModsToItem()
        wf.addItem()
else:
    wf.setItem(title="No todo found!",
               subtitle="No todo matches search term",
               valid=False)
    wf.addItem()
wf.write()
Exemplo n.º 5
0
    tag_results = search.tags(query, 'count', reverse=True)

if bool(tag_results):
    for tag, counter in tag_results.items():
        items.setItem(
            arg=
            tag,  # we cannot yet send a hash character with `thearchive://match/{query}`
            subtitle=u"{0} Hit(s), (\u2318 Paste Into Frontmost Application)".
            format(counter),
            title=tag,
            valid=True,
        )
        items.setIcon('icons/hashtag.png', 'image')
        items.addMod(
            arg=u"#{0} ".format(tag),
            icon_path='icons/paste.png',
            icon_type='image',
            key='cmd',
            subtitle='Paste this tag into the frontmost application',
        )
        items.addItem()
else:
    items.setItem(
        subtitle="No Tags matches search term",
        title="No Tags found!",
        valid=False,
    )
    items.addItem()

items.write()
Exemplo n.º 6
0
else:
    sorted_file_list = md_search.getFilesListSorted()
# Write search results into WF object
for f in sorted_file_list:
    c_date = Tools.getDateStr(f['ctime'])
    m_date = Tools.getDateStr(f['mtime'])
    wf.setItem(
        title=f['title'],
        subtitle=
        u"Created: {0}, Modified: {1} ({2} \u2192 Actions, {3} \u2192 Quicklook)"
        .format(c_date, m_date, u'\u2318', u'\u21E7'),
        type='file',
        arg=f['path'])
    # Mod for CMD - new action menu
    wf.addMod(key="cmd",
              arg="{0}>{1}".format(f['path'], query),
              subtitle="Enter Actions Menu for the Note...",
              icon_path="icons/action.png",
              icon_type="image")
    wf.addModsToItem()
    wf.addItem()

if len(wf.getItems(response_type="dict")['items']) == 0:
    wf.setItem(
        title="Nothing found...",
        subtitle="Do you want to create a new note with title \"{0}\"?".format(
            query),
        arg=query)
    wf.addItem()
wf.write()
Exemplo n.º 7
0
     subtitle=
     u'\u2192 {0} (\u2318 Open in The Archive, \u2325 Open in Default Editor)'
     .format(file['filename'].decode('utf-8')),
     title=file['todo'],
     type='file',
     valid=True,
     variables={
         "todo": file['todo'],
         "todo_query": query,
         "todo_status": file['status'],
     },
 )
 items.addMod(
     arg=file['path'],
     icon_path="icons/the-archive.png",
     icon_type="image",
     key="cmd",
     subtitle=u"Open \"{0}\" in The Archive".format(file['filename']),
 )
 items.addMod(
     arg=file['path'],
     icon_path="icons/editor.png",
     icon_type="image",
     key="alt",
     subtitle=u"Open \"{0}\" in the default editor".format(
         file['filename']),
 )
 items.setIcon(
     'icons/todo.png'
     if file['status'] == 'pending' else 'icons/done.png', 'image')
 items.addItem()
    # Write search results into WF object

    for f in search_results_list:
        c_date = Tools.getDateStr(f['ctime'])
        m_date = Tools.getDateStr(f['mtime'])
        # md_path = urllib.pathname2url(f['filename'])
        md_path = f['filename'].replace(' ', '%20')
        url_scheme_path = md_search.getUrlScheme(f['path'])
        wf.setItem(title=f['title'],
                   subtitle="Created: %s, Modified: %s" % (c_date, m_date),
                   type='file',
                   arg=f['path'])
        # Mod for CTRL - delete a Note
        wf.addMod(key="ctrl",
                  arg=Tools.strJoin(f['path'], '|', query),
                  subtitle="Delete Note",
                  valid=True,
                  icon_path="icons/delete.png",
                  icon_type="image")
        wf.addModsToItem()
        # Mod for CMD - get markdown link to Note
        wf.addMod(key='cmd',
                  arg='[%s](%s)' % (f['filename'], md_path),
                  subtitle='Copy Markdown Link to Clipboard',
                  valid=True,
                  icon_path='icons/link.png',
                  icon_type='image')
        wf.addModsToItem()
        # Mod for ALT - Export to Evernote
        wf.addMod(key='alt',
                  arg=f['path'],
                  subtitle='Export Note to Evernote',
Exemplo n.º 9
0
else:
    sorted_file_list = search.getFilesListSorted()

for file in sorted_file_list:
    c_date = Tools.getDateStr(file['ctime'])
    m_date = Tools.getDateStr(file['mtime'])
    items.setItem(
        arg=file['path'],
        subtitle=u"Created: {0}, Modified: {1} (\u2318 Actions, \u2325 Paste Wiki Link, \u21E7 Quicklook)".format(c_date, m_date),
        title=file['title'],
        type="file",
    )
    items.addMod(
        arg="{0}|>{1}".format(file['path'], query),
        icon_path="icons/action.png",
        icon_type="image",
        key="cmd",
        subtitle="Enter Actions Menu for the Note...",
    )
    items.addMod(
        arg=file['title'],
        icon_path="icons/paste.png",
        icon_type="image",
        key="alt",
        subtitle="Paste wiki link into frontmost app",
    )
    items.addItem()

if len(items.getItems(response_type="dict")['items']) == 0:
    items.setItem(
        arg=query,
Exemplo n.º 10
0
    # Tag Search and sort based on tag name
    tag_results = md.tagSearch(query, 'tag', reverse=False)
else:
    # Tag Search and sort based on number of Hits
    tag_results = md.tagSearch(query, 'count', reverse=True)

wf = Items()

if bool(tag_results):
    for tag, counter in tag_results.items():
        wf.setItem(
            title='{0}'.format(tag),
            subtitle=u"{0} Hit(s), (\u2318 to paste tag into frontmost app)".
            format(counter),
            valid=True,
            arg='#{0}'.format(tag))
        wf.setIcon('icons/hashtag.png', 'image')
        wf.addMod(key='cmd',
                  arg='#{0} '.format(tag),
                  subtitle='Paste Tag into frontmost app',
                  icon_path='icons/paste.png',
                  icon_type='image')
        wf.addItem()
else:
    wf.setItem(title="No Tags found!",
               subtitle="No Tags matches search term",
               valid=False)
    wf.addItem()

wf.write()
Exemplo n.º 11
0
config_file = os.path.join(wf_data_dir, "folders.json")
wf = Items()
if os.path.isfile(config_file):
    with open(config_file, "r") as f:
        config = json.load(f)
    # List Folders from folders.json
    if len(config.keys()) > 0:
        for k, v in config.items():
            if os.path.isdir(v) and (query == str()
                                     or k.lower().startswith(query.lower())):
                wf.setItem(
                    title=k,
                    subtitle=
                    u"\u23CE to list Files or \u2318 for addtional actions",
                    arg=v)
                wf.addMod(key="cmd", arg=v, subtitle="Enter Action Menu")
                wf.addModsToItem()
            elif not (os.path.isdir(v)):
                wf.setItem(title=k, subtitle="Folder not found!", arg=k)
                wf.setIcon("attention.png", "image")
            wf.addItem()
    else:
        wf.setItem(title="Folder configuration is empty",
                   subtitle="Add folder via File Action",
                   valid=False)
        wf.setItem('attention.png', 'image')
        wf.addItem()
else:
    wf.setItem(
        title="Add Folder(s) to config",
        subtitle=
Exemplo n.º 12
0
        quicklook_url = create_hint_file(wf_path, content)
        ip = wf_path + "/icon.png"
        # use default icon in alf WF directory in case searched wf has not icon defined
        icon_path = ip if os.path.isfile(ip) else 'icon.png'
        keyword_text = kf.get_keywords_scriptfilter()
        valid = kf.has_keywords()
        subtitle = description + \
            u', Press \u23CE to choose from Keyword(s): ' + \
            keyword_text if valid else description
        arg = os.path.dirname(info_plist_path) + "|" + name
        alf.setItem(title=name,
                    subtitle=subtitle,
                    arg=arg,
                    automcomplete=name,
                    valid=valid,
                    quicklookurl=quicklook_url)
        alf.setIcon(icon_path, m_type="image")
        alf.addMod('cmd',
                   subtitle='Choose Action...',
                   arg=arg,
                   icon_path='icons/start.png',
                   icon_type='image',
                   valid=True)
        alf.addItem()
else:
    alf.setItem(title='No Workflow matches the search query!',
                subtitle='...for query: \"%s\"' % query,
                valid=False)
    alf.addItem()
alf.write()