Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't drag from mtp mountpoint #34

Open
tkkcc opened this issue Mar 28, 2021 · 1 comment
Open

Can't drag from mtp mountpoint #34

tkkcc opened this issue Mar 28, 2021 · 1 comment

Comments

@tkkcc
Copy link

tkkcc commented Mar 28, 2021

When dragging from a gvfs-mtp mountpoint, dragon's behavior is different from thunar.

Thunar produce

file:///run/user/1000/gvfs/mtp:host=Android_OnePlus_a7de565f

Dragon produce

mtp:host=Android_OnePlus_a7de565f

Which can not be processed by chromium, so does all files in such mtp mountpoint.

@tkkcc
Copy link
Author

tkkcc commented Mar 30, 2021

g_file_get_uri will convert

/run/user/1000/gvfs/mtp:host=Android_OnePlus_a7de565f/...

to

mtp://Android_OnePlus_a7de565f/...

I can't find a perfect method to force the uri scheme to file instead of mtp. My current workaround is to use a wrapper to make a symlink to such files, which works well for chromium.

#!/usr/bin/env bash
exe=$(which -a $(basename $0) | grep -v $0 | head -1)
tmp=$(mktemp -d)
arg=("$@")
for ((i = 0; i < $#; ++i)); do
  src=${arg[i]}
  if [[ $src == *mtp:* ]]; then
    src=${src##file://}
    dst="$tmp/$src"
    mkdir -p "$(dirname "$dst")"
    ln -s "$src" "$dst"
    arg[i]="$dst"
  fi
done
$exe "${arg[@]}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant