Skip to content

Commit 775931d

Browse files
committed
Trying to disable drag on linux again
1 parent 81c313c commit 775931d

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

apps/desktop/src-tauri/src/drag.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,14 @@ static TRACKING: AtomicBool = AtomicBool::new(false);
7070
/// * `on_event` - Channel for communicating drag operation events back to the frontend
7171
#[tauri::command(async)]
7272
#[specta::specta]
73+
#[cfg(not(target_os = "linux"))]
7374
pub async fn start_drag(
7475
window: WebviewWindow,
7576
_state: State<'_, DragState>,
7677
files: Vec<String>,
7778
image: String,
7879
on_event: Channel<CallbackResult>,
7980
) -> Result<(), String> {
80-
// If on linux, do not run and throw an error saying that it is not supported for now
81-
#[cfg(target_os = "linux")]
82-
{
83-
return Err("Drag and drop is not supported on Linux yet.".to_string());
84-
}
8581
// Check if image string is base64 encoded
8682
let icon_path = if image.starts_with("data:image/") {
8783
image
@@ -246,6 +242,20 @@ pub async fn start_drag(
246242
Ok(())
247243
}
248244

245+
#[tauri::command(async)]
246+
#[specta::specta]
247+
#[cfg(target_os = "linux")]
248+
pub async fn start_drag(
249+
_window: WebviewWindow,
250+
_state: State<'_, DragState>,
251+
_files: Vec<String>,
252+
_image: String,
253+
_on_event: Channel<CallbackResult>,
254+
) -> Result<(), String> {
255+
Err("Drag and drop is not supported on Linux".to_string())
256+
}
257+
258+
/// Stops the cursor position tracking for drag operations
249259
#[tauri::command(async)]
250260
#[specta::specta]
251261
pub async fn stop_drag() {

apps/desktop/src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ import getWindowHandler from '@sd/interface/app/$libraryId/settings/client/accou
4646
import { useLocale } from '@sd/interface/hooks';
4747
import { AUTH_SERVER_URL, getTokens } from '@sd/interface/util';
4848

49+
import { Transparent } from '../../../packages/assets/images';
4950
import { commands } from './commands';
5051
import { platform } from './platform';
5152
import { queryClient } from './query';
5253
import { createMemoryRouterWithHistory } from './router';
5354
import { createUpdater } from './updater';
54-
import { Transparent } from '../../../packages/assets/images';
5555

5656
declare global {
5757
interface Window {
@@ -146,7 +146,9 @@ function useDragAndDrop() {
146146
explorerStore.drag = null;
147147
};
148148

149-
const image = !Transparent.includes('/@fs/') ? Transparent : Transparent.replace('/@fs', '');
149+
const image = !Transparent.includes('/@fs/')
150+
? Transparent
151+
: Transparent.replace('/@fs', '');
150152

151153
await invoke('start_drag', {
152154
files: validFiles,

0 commit comments

Comments
 (0)