Skip to content

Commit

Permalink
Add deep linking documentation and update argument handling
Browse files Browse the repository at this point in the history
A new document has been added on how to use deep linking in the application. The application's argument handling has also been updated to replace all instances of "%20" with a space for usability improvement and consistency with deep linking URL formatting.
  • Loading branch information
qianlifeng committed May 30, 2024
1 parent 048b136 commit 40f03f2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Wox/ui/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,11 @@ func handleDeeplink(w http.ResponseWriter, r *http.Request) {
}
}

// replace all %20 with space in arguments
for key, value := range arguments {
arguments[key] = strings.ReplaceAll(value, "%20", " ")
}

GetUIManager().PostDeeplink(ctx, commandResult.String(), arguments)

writeSuccessResponse(w, "")
Expand Down
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Query Shortcuts](query_shortcuts.md)
- [Action Panel](action_panel.md)
- [Selection Query](selection_query.md)
- [Deep Link](deep_link.md)

- Plugin

Expand Down
20 changes: 20 additions & 0 deletions docs/deep_link.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Deep Linking

Deep linking is a technique that allows an application to be launched and navigated to a specific location or state using a URL. This is particularly useful for complex
applications where you want to provide shortcuts to specific functionality or content.

In Wox, deep linking is supported through a specific URL format: `wox://command?param=value&param2=value2`. This URL format allows you to execute specific commands in Wox with
optional parameters.

## Supported Commands

Currently, Wox supports the following command for deep linking:

### Query

The `query` command allows you to execute a specific query in Wox. The format for this command is `wox://query?q=your%20query`. The `%20` is a URL-encoded space character, allowing
you to include spaces in your query.

For example, if you want to execute the query "search files", you would use the URL <a href="wox://query?q=search%20files" target="_blank">wox://query?q=search%20files</a>.

Please note that deep linking in Wox is case-sensitive, so ensure that your commands and parameters are correctly formatted.

0 comments on commit 40f03f2

Please sign in to comment.