• This repository has been archived on 10/Jan/2020
  • Stars
    star
    190
  • Rank 203,739 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created about 7 years ago
  • Updated about 5 years ago

Reviews

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

Repository Details

Alfred 3+ workflow to search and use Safari bookmarks, history, reading list and tabs.

This workflow is no longer developed because Apple crippled Safari into pointlessness in v13.

Safari Assistant for Alfred 3/4

Search and open/activate your Safari bookmark(let)s and (iCloud) tabs from Alfred 3/4.

Includes several actions for tabs/bookmarks and allows you to add your own via scripts. Assign your favourite actions (and bookmarklets) to hotkeys.

Download & installation

Grab the workflow from GitHub releases. Download the Safari-Assistant-X.X.alfredworkflow file and double-click it to install.

macOS Mojave

If you're running macOS 10.14 (Mojave), you must grant Alfred "Full Disk Access".

Usage

  • bh [<query>] — Search and open/action bookmarks and recent history. (See History section below.)
    • ↩ — Open item in browser.
    • ⌘↩ — Show actions for selected item.
      • ↩ — Run selected action.
      • ⌘↩ — Add selected action to blacklist.
      • ⌘C — Copy name of action to clipboard (for setting custom actions).
    • ⌥↩ — Run custom action on selected item.
    • ^↩ — Run custom action on selected item.
    • fn↩ — Run custom action on selected item.
    • ⇧↩ — Run custom action on selected item.
  • bm [<query>] — Search and open/action bookmarks.
    • ↩, ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above.
  • bml [<query>] — Search and run bookmarklets.
    • ↩ — Run bookmarklet in active tab.
    • ⌘C — Copy bookmarklet ID to clipboard (for setting custom URL actions).
  • bmf [<query>] — Search bookmark folders.
    • ↩ — Enter folder/open bookmark.
    • ⌘↩ — Open all bookmarks in folder/show URL actions for bookmark.
  • hi [<query>] — Search and open/action history entries. (See History section below.)
    • ↩, ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above.
  • rl [<query>] — Search and open/action Reading List entries.
    • ↩, ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above.
  • tab [<query>] — Search and activate/action Safari tabs.
    • ↩ — Activate the selected tab.
    • ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above.
  • itab [<query>] — Search and open Cloud Tabs from other machines.
    • ↩ — Open the selected tab (URL).
    • ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above.
  • safass — Show help and configuration options.
    • View Help File — Open the workflow help file.
    • Edit Action Blacklist — Add/remove actions to blacklist.
    • Check for Update — Force manual check for update.
    • Report Problem on GitHub — Open GitHub issue tracker in your browser.
    • Visit Forum Thread — Open the workflow's thread on alfredforum.com.

Configuration

There are several settings in the workflow's configuration sheet:

  • ALSF_HISTORY_ENTRIES. Number of recent history entries to load for bh action (search bookmarks and recent history).
  • ALSF_INCLUDE_BOOKMARKLETS. Set this to 1 to include bookmarklets in the normal bookmark search (bm).
  • ALSF_SEARCH_HOSTNAMES. Set this to 1 to also search URL/tab hostnames in addition to titles.

The following settings assign actions for tabs/URLs:

Key Action
ALSF_TAB_CTRL ^↩ custom action/bookmarklet for tab
ALSF_TAB_OPT ⌥↩ custom action/bookmarklet for tab
ALSF_TAB_FN fn↩ custom action/bookmarklet for tab
ALSF_TAB_SHIFT ⇧↩ custom action/bookmarklet for tab
ALSF_URL_DEFAULT ↩ default action for bookmark/history entry
ALSF_URL_CTRL ^↩ custom action for bookmark/history entry
ALSF_URL_OPT ⌥↩ custom action for bookmark/history entry
ALSF_URL_FN fn↩ custom action for bookmark/history entry
ALSF_URL_SHIFT ⇧↩ custom action for bookmark/history entry

ALSF_URL_DEFAULT is the default script used to open URLs. The default setting is Open in Safari.

The ALSF_TAB_* variables assign custom actions or bookmarklets available when browsing Safari tabs. The ALSF_URL_* variables assign custom actions (not bookmarklets) to bookmarks and history entries.

To assign a script action, enter the corresponding script's name (without extension) as the value for the variable. To assign a bookmarklet, use bkm:<UID> where <UID> is the bookmarklet's UID.

