Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.Desktop problems
#11
The .desktop file is not like .exe. It's not a binary file. It's not an executable.
Anyway. Why not change it a bit? See 'Exec'.

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=SomeApp
Comment=SimiApp
Exec= /usr/bin/python3 /usr/share/applications/simi0op.py
Icon=/usr/share/icons/hicolor/48x48/apps/gw48.png
Terminal=true

OR

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=SomeApp
Comment=SimiApp
Exec=env python3 /usr/share/applications/simi0op.py
Icon=/usr/share/icons/hicolor/48x48/apps/gw48.png
Terminal=true

Search for an association of a mime type to an application.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#12
(Jan-26-2018, 07:16 AM)Gribouillis Wrote: Did you change anything to the .desktop file? In this case can you post it here, as an example of a .desktop file that works?

yes. I added a python3 shebang...actually I want to pm one of the admins to possibly set up a step-by-step guide to creating icon executable apps (and maybe desktop/mobile downloadble apps). I think it would be very instructional and there's nothing on SO or on YT (that I found at least...)

Quote:#!/usr/bin/env python3
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=testApp
Comment=SimiApp
Exec=/usr/share/applications/simi1.py
Icon=/usr/share/icons/hicolor/36x36/apps/gw36.png
Terminal=true



However I wrote up a new script and ran into a similar problem. I've attached the entire terminal sequence. I am sure I am screwing up on something very simple. I just can't catch it. Everything seems right. But I do get an error stating 'untrusted launch' and the icon won't appear. But everything is correct in the .desktop. THe following is the terminal sequence:

Quote:me@me-ubuntu:~$ ls -lsh Documents/py/cs/fishgm1.py Documents/py/cs/fishgm1.desktop Pictures/gonefishin36.png
4.0K -rwxr-xr-x 1 me me 210 Jan 27 02:04 Documents/py/cs/fishgm1.desktop
4.0K -rwxr-xr-x 1 me me 3.2K Jan 27 02:05 Documents/py/cs/fishgm1.py
12K -rw-r--r-- 1 me me 12K Jan 27 01:30 Pictures/gonefishin36.png
Clearly all files exist under user me with executable permissions across the board.

Next, I enter as root and cp everything where it should be:
Quote:me@me-ubuntu:~$ sudo -i
[sudo] password for me:
root@me-ubuntu:~# cp /home/me/Documents/py/cs/fishgm1.py /usr/share/applications/
root@me-ubuntu:~# cp /home/me/Documents/py/cs/fishgm1.desktop /usr/share/applications/
root@me-ubuntu:~# cp /home/me/Pictures/gonefishin36.png /usr/share/icons/hicolor/36x36/apps/
root@me-ubuntu:~# cp /home/me/Documents/py/cs/fishgm1.desktop /home/me/Desktop

then I cat the desktop files, but I see everything is right...
Quote:root@me-ubuntu:~# cat /home/me/Desktop/fishgm1.desktop
#!/usr/bin/env python3
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Fishin
Comment=fishin
Exec=/usr/share/applications/fishgm1.py
Icon=/usr/share/icons/hicolor/36x36/apps/gonefishin36.png
Terminal=true
root@me-ubuntu:~# cat /usr/share/applications/fishgm1.desktop
#!/usr/bin/env python3
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Fishin
Comment=fishin
Exec=/usr/share/applications/fishgm1.py
Icon=/usr/share/icons/hicolor/36x36/apps/gonefishin36.png
Terminal=true

Where am I going wrong...my previous executable runs without a hitch.....
Reply
#13
(Jan-27-2018, 08:11 AM)mepyyeti Wrote: yes. I added a python3 shebang
This is only needed in the python scripts.

mepyyeti Wrote:Next, I enter as root and cp everything where it should be:

Did you check the file's permission after the cp step? You could perhaps use cp -p

You could perhaps also use symlinks instead of copying
Output:
ln -s /home/me/Documents/py/cs/fishgm1.desktop /usr/share/applications/fishgm1.desktop
Reply
#14
previously mv was sufficient. so cp should also work. Permissions are set and paths are set. What gives?
Reply
#15
In my KDE system, I can run .desktop files from the command line by using
Output:
kioclient exec /path/to/myfile.desktop
You could perhaps find an equivalent command for your system and try the desktop file from the terminal.
Reply
#16
Quote:#!/usr/bin/env python3
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=testApp
Comment=SimiApp
Exec=/usr/share/applications/simi1.py
Icon=/usr/share/icons/hicolor/36x36/apps/gw36.png
Terminal=true
The shebang line goes into your python script, not your desktop launcher file.

Quote:I want to pm one of the admins to possibly set up a step-by-step guide to creating icon executable apps (and maybe desktop/mobile downloadble apps). I think it would be very instructional and there's nothing on SO or on YT (that I found at least...)
There really is no point to have it here at python-forum.io, as it is not python specific. You can make an alias to any command you want. You can have a launcher do anything, not just python. It could just be a bash script, ruby script, or even a compiled C script, etc. that the launcher launches. Is sounds more like a tutorial for ubuntu users rather than python. And to be honest, most linux users do not have the Windows mentality of double clicking things, but use the terminal. Thats exactly why i dont know how to do it, because i have never polluted my desktop with anything on linux in all the years i have used linux.

But if you want to make a tutorial for it, you can always post it in tutorial submissions here.
Recommended Tutorials:
Reply
#17
(Jan-27-2018, 07:18 PM)metulburr Wrote: But if you want to make a tutorial for it, you can always post it in tutorial submissions here.

The plan was to do so this weekend, actually. I was going to set up a BASIC step-by-step guide to creating downloadable terminal based games...since there's nowhere online to find any (I haven't at least). That was noobs like me can see an entire app from design to general implementaton instead of just running them on local machines.

Then this happened with my .desktop file. I know u guys frown on screencaps but I don't have a choice. I am trying to get A PY script to run via a desktop icon so it is related to the general goal of getting py to be appealing and its a USEFUL application of the lang. I have to post it here b/c on ask ubuntu my rep fell from 11 to 8...

I apologize but ... I do mean well and I just want to figure this out. I have two apps on the desktop. same permissions and everything. testApp/simi1.py works...fishgm1.py only works if I go thru the files gui >usr>share>applications>fishgm1.py ...It works fine...why doesn't it work thru the icon. Wall Wall Wall Wall Wall

Sorry about the attachment. IDK a better way to give the most amount of specific info in a quicker way...

Attached Files

Thumbnail(s)
   
Reply
#18
What happens if you replace the Exec with
Output:
Exec=/usr/bin/python3 /usr/share/applications/simi1.py
?
Reply
#19
I looked at the screenshot and I am asking, do you see that the owner of the file is root? Or it is supposed to be like that?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#20
@Gribouillis
Exec var is pretty much identical for testApp which works and for fishgm1 which does not work.
Exec = /usr/share/applications/simi1.py and Exec = /usr/share/applications/fishgm1.py Only the file changes.

@wavic
root permissions are the same for both files. I was also told that root ownership was the way to go b/c of /usr/. Even if root is wrong, then neither file should work....driving me crazy Huh Huh Huh Huh
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020