We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

Create desktop icon for python script

asked 2015-07-04 22:44:18 +0200

mlwn gravatar image

updated 2015-07-05 15:04:29 +0200

I have written a python script to perform a certain action.

This script uses command line interaction.

If I use this script from fingerterm, it works like charm.

Problem:

When I tried creating a desktop icon for it ( added a .desktop entry ), it shows the icon on the desktop, when clicked it shows the working circle, but my fingerterm does not show or my application does not run.

this is the .desktop entry:

[Desktop Entry]
Type=Application
Terminal=true
Name=AppName
Exec=fingerterm -e "python /path/to/script/script.py"
Icon=/path/to/icon/icon.png

I am sure I missed something somewhere...

Could it be because the script is stored on external memory card ?

Thanks..

UPDATE

Very Strangely, I read somwhere that I can diagnose the .desktop entry as below:

awk -F= '/Exec=/{system($2)}' your_desktop_file.desktop

When I tried this in terminal, Jolla opened another terminal and my script was running in the new terminal...

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
2

answered 2015-07-04 23:24:47 +0200

Schturman gravatar image

try:
Exec=sh -c "fingerterm -e /path/to/script"

edit flag offensive delete publish link more

Comments

I need to call for python, so I tried Exec=sh -c "fingerterm -e python /path/to/script/script.py" ... but unfortunately, no success

mlwn ( 2015-07-04 23:30:42 +0200 )edit

do you have any menu in your script and this is a reason that you need to open terminal ? Because if you don't need terminal you can try directly: Exec=python /path/script

Schturman ( 2015-07-05 08:42:24 +0200 )edit

i need to get user input and give feedback. it's necessary to open terminal..

:(

mlwn ( 2015-07-05 12:53:31 +0200 )edit

Try this:
[Desktop Entry]
Type=Application
Name=YourName
Icon=YourIcon
Exec=sh -c "fingerterm -e python /path/to/script.py"
X-Desktop-File-Install-Version=0.20

or
[Desktop Entry]
Type=Application
Name=YourName
Icon=YourIcon
Exec=sh -c "fingerterm -e "python /path/to/script.py""
X-Desktop-File-Install-Version=0.20

Schturman ( 2015-07-05 13:35:28 +0200 )edit

Another option is to create simple scrip with this content:
#!/bin/sh

python /path/to/script.py

And in this case .desctop file should look like:
[Desktop Entry]
Type=Application
Name=YourName
Icon=YourIcon
Exec=sh -c "fingerterm -e /path/to/script.sh"
X-Desktop-File-Install-Version=0.20

Schturman ( 2015-07-05 13:47:02 +0200 )edit
Login/Signup to Answer

Question tools

Follow
4 followers

Stats

Asked: 2015-07-04 22:44:18 +0200

Seen: 3,861 times

Last updated: Jul 05 '15