In either case, press ⌘C on an action or bookmarklet in Alfred's UI to copy the corresponding value, then paste it into the configuration sheet as the value for the appropriate variable.

Blacklist

As some of the built-in actions may not be of any interest to some users (e.g. you don't have/use Firefox), they can be blacklisted so they are no longer shown in the list of actions.

You can blacklist an action directly from Alfred by pressing ⌘↩ on an action in the action list.

To remove an action from the blacklist, you must edit the blacklist.txt file directly. To do this, enter keyword safass in Alfred and choose Edit Action Blacklist from the list. This will open blacklist.txt in your default text-file editor.

If you add any actions to the blacklist manually, add one action (file)name per line, not including the file extension.

Action scripts

Much of the workflow's functionality is implemented via built-in scripts. You can also add your own scripts to provide additional tab and/or URL actions by placing the scripts in the appropriate directories.

To open the user script directory, enter the safass keyword into Alfred and choose the User Scripts option, which will reveal the scripts directory in Finder.

Scripts go in a subdirectory of the scripts directory depending on the type. Tab scripts go in scripts/tab, URL scripts in scripts/url.

When you view actions for a Safari tab, both tab and URL actions are listed (provided the tab has a valid URL). When you action a bookmark, only URL actions are listed.

Tab scripts are called with the indices of the selected window and tab as $1 and $2. So if the third tab of the second Safari window is active, your script is called as /path/to/script 2 3.

URL scripts are called with the URL of the selected bookmark or tab as $1, e.g. /path/to/script http://www.example.com.

See the built-in scripts (in the scripts subdirectory of the workflow) for examples of how to implement them.

If you create a script with the same name (minus extension) as one of the built-ins, it will override the built-in script.

Supported languages

The workflow knows to run .scpt, .js, .applescript and .scptd scripts via /usr/bin/osascript. It can also run any script/program with its executable bit set (it will call these directly).

Script icons

By default, tab scripts get a tab icon and URL scripts a URL one. You can supply a custom icon for any script by saving the icon alongside the script with the same basename (i.e. the same name as the script, only with a different file extension). Supported icon extensions are .png, .icns, .jpg, .jpeg and .gif.

Built-in actions

The following actions are built into the workflow, either hard-coded or as bundled scripts (in the scripts subdirectory of the workflow).

Tab actions

These actions are available for tabs only.

  • Close Tab
  • Close Window
  • Close Tabs to Left
  • Close Tabs to Right

URL actions

These actions are available for bookmarks and tabs (that have URLs).

  • Open URL in Default Browser
  • Open in Chrome
  • Open in Firefox
  • Open in Private Window

History

In Sierra and earlier, it was possible to search Safari's history with a File Filter. Unfortunately, the exported history files were removed in High Sierra, so it's now necessary to search Safari's SQLite History database instead.

The workflow accesses this database in two different ways.

The history search (keyword hi) uses SQLite's own search function, as there are too many entries to load and/or fuzzy search. As a result, the history search does not use fuzzy search.

The combined bookmark and recent history search (keyword bh) does use fuzzy search, but the trade-off is that it only reads a limited number of the most recent entries from the history database (specified by the ALSF_HISTORY_ENTRIES configuration option; 1000 by default).

Depending on the speed of your Mac and your own tolerance for slowness, you may be able to increase this number significantly.

Licensing & thanks

This workflow is released under the MIT Licence.

It is heavily based on the Kingpin and AwGo libraries (both also MIT).

The icons are from Elusive Icons, Font Awesome, Material Icons (all SIL) and Octicons (MIT), via the workflow icon generator.

More Repositories

1

alfred-workflow

Full-featured library for writing Alfred 3 & 4 workflows
Python
2,970
star
2

awgo

Go library for Alfred 3 + 4 workflows
Go
859
star
3

alfred-convert

Convert between different units in Alfred
Python
721
star
4

zothero

Rapidly search and cite Zotero entries from Alfred
Python
477
star
5

alfred-stackexchange

Search StackOverflow.com from Alfred
Python
434
star
6

alfred-fixum

Fix Alfred 3 Python workflows affected by the Sierra/Alfred-Workflow background process bug
Python
369
star
7

alfred-ssh

Open SSH/SFTP/mosh connections from Alfred 3+
Go
356
star
8

alfred-firefox

Search and control Firefox from Alfred
Go
342
star
9

alfred-repos

Browse, search and open Git repositories in Alfred
Python
313
star
10

alfred-searchio

Alfred workflow to auto-suggest search results from multiple search engines and languages.
HTML
306
star
11

alfred-pwgen

Generate passwords with Alfred
Python
290
star
12

alfred-fakeum

Generate fake test data in Alfred
Python
288
star
13

alfred-gcal

View Google Calendar events in Alfred
Go
222
star
14

alfred-reddit

Browse Reddit from Alfred
Python
214
star
15

alfred-vpn-manager

Manage Tunnelblick & Viscosity VPN connections from Alfred
Python
154
star
16

alfred-smartfolders

Quick access to your Smart Folders (Saved Searches) from Alfred
Python
119
star
17

alfred-fuzzy

Fuzzy search helper for Alfred 3+ workflows
Python
93
star
18

alfred-appscripts

Alfred workflow to search and run/open AppleScripts for the active application
Python
87
star
19

alfred-sublime-text

Filter and open your Sublime Text (2 and 3) project files from Alfred.
Go
73
star
20

i-sheet-you-not

Automagically turn Excel spreadsheets into Alfred 3 Workflows
Python
67
star
21

alfred-mailto

Send emails to recipients and groups from Alfred
Python
64
star
22

alfred-fuzzyfolders

Fuzzy search across folder subdirectories
Python
57
star
23

alfred-unicode

Preview Unicode characters and emoji in Alfred
Go
57
star
24

alfred-booksearch

Search Goodreads.com from Alfred
Go
56
star
25

alfred-similar-image-search

Google Image searches based on local files via Alfred
Python
50
star
26

alfred-packal-search

Search Packal.org's collection of Alfred workflows from Alfred
Python
43
star
27

alfred-services

Run macOS services from Alfred
Go
39
star
28

go-safari

Access Safari bookmarks, reading list, history and tabs (macOS)
Go
38
star
29

alfred-relative-dates

Alfred workflow to generate relative dates in different locales
Python
35
star
30

alfred-network-location

List, filter and activate network locations from within Alfred
Python
32
star
31

alfred-duden

Search the duden.de German dictionary from Alfred. With auto-suggest.
Python
32
star
32

alfred-index-demo

Demonstration of using sqlite as a search index in Alfred
Python
26
star
33

alfred-default-folder-x

Access your Default Folder X favourites and recent items in Alfred
Python
25
star
34

alfred-forklift

Filter ForkLift favourites in Alfred
Go
23
star
35

alfred-resolve-url

Alfred workflow to resolve HTTP redirects and return the canonical URL
Python
14
star
36

alfred-gifs

Say it with GIFs (and Alfred)
Python
12
star
37

bundler-icon-server

Generate PNG icons from icon fonts like Font Awesome
HTML
12
star
38

go-env

Access environment variables & populate structs from them
Go
11
star
39

alfred-errnum

Search macOS errors in Alfred 3
Python
10
star
40

alfred-mpd

Control mpd music player from Alfred 3
Python
9
star
41

go-fuzzy

Fuzzy matching & sorting for Go
Go
9
star
42

alfred-glosbe

Translate in Alfred using Glosbe.com
Python
8
star
43

CopyLink.mmBundle

MailMate Command to copy a link to the currently selected email
Python
8
star
44

alfred-transmit

Rapidly search Transmit favourites in Alfred
Go
5
star
45

alfred-bundler-python-demo

Demo Workflow showing how to use the Alfred Bundler in Python
Python
5
star
46

cookiecutter-alfred-workflow

cookiecutter template for Alfred 2 workflows
Python
4
star
47

alfred-star-ratings

Add star ratings to your files on OS X with Alfred
Python
4
star
48

alfred-excel-demo

Demo workflow showing how to use an Excel file as a data source for an Alfred Script Filter
Python
4
star
49

alfred-reminders-demo

Goto lists in Reminders.app
Python
3
star
50

bundler-icon-server-iconpacks

Icon packs for Bundler Icon Server
2
star
51

alfred-subdir-search

Alfred 2 Workflow to search subdirectories
Python
2
star
52

alfred-flixsearch

Search FlixSearch.io from Alfred 2
Python
2
star
53

www.deanishe.net

Hugo static site source
Go
1
star
54

just-a-test

Test Repo for GH API
1
star
55

alfred-workflow-dummy

A dummy repo for testing Alfred-Workflow's update functionality
Python
1
star
56

deanishe.github.io

Generated contents of www.deanishe.net
HTML
1
star