Skip to content

Commit

Permalink
Trying to disable drag on linux again
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocky43007 committed Feb 2, 2025
1 parent 81c313c commit 775931d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
20 changes: 15 additions & 5 deletions apps/desktop/src-tauri/src/drag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,14 @@ 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>,
files: Vec<String>,
image: String,
on_event: Channel<CallbackResult>,
) -> 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
Expand Down Expand Up @@ -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<String>,
_image: String,
_on_event: Channel<CallbackResult>,
) -> 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() {
Expand Down
6 changes: 4 additions & 2 deletions apps/desktop/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 775931d

Please sign in to comment.