You are not logged in.
Hello,
I would like to execute some program with a file as an argument by dragging that file on a starter.
Back in the times when I was using windows, it was a common way to start programs. For example I could just drag an image file on "some graphics editing program icon" and the program would open that file.
But I'm having difficulties getting that to work in xfce.
I'm checking for arguments and standard input with a little shell script:
#!/bin/bash
echo 'testdnd.sh'
echo 'First two arguments:'
echo -n '$1: '
echo $1
echo -n '$2: '
echo $2
echo 'Standard Input: '
while read line
do
echo "$line"
done < "${VAR:-/dev/stdin}"
read
I created a starter for that script:
[Desktop Entry]
Version=1.0
Type=Application
Name=testdnd
Comment=
Exec=/home/christoph/testdnd.sh
Icon=
Path=/home/christoph
Terminal=true
StartupNotify=true
GenericName=testdnd
X-Desktop-File-Install-Version=0.23
When I drag some file from the destop to that starter icon, the mouse cursor changes and displays a plus symbol '+'. That leads me to the conclusion that the drop will be accepted.
When I actually drop the file on the starter, the script executes, but I get no arguments or standard input.
How do I get the filename of the file that was dropped?
Is my expected behaviour supported by xfce?
Thanks,
Christoph
Using xfce 4.12 on Debian buster.
XFCE 4.12 on Debian/Linux (Buster) in German (my translations may be inaccurate)
Offline
The Freedesktop Desktop Entry Specification is located here. Of importance are the "field codes" in the Exec section.
Specifically:
Exec=/home/christoph/testdnd.sh %U
...where %U will hold the dropped file path and name that can be processed via $1 in your script.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Exec=/home/christoph/testdnd.sh %U
Wow, that was quick and helpful :-)
Thanks so much!
XFCE 4.12 on Debian/Linux (Buster) in German (my translations may be inaccurate)
Offline
[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 524 KiB (Peak: 528.88 KiB) ]