chore: fix build for linux (#143)

* chore: fix build for linux

* chore: fix build for linux
This commit is contained in:
Medcl
2025-02-18 08:26:52 +08:00
committed by GitHub
parent 6291df9f13
commit 4ba842f18b
3 changed files with 18 additions and 15 deletions

View File

@@ -36,9 +36,6 @@ tauri-plugin-updater = "2"
tauri-plugin-process = "2"
tauri-plugin-drag = "2"
[target."cfg(target_os = \"macos\")".dependencies]
tauri-nspanel = { git = "https://github.com/ahkohd/tauri-nspanel", branch = "v2" }
reqwest = "0.12.12"
futures = "0.3.31"
ordered-float = { version = "4.6.0", default-features = false }
@@ -56,6 +53,9 @@ base64 = "0.13"
walkdir = "2"
fuzzy_prefix_search = "0.2"
[target."cfg(target_os = \"macos\")".dependencies]
tauri-nspanel = { git = "https://github.com/ahkohd/tauri-nspanel", branch = "v2" }
[profile.dev]
incremental = true # Compile your binary in smaller steps.

View File

@@ -18,10 +18,7 @@ use reqwest::Client;
use std::path::PathBuf;
#[cfg(target_os = "macos")]
use tauri::ActivationPolicy;
use tauri::{
AppHandle, Emitter, Listener, Manager, PhysicalPosition, Runtime, WebviewWindow, Window,
WindowEvent,
};
use tauri::{AppHandle, Emitter, Listener, Manager, PhysicalPosition, Runtime, State, WebviewWindow, Window, WindowEvent};
use tauri_plugin_autostart::MacosLauncher;
use tauri_plugin_deep_link::DeepLinkExt;
use tokio::runtime::Runtime as RT;
@@ -53,8 +50,8 @@ struct Payload {
pub fn run() {
let mut ctx = tauri::generate_context!();
let app = tauri::Builder::default()
.plugin(tauri_nspanel::init())
let mut app_builder = tauri::Builder::default()
// .plugin(tauri_nspanel::init())
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_autostart::init(
@@ -68,6 +65,14 @@ pub fn run() {
.unwrap();
}))
.plugin(tauri_plugin_store::Builder::default().build())
// Conditional compilation for macOS
#[cfg(target_os = "macos")]
{
app_builder = app_builder.plugin(tauri_nspanel::init());
}
let app = app_builder
.invoke_handler(tauri::generate_handler![
change_window_height,
shortcut::change_shortcut,
@@ -182,7 +187,7 @@ pub async fn init<R: Runtime>(app_handle: &AppHandle<R>) {
let coco_servers = server::servers::get_all_servers();
// Get the registry from Tauri's state
let registry = app_handle.state::<SearchSourceRegistry>();
let registry:State<SearchSourceRegistry> = app_handle.state::<SearchSourceRegistry>();
for server in coco_servers {
let source = CocoSearchSource::new(server.clone(), Client::new());

View File

@@ -3,19 +3,17 @@ use tauri::{App, WebviewWindow};
#[cfg(target_os = "macos")]
mod mac;
#[cfg(target_os = "windows")]
mod win;
#[cfg(target_os = "linux")]
mod linux;
mod linux;
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "macos")]
pub use mac::*;
#[cfg(target_os = "windows")]
pub use win::*;
pub use windows::*;
#[cfg(target_os = "linux")]
pub use linux::*;