feat: Support context options
This commit is contained in:
parent
a852584a0d
commit
dae8108cb1
8 changed files with 220 additions and 37 deletions
48
README.md
48
README.md
|
|
@ -38,8 +38,12 @@ If you are writing a frontend, you are sending these events to the pop-launcher
|
|||
pub enum Request {
|
||||
/// Activate on the selected item
|
||||
Activate(Indice),
|
||||
/// Activate a context item on an item.
|
||||
ActivateContext { id: Indice, context: Indice },
|
||||
/// Perform a tab completion from the selected item
|
||||
Complete(Indice),
|
||||
/// Request for any context options this result may have.
|
||||
Context(Indice),
|
||||
/// Request to end the service
|
||||
Exit,
|
||||
/// Requests to cancel any active searches
|
||||
|
|
@ -54,7 +58,9 @@ pub enum Request {
|
|||
#### JSON Equivalent
|
||||
|
||||
- `{ "Activate": number }`
|
||||
- `{ "ActivateContext": { "id": number, "context": id }}`
|
||||
- `{ "Complete": number }`
|
||||
- `{ "Context": number }`
|
||||
- `"Exit"`
|
||||
- `"Interrupt"`
|
||||
- `{ "Quit": number }`
|
||||
|
|
@ -72,8 +78,16 @@ pub enum PluginResponse {
|
|||
Clear,
|
||||
/// Close the launcher
|
||||
Close,
|
||||
// Notifies that a .desktop entry should be launched by the frontend
|
||||
DesktopEntry(PathBuf),
|
||||
// Additional options for launching a certain item
|
||||
Context {
|
||||
id: Indice,
|
||||
options: Vec<ContextOption>,
|
||||
},
|
||||
// Notifies that a .desktop entry should be launched by the frontend.
|
||||
DesktopEntry {
|
||||
path: PathBuf,
|
||||
gpu_preference: GpuPreference,
|
||||
},
|
||||
/// Update the text in the launcher
|
||||
Fill(String),
|
||||
/// Indicoates that a plugin is finished with its queries
|
||||
|
|
@ -86,7 +100,8 @@ pub enum PluginResponse {
|
|||
- `{ "Append": PluginSearchResult }`,
|
||||
- `"Clear"`,
|
||||
- `"Close"`,
|
||||
- `{ "DesktopEntry": string }`
|
||||
- `{ "Context": { "id": number, "options": Array<ContextOption> }}`
|
||||
- `{ "DesktopEntry": { "path": string, "gpu_preference": GpuPreference }}`
|
||||
- `{ "Fill": string }`
|
||||
- `"Finished"`
|
||||
|
||||
|
|
@ -104,6 +119,21 @@ Where `PluginSearchResult` is:
|
|||
}
|
||||
```
|
||||
|
||||
`ContextOption` is:
|
||||
|
||||
```ts
|
||||
{
|
||||
id: number,
|
||||
name: string
|
||||
}
|
||||
```
|
||||
|
||||
`GpuPreference` is:
|
||||
|
||||
```ts
|
||||
"Default" | "NonDefault"
|
||||
```
|
||||
|
||||
And `IconSource` is either:
|
||||
|
||||
- `{ "Name": string }`, where the name is a system icon, or an icon referred to by path
|
||||
|
|
@ -117,8 +147,16 @@ Those implementing frontends should listen for these events:
|
|||
pub enum Response {
|
||||
// An operation was performed and the frontend may choose to exit its process.
|
||||
Close,
|
||||
// Notifies that a .desktop entry should be launched by the frontend
|
||||
DesktopEntry(PathBuf),
|
||||
// Additional options for launching a certain item
|
||||
Context {
|
||||
id: Indice,
|
||||
options: Vec<ContextOption>,
|
||||
},
|
||||
// Notifies that a .desktop entry should be launched by the frontend.
|
||||
DesktopEntry {
|
||||
path: PathBuf,
|
||||
gpu_preference: GpuPreference,
|
||||
},
|
||||
// The frontend should clear its search results and display a new list
|
||||
Update(Vec<SearchResult>),
|
||||
// An item was selected that resulted in a need to autofill the launcher
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue