mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-09-11 16:36:26 +00:00
feat: add deep link support
This commit introduces the deep link functionality, allowing the application to handle deep links from extensions.
This commit is contained in:
parent
3c3566136a
commit
887838bec6
8 changed files with 170 additions and 3 deletions
|
@ -13,7 +13,8 @@ use selection::get_text;
|
|||
use std::process::Command;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use tauri::Manager;
|
||||
use tauri::{Manager, Emitter};
|
||||
use tauri_plugin_deep_link::DeepLinkExt;
|
||||
|
||||
#[tauri::command]
|
||||
fn get_installed_apps() -> Vec<App> {
|
||||
|
@ -98,7 +99,16 @@ fn setup_global_shortcut(app: &mut tauri::App) -> Result<(), Box<dyn std::error:
|
|||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.manage(WsState::default())
|
||||
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
||||
.plugin(tauri_plugin_single_instance::init(|app, args, _cwd| {
|
||||
if args.len() > 1 && args[1].starts_with("raycast://") {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.emit("deep-link", args[1].to_string());
|
||||
window.show().unwrap();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
if let Ok(true) = window.is_visible() {
|
||||
let _ = window.hide();
|
||||
|
@ -108,6 +118,7 @@ pub fn run() {
|
|||
}
|
||||
}
|
||||
}))
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue