Variables in .desktop files
Posted: Wed Oct 13, 2010 9:59 pm
I'm trying to modify the .desktop files in ~/.local/share/applications and have some problems with the variables. I thought %f stands for the current file and %u for the url (this is the directory or?). But all variables that I have tried (%f, %F, %u, %U) have all the same value. It's the path to the file including the filename.
Just an example:
My mimeapps.list has the content:
My ~/.local/share/applications/test.dektop has the content:
I have in ~/Data a test.py with the content:
And in ~/Data is an empty click.txt for testing.
If I right click the click.txt and select test lxterminal show me /home/sworddragon/Data/click.txt. I don't know how to access the directory with a variable.
Just an example:
My mimeapps.list has the content:
Code: Select all
[Added Associations]
text/plain=test.desktop;
Code: Select all
[Desktop Entry]
Type=Application
Name=test
Exec=lxterminal -e python /home/sworddragon/Data/test.py --var1 %u --var2 test2
NoDisplay=true
Code: Select all
import optparse
arguments = optparse.OptionParser()
arguments.add_option('--var1', dest = 'var1')
arguments.add_option('--var2', dest = 'var2')
(option, arguments) = arguments.parse_args()
print(option.var1)
raw_input('')
If I right click the click.txt and select test lxterminal show me /home/sworddragon/Data/click.txt. I don't know how to access the directory with a variable.