#!/bin/sh
#
# name: Connect to VPN
# icon: network-vpn
# description: Start VPN
# keywords: vpn start connect
nmcli connection up "vpn-name"
## JSON IPC
Whether implementing a frontend or a plugin, the JSON codec used by pop-launcher is line-based. Every line will contain a single JSON message That will be serialized or decoded as a `Request`, `PluginResponse`, or `Response`. These types can be referenced in [docs.rs](https://docs.rs/pop-launcher). IPC is based on standard input/output streams, so you should take care not to write logs to stdout.
### Frontend JSON IPC
The frontend will send `Request`s to the pop-launcher service through the stdin pipe. The stdout pipe will respond with `Response`s. It is ideal to design your frontend to accept responses asynchronously. Sending `Interrupt` or `Search` will cancel any active searches being performed, if the plugins that are still actively searching support cancellation.
### Plugin JSON IPC
Plugins will receive `Request`s from pop-launcher through their stdin pipe. They should respond with `PluginResponse` messages.
### Request
If you are writing a frontend, you are sending these events to the pop-launcher stdin pipe. If you are writing a plugin, the plugin will be receiving these events from its stdin.
```rust
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
Interrupt,
/// Request to close the selected item
Quit(Indice),
/// Perform a search in our database
Search(String),
}
```
#### JSON Equivalent
- `{ "Activate": number }`
- `{ "ActivateContext": { "id": number, "context": id }}`
- `{ "Complete": number }`
- `{ "Context": number }`
- `"Exit"`
- `"Interrupt"`
- `{ "Quit": number }`
- `{ "Search": string }`
### PluginResponse
If you are writing a plugin, you should send these events to your stdout.
```rust
pub enum PluginResponse {
/// Append a new search item to the launcher
Append(PluginSearchResult),
/// Clear all results in the launcher list
Clear,
/// Close the launcher
Close,
// Additional options for launching a certain item
Context {
id: Indice,
options: Vec