From 775931d53de8246d60143e105ad18225ef69bc12 Mon Sep 17 00:00:00 2001 From: Arnab Chakraborty <11457760+Rocky43007@users.noreply.github.com> Date: Sun, 2 Feb 2025 03:26:55 -0500 Subject: [PATCH] Trying to disable drag on linux again --- apps/desktop/src-tauri/src/drag.rs | 20 +++++++++++++++----- apps/desktop/src/App.tsx | 6 ++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/apps/desktop/src-tauri/src/drag.rs b/apps/desktop/src-tauri/src/drag.rs index 6764cb57f060..cd88a5c8c1c3 100644 --- a/apps/desktop/src-tauri/src/drag.rs +++ b/apps/desktop/src-tauri/src/drag.rs @@ -70,6 +70,7 @@ static TRACKING: AtomicBool = AtomicBool::new(false); /// * `on_event` - Channel for communicating drag operation events back to the frontend #[tauri::command(async)] #[specta::specta] +#[cfg(not(target_os = "linux"))] pub async fn start_drag( window: WebviewWindow, _state: State<'_, DragState>, @@ -77,11 +78,6 @@ pub async fn start_drag( image: String, on_event: Channel, ) -> Result<(), String> { - // If on linux, do not run and throw an error saying that it is not supported for now - #[cfg(target_os = "linux")] - { - return Err("Drag and drop is not supported on Linux yet.".to_string()); - } // Check if image string is base64 encoded let icon_path = if image.starts_with("data:image/") { image @@ -246,6 +242,20 @@ pub async fn start_drag( Ok(()) } +#[tauri::command(async)] +#[specta::specta] +#[cfg(target_os = "linux")] +pub async fn start_drag( + _window: WebviewWindow, + _state: State<'_, DragState>, + _files: Vec, + _image: String, + _on_event: Channel, +) -> Result<(), String> { + Err("Drag and drop is not supported on Linux".to_string()) +} + +/// Stops the cursor position tracking for drag operations #[tauri::command(async)] #[specta::specta] pub async fn stop_drag() { diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index e1738d29569c..7ac7a7f03bb0 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -46,12 +46,12 @@ import getWindowHandler from '@sd/interface/app/$libraryId/settings/client/accou import { useLocale } from '@sd/interface/hooks'; import { AUTH_SERVER_URL, getTokens } from '@sd/interface/util'; +import { Transparent } from '../../../packages/assets/images'; import { commands } from './commands'; import { platform } from './platform'; import { queryClient } from './query'; import { createMemoryRouterWithHistory } from './router'; import { createUpdater } from './updater'; -import { Transparent } from '../../../packages/assets/images'; declare global { interface Window { @@ -146,7 +146,9 @@ function useDragAndDrop() { explorerStore.drag = null; }; - const image = !Transparent.includes('/@fs/') ? Transparent : Transparent.replace('/@fs', ''); + const image = !Transparent.includes('/@fs/') + ? Transparent + : Transparent.replace('/@fs', ''); await invoke('start_drag', { files: validFiles,