2

I'm using a LXDE desktop.

I created a shortcut in the desktop to a python program, which can be passed files to, which are then opened in the GUI.

I mean passing files (file absolute paths) to the command by drag'n'dropping them over the shortcut on the desktop.

In fact this is already working, but only if I set Terminal=true in the Desktop Entry, which obviously makes the terminal be opened. I wanted to know if there's a way to pass the arguments to the command without the need to open the terminal.

I'm creating the shortcut like this:

[Desktop Entry]
Name=TBOPlayer
Comment=UI for omxplayer
Exec=python /path/to/tboplayer/tboplayer.py "%F"
Icon=/usr/share/pixmaps/python.xpm
Terminal=true
Type=Application

Is there a way to do this?

2 Answers 2

1

Do you mean you want a specific option to always be true for the .desktop launcher, or you want some kind of dialogue box to appear which will allow you to enter options when you need to?

I assume the former, in which case just add the options to your Exec line:

Exec=python /path/to/tboplayer/tboplayer.py --foo "%F"
1
  • No. I mean passing files(file absolute paths) to the command by drag'n'dropping them over the shortcut on the desktop. As I said, that already works, but I wish to avoid having to open the terminal if that can be avoided. Thanks for your time. Commented Sep 7, 2015 at 20:42
1

For the record.

To do that one has to properly construct their script:

#!/usr/bin/python

import os, sys

if __name__ == '__main__':
    input_file = sys.argv[1]
    # do your stuff

and .desktop file

[Desktop Entry]
Comment=description
Exec=python /path/to/script.py "%F"
Icon=/usr/share/pixmaps/xterm.xpm
Name=script name

StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application

Where most important thing is Terminal=false which prevents running terminal. One may also want to turn off startup notification StartupNotify=false that will turn off, as name states, spinning waiting icon or anything of that sort.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.