Route URLs to different applications with pattern matching
Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/URLDispatcher.spoon.zip
Sets Hammerspoon as the default browser for HTTP/HTTPS links, and
dispatches them to different apps according to the patterns defined
in the config. If no pattern matches, default_handler is used.
| Signature | URLDispatcher.decode_slack_redir_urls |
|---|---|
| Type | Variable |
| Description | If true, handle Slack-redir URLs to apply the rule on the destination URL. Defaults to |
| Source | Source/URLDispatcher.spoon/init.lua line 30 |
| Signature | URLDispatcher.default_handler |
|---|---|
| Type | Variable |
| Description | Default URL handler (Defaults to |
| Notes | Can be a string containing the Bundle ID of an application, or a function that takes one argument, and which will be invoked with the URL to open. |
| Source | Source/URLDispatcher.spoon/init.lua line 21 |
| Signature | URLDispatcher.logger |
|---|---|
| Type | Variable |
| Description | Logger object used within the Spoon. Can be accessed to set the default log |
| Notes | Example: |
| Source | Source/URLDispatcher.spoon/init.lua line 99 |
| Signature | URLDispatcher.pat_files |
|---|---|
| Type | Variable |
| Description | Internal variable containing a table where the pattern lists read from files are kept indexed by file name, and automatically updated. |
| Source | Source/URLDispatcher.spoon/init.lua line 114 |
| Signature | URLDispatcher.pat_watchers |
|---|---|
| Type | Variable |
| Description | Internal variable containing a table where the watchers for the pattern files are kept indexed by file name. |
| Source | Source/URLDispatcher.spoon/init.lua line 119 |
| Signature | URLDispatcher.set_system_handler |
|---|---|
| Type | Variable |
| Description | If true, URLDispatcher sets itself as system handler for http requests. |
| Source | Source/URLDispatcher.spoon/init.lua line 108 |
| Signature | URLDispatcher.url_patterns |
|---|---|
| Type | Variable |
| Description | URL dispatch rules. |
| Notes | A table containing a list of dispatch rules. Rules are evaluated in the
order they are declared. Each rule is a table with the following structure:
|
| Source | Source/URLDispatcher.spoon/init.lua line 69 |
| Signature | URLDispatcher.url_redir_decoders |
|---|---|
| Type | Variable |
| Description | URL redirection decoders. Default value: empty list |
| Notes | List containing optional redirection decoders (other than the known Slack
decoder, which is enabled by
If given as strings, |
| Source | Source/URLDispatcher.spoon/init.lua line 35 |
| Signature | URLDispatcher:dispatchURL(scheme, host, params, fullUrl, senderPid) |
|---|---|
| Type | Method |
| Description | Dispatch a URL to an application according to the defined |
| Parameters |
|
| Returns | |
| Notes |
|
| Source | Source/URLDispatcher.spoon/init.lua line 188 |
| Signature | URLDispatcher:start() |
|---|---|
| Type | Method |
| Description | Start dispatching URLs according to the rules |
| Parameters |
|
| Returns | |
| Source | Source/URLDispatcher.spoon/init.lua line 312 |