diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index ac153419..c4220396 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -208,9 +208,9 @@ dependencies = [ [[package]] name = "async-broadcast" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cd0e2e25ea8e5f7e9df04578dc6cf5c83577fd09b1a46aaf5c85e1c33f2a7e" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" dependencies = [ "event-listener 5.3.1", "event-listener-strategy", @@ -4670,9 +4670,9 @@ dependencies = [ [[package]] name = "sea-orm" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b24d72a69e89762982c29af249542b06c59fa131f87cc9d5b94be1f692b427a" +checksum = "0dbcf83248860dc632c46c7e81a221e041b50d0006191756cb001d9e8afc60a9" dependencies = [ "async-stream", "async-trait", @@ -4698,9 +4698,9 @@ dependencies = [ [[package]] name = "sea-orm-cli" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653da4aba23cb596bf03d6f5faad274c74852c8ef014171a4fb9518032377105" +checksum = "7a8dbef29c7e534a8e9afb49abfa946c7a9df3d85f610dfed9140215ff8bff17" dependencies = [ "chrono", "clap", @@ -4715,9 +4715,9 @@ dependencies = [ [[package]] name = "sea-orm-macros" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0497f4fd82ecb2a222bea5319b9048f8ab58d4e734d095b062987acbcdeecdda" +checksum = "49ce6f08134f3681b1ca92185b96fac898f26d9b4f5538d13f7032ef243d14b2" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -4729,9 +4729,9 @@ dependencies = [ [[package]] name = "sea-orm-migration" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b271c0dd7729623d8debb5f017806f066902e3c287f08dc5ff312c3277dc6f" +checksum = "2e53f46fe9874161ba57b15ff45d2589d754d7cbbbaab9470cb79cbada149ca7" dependencies = [ "async-trait", "clap", @@ -4937,9 +4937,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "base64 0.22.1", "chrono", @@ -4955,9 +4955,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", @@ -6401,9 +6401,9 @@ dependencies = [ [[package]] name = "unicase" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-bidi" diff --git a/src-tauri/src/service/window.rs b/src-tauri/src/service/window.rs index 244347f5..916b0717 100644 --- a/src-tauri/src/service/window.rs +++ b/src-tauri/src/service/window.rs @@ -18,23 +18,20 @@ use tauri_plugin_positioner::{Position, WindowExt}; /// App pub fn init_window() { - tauri::async_runtime::spawn(async { - let size = calculate_logical_size(MAIN_WINDOW_X, MAIN_WINDOW_Y).await; + #[cfg(any(windows, target_os = "macos"))] + { get_main_window() - .set_size(size) - .expect("Failed to set window size"); - - #[cfg(any(windows, target_os = "macos"))] - { - let _ = get_main_window().set_decorations(false); - let _ = get_main_window().set_shadow(true); - } + .set_decorations(false) + .expect("Failed to set decorations"); + get_main_window() + .set_shadow(false) + .expect("Failed to set shadow"); + } - #[cfg(debug_assertions)] - { - get_main_window().open_devtools(); - } - }); + #[cfg(debug_assertions)] + { + get_main_window().open_devtools(); + } } pub fn toggle_main_window() { @@ -72,7 +69,6 @@ pub fn toggle_main_window() { ) .expect("Failed to emit change tab event"); get_main_window().show().expect("Failed to show window"); - register_hotkeys(true); get_main_window() .emit( @@ -134,27 +130,9 @@ pub fn position_window_near_cursor() { if let Ok(cursor_position) = window.cursor_position() { let window_size = window.outer_size().expect("Failed to get window size"); - - // Get current monitor or fallback to primary let current_monitor = window - .available_monitors() - .expect("Failed to get available monitors") - .into_iter() - .find(|monitor| { - let pos = monitor.position(); - let size = monitor.size(); - let bounds = ( - pos.x as f64, - pos.y as f64, - pos.x as f64 + size.width as f64, - pos.y as f64 + size.height as f64, - ); - - cursor_position.x >= bounds.0 - && cursor_position.x < bounds.2 - && cursor_position.y >= bounds.1 - && cursor_position.y < bounds.3 - }) + .current_monitor() + .expect("Failed to get current monitor") .unwrap_or_else(|| { window .primary_monitor() @@ -166,29 +144,34 @@ pub fn position_window_near_cursor() { let monitor_pos = current_monitor.position(); let monitor_size = current_monitor.size(); - // Calculate window position with offset + // Account for Windows DPI scaling + #[cfg(windows)] + let (cursor_x, cursor_y) = ( + cursor_position.x / scale_factor, + cursor_position.y / scale_factor, + ); + #[cfg(not(windows))] + let (cursor_x, cursor_y) = (cursor_position.x, cursor_position.y); + let pos = PhysicalPosition::new( - ((cursor_position.x + 10.0) * scale_factor) as i32, - ((cursor_position.y + 10.0) * scale_factor) as i32, + (cursor_x * scale_factor) as i32, + (cursor_y * scale_factor) as i32, ); - // Calculate monitor bounds in physical pixels let monitor_bounds = ( (monitor_pos.x as f64 * scale_factor) as i32, (monitor_pos.y as f64 * scale_factor) as i32, - (monitor_pos.x as f64 * scale_factor + monitor_size.width as f64 * scale_factor) as i32, - (monitor_pos.y as f64 * scale_factor + monitor_size.height as f64 * scale_factor) - as i32, + ((monitor_pos.x as f64 + monitor_size.width as f64) * scale_factor) as i32, + ((monitor_pos.y as f64 + monitor_size.height as f64) * scale_factor) as i32, ); - // Constrain window position within monitor bounds let final_pos = PhysicalPosition::new( pos.x .max(monitor_bounds.0) - .min(monitor_bounds.2 - window_size.width as i32), + .min(monitor_bounds.2 - (window_size.width as f64 * scale_factor) as i32), pos.y .max(monitor_bounds.1) - .min(monitor_bounds.3 - window_size.height as i32), + .min(monitor_bounds.3 - (window_size.height as f64 * scale_factor) as i32), ); window @@ -196,7 +179,6 @@ pub fn position_window_near_cursor() { .expect("Failed to set window position"); } } - pub fn calculate_thumbnail_dimensions(width: u32, height: u32) -> (u32, u32) { let aspect_ratio = width as f64 / height as f64; if width > MAX_IMAGE_DIMENSIONS || height > MAX_IMAGE_DIMENSIONS { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 07f2c8b0..f7d1d011 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -14,10 +14,6 @@ "csp": null }, "macOSPrivateApi": true, - "trayIcon": { - "iconPath": "icons/32x32.png", - "iconAsTemplate": true - }, "windows": [ { "fullscreen": false, diff --git a/src/components/pages/app/clipboard/base-clipboard.tsx b/src/components/pages/app/clipboard/base-clipboard.tsx index acbd37b1..7c2d80b4 100644 --- a/src/components/pages/app/clipboard/base-clipboard.tsx +++ b/src/components/pages/app/clipboard/base-clipboard.tsx @@ -79,21 +79,21 @@ export const BaseClipboard: Component = (props) => { title="Star" class={`${ clipboard.star ? "text-yellow-400 dark:text-yellow-300" : "hidden text-zinc-700" - } cursor-pointer text-lg hover:text-yellow-400 group-hover:block dark:text-white dark:hover:text-yellow-300`} + } cursor-pointer hover:text-yellow-400 group-hover:block dark:text-white dark:hover:text-yellow-300`} />
{props.data.rtf && (
@@ -103,7 +103,7 @@ export const BaseClipboard: Component = (props) => { handleDelete(clipboard.id); }} title="Delete" - class="hidden cursor-pointer text-lg text-zinc-700 hover:text-red-600 group-hover:block dark:text-white dark:hover:text-red-600" + class="hidden cursor-pointer text-zinc-700 hover:text-red-600 group-hover:block dark:text-white dark:hover:text-red-600" /> diff --git a/src/components/pages/app/clipboard/text-clipboard.tsx b/src/components/pages/app/clipboard/text-clipboard.tsx index 7bf4fe5c..68011709 100644 --- a/src/components/pages/app/clipboard/text-clipboard.tsx +++ b/src/components/pages/app/clipboard/text-clipboard.tsx @@ -18,6 +18,7 @@ interface TextClipboardProps { export const TextClipboard: Component = (props) => { let type = ClipboardType.Text; + let data = props.data.text?.data; let textType = props.data.text?.type as ClipboardTextType; @@ -68,7 +69,7 @@ export const TextClipboard: Component = (props) => { e.stopPropagation(); await invokeCommand(InvokeCommand.CopyClipboard, { id: props.data.clipboard.id, - type, + type: ClipboardType.Text, }); }; @@ -79,7 +80,7 @@ export const TextClipboard: Component = (props) => {
-

{data}

+

{data}