tauri-apps/tauri

[bug] `TauriEvent.DRAG_DROP` don't fire on Arch Linux with Wayland

Jisu-Woniu opened this issue · 8 comments

Describe the bug

When dragging files to Tauri apps on Arch Linux, the Tauri app can fire DRAG_ENTER, DRAG_OVER and DRAG_LEAVE events, but not DRAG_DROP.

Reproduction

  1. On Arch Linux, create a Tauri + Vue.js app with pnpm create tauri-app

  2. Follow the instructions to install the dependencies

  3. Replace the src/App.vue file with:

    <script setup lang="ts">
    import {
      listen,
      TauriEvent,
      type Event,
      type UnlistenFn,
    } from "@tauri-apps/api/event";
    import { onMounted, onUnmounted } from "vue";
    let unlistenFns: UnlistenFn[] = [];
    
    onMounted(async () => {
      const logEvent = (e: Event<unknown>) => {
        console.log(e.event, e.payload);
      };
      unlistenFns = await Promise.all([
        listen(TauriEvent.DRAG_ENTER, logEvent),
        // DRAG_OVER works but produces a lot of events, so we don't log them
        // listen(TauriEvent.DRAG_OVER, logEvent),
        listen(TauriEvent.DRAG_LEAVE, logEvent),
        listen(TauriEvent.DRAG_DROP, logEvent),
      ]);
    });
    onUnmounted(() => {
      for (const unlistenFn of unlistenFns) {
        unlistenFn();
      }
      // clear the array
      unlistenFns.length = 0;
    });
    </script>
    
    <template>
      <h1>Drag some files here</h1>
    </template>
  4. Run the app with pnpm tauri dev.

  5. Press Ctrl + Shift + I to open the DevTools window.

  6. Drag files to the app window and drop them.

Expected behavior

The app should produce one tauri://drag-enter event and one tauri://drag-drop event for each file.

But no tauri://drag-drop event is fired on my side.

Screenshot of logs

I have also checked with CrabNebula DevTools, only tauri://drag-enter, tauri://drag-over and tauri://drag-leave are filed.

Full tauri info output

> tauri-app@0.1.0 tauri **PROJ_DIR**
> tauri "info"


[✔] Environment
    - OS: Arch Linux Rolling Release x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.46.1
    ✔ rsvg2: 2.59.1
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (2024-05-07)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.18.0
    - pnpm: 9.12.1
    - npm: 10.9.0
    - bun: 1.1.30

[-] Packages
    - tauri 🦀: 2.0.2
    - tauri-build 🦀: 2.0.1
    - wry 🦀: 0.44.1
    - tao 🦀: 0.30.3
    - @tauri-apps/api : 2.0.2
    - @tauri-apps/cli : 2.0.2

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.1
    - @tauri-apps/plugin-shell : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

In case it is needed, I used KDE Plasma 6.1.5 (Wayland) on my machine.