mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-21 13:14:04 +02:00
much cleaner file structure
This commit is contained in:
parent
374dc45674
commit
296a844aaa
4 changed files with 72 additions and 84 deletions
40
src-tauri/Cargo.lock
generated
40
src-tauri/Cargo.lock
generated
|
@ -81,26 +81,6 @@ version = "1.0.86"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "app"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"rand 0.8.5",
|
|
||||||
"rdev",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"sqlx",
|
|
||||||
"tauri",
|
|
||||||
"tauri-build",
|
|
||||||
"tauri-plugin-autostart",
|
|
||||||
"tauri-plugin-clipboard-manager",
|
|
||||||
"tauri-plugin-global-shortcut",
|
|
||||||
"tauri-plugin-os",
|
|
||||||
"tauri-plugin-sql",
|
|
||||||
"tauri-plugin-window-state",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arboard"
|
name = "arboard"
|
||||||
version = "3.4.0"
|
version = "3.4.0"
|
||||||
|
@ -419,6 +399,26 @@ dependencies = [
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clipboard-manager"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"rand 0.8.5",
|
||||||
|
"rdev",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"sqlx",
|
||||||
|
"tauri",
|
||||||
|
"tauri-build",
|
||||||
|
"tauri-plugin-autostart",
|
||||||
|
"tauri-plugin-clipboard-manager",
|
||||||
|
"tauri-plugin-global-shortcut",
|
||||||
|
"tauri-plugin-os",
|
||||||
|
"tauri-plugin-sql",
|
||||||
|
"tauri-plugin-window-state",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clipboard-win"
|
name = "clipboard-win"
|
||||||
version = "5.3.1"
|
version = "5.3.1"
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
[package]
|
[package]
|
||||||
name = "app"
|
name = "clipboard-manager"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "A Tauri App"
|
description = "Clipboard manager"
|
||||||
authors = ["you"]
|
authors = ["pandadev"]
|
||||||
license = ""
|
|
||||||
repository = ""
|
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.70"
|
rust-version = "1.70"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "app_lib"
|
|
||||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2.0.0-beta.18", features = [] }
|
tauri-build = { version = "2.0.0-beta.18", features = [] }
|
||||||
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
mod clipboard_listener;
|
|
||||||
mod database;
|
|
||||||
mod global_shortcut;
|
|
||||||
mod tray;
|
|
||||||
|
|
||||||
use tauri::Manager;
|
|
||||||
use tauri_plugin_autostart::MacosLauncher;
|
|
||||||
use tauri_plugin_window_state::{AppHandleExt, StateFlags, WindowExt};
|
|
||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
||||||
pub fn run() {
|
|
||||||
tauri::Builder::default()
|
|
||||||
.plugin(tauri_plugin_os::init())
|
|
||||||
.plugin(tauri_plugin_autostart::init(
|
|
||||||
MacosLauncher::LaunchAgent,
|
|
||||||
Some(vec![]),
|
|
||||||
))
|
|
||||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
|
||||||
.plugin(tauri_plugin_clipboard_manager::init())
|
|
||||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
|
||||||
.plugin(tauri_plugin_sql::Builder::default().build())
|
|
||||||
.setup(|app| {
|
|
||||||
let app_handle = app.handle().clone();
|
|
||||||
|
|
||||||
global_shortcut::setup(app_handle.clone());
|
|
||||||
tray::setup(app)?;
|
|
||||||
database::setup(app)?;
|
|
||||||
clipboard_listener::setup(app_handle);
|
|
||||||
|
|
||||||
if let Some(window) = app.get_window("main") {
|
|
||||||
let _ = window.restore_state(StateFlags::POSITION);
|
|
||||||
window.show().unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
.on_window_event(|app, event| match event {
|
|
||||||
tauri::WindowEvent::CloseRequested { .. }
|
|
||||||
| tauri::WindowEvent::Destroyed
|
|
||||||
| tauri::WindowEvent::Focused(false) => {
|
|
||||||
let _ = AppHandleExt::save_window_state(app.app_handle(), StateFlags::POSITION);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
})
|
|
||||||
.invoke_handler(tauri::generate_handler![
|
|
||||||
clipboard_listener::simulate_paste
|
|
||||||
])
|
|
||||||
.run(tauri::generate_context!())
|
|
||||||
.expect("error while running tauri application");
|
|
||||||
}
|
|
|
@ -1,6 +1,52 @@
|
||||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
#![cfg_attr(
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
all(not(debug_assertions), target_os = "windows"),
|
||||||
|
windows_subsystem = "windows"
|
||||||
|
)]
|
||||||
|
|
||||||
|
mod clipboard_listener;
|
||||||
|
mod database;
|
||||||
|
mod global_shortcut;
|
||||||
|
mod tray;
|
||||||
|
|
||||||
|
use tauri::Manager;
|
||||||
|
use tauri_plugin_autostart::MacosLauncher;
|
||||||
|
use tauri_plugin_window_state::{AppHandleExt, StateFlags, WindowExt};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
app_lib::run();
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_os::init())
|
||||||
|
.plugin(tauri_plugin_autostart::init(
|
||||||
|
MacosLauncher::LaunchAgent,
|
||||||
|
Some(vec![]),
|
||||||
|
))
|
||||||
|
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||||
|
.plugin(tauri_plugin_clipboard_manager::init())
|
||||||
|
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||||
|
.plugin(tauri_plugin_sql::Builder::default().build())
|
||||||
|
.setup(|app| {
|
||||||
|
let app_handle = app.handle().clone();
|
||||||
|
|
||||||
|
global_shortcut::setup(app_handle.clone());
|
||||||
|
tray::setup(app)?;
|
||||||
|
database::setup(app)?;
|
||||||
|
clipboard_listener::setup(app_handle);
|
||||||
|
|
||||||
|
if let Some(window) = app.get_window("main") {
|
||||||
|
let _ = window.restore_state(StateFlags::POSITION);
|
||||||
|
window.show().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.on_window_event(|app, event| match event {
|
||||||
|
tauri::WindowEvent::CloseRequested { .. }
|
||||||
|
| tauri::WindowEvent::Destroyed
|
||||||
|
| tauri::WindowEvent::Focused(false) => {
|
||||||
|
let _ = AppHandleExt::save_window_state(app.app_handle(), StateFlags::POSITION);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
})
|
||||||
|
.invoke_handler(tauri::generate_handler![clipboard_listener::simulate_paste])
|
||||||
|
.run(tauri::generate_context!())
|
||||||
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue