Nervousninja
Posts: 2
Joined: Thu Jul 04, 2019 5:09 am

Opening a .Desktop file on Boot

Thu Jul 04, 2019 5:14 am

Hey all,

Sorry if this is super obvious, but I am just learning :-). So I have successfully followed some tutorials and am getting my feet wet in Raspberry Pi and Python. I recently got the Cool-Retro-Terminal going and love it. That said, I would like to figure out how to have the Raspberry boot with the new "skinned" terminal open. All of the forum post I can find on things Auto-Starting on boot talk about a Python file. But from what I can tell, the Cool-Retro-Term is a Desktop Entry and not a Py... Thoughts on how I make a ".desktop" file run on boot? Thanks all.

klricks
Posts: 6593
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Opening a .Desktop file on Boot

Thu Jul 04, 2019 2:41 pm

Nervousninja wrote:
Thu Jul 04, 2019 5:14 am
Hey all,

Sorry if this is super obvious, but I am just learning :-). So I have successfully followed some tutorials and am getting my feet wet in Raspberry Pi and Python. I recently got the Cool-Retro-Terminal going and love it. That said, I would like to figure out how to have the Raspberry boot with the new "skinned" terminal open. All of the forum post I can find on things Auto-Starting on boot talk about a Python file. But from what I can tell, the Cool-Retro-Term is a Desktop Entry and not a Py... Thoughts on how I make a ".desktop" file run on boot? Thanks all.
I don't know what you mean by .desktop file?
To start a GUI based program on boot / desktop login, it is easiest IMO to use autostart.

Code: Select all

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Pretty much any program or command which can be executed from the command line can be run by autostart not just Python scripts.
For example to autostart filemanager you would put this in autostart:

Code: Select all

pcmanfm
Be sure to leave in the existing commands in autostart.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

Nervousninja
Posts: 2
Joined: Thu Jul 04, 2019 5:09 am

Re: Opening a .Desktop file on Boot

Fri Jul 05, 2019 7:13 am

Yes, sorry again if I am blatantly missing some simple facts, as I am "crash-coursing' a lot of this and trying to catch up on a lot of these tutorial. To be clear, I am referring to the fact that all of the tutorials I have read for Autostart end with pointing to a ".py" file. And I want to autostart a ".desktop" file. I suppose perhaps they are the same thing, and I am so used to Windows files stil (.gif vs .jpg). But to date I have not found a tutorial that states to do autostart ending with .desktop... Does that make sense :-)? Perhaps I am missing the main critical part still. Thanks for the aid.

markkuk
Posts: 124
Joined: Thu Mar 22, 2018 1:02 pm
Location: Finland

Re: Opening a .Desktop file on Boot

Fri Jul 05, 2019 12:19 pm

A .desktop file is not an executable file, it's a specification for a menu entry. See: https://specifications.freedesktop.org/ ... ec/latest/
Open the .desktop file in any text editor and look for a line starting with "Exec=", that's the definition of the actual command started by the menu entry. Copy the command (without the Exec= prefix) to your autostart file.

klricks
Posts: 6593
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Opening a .Desktop file on Boot

Fri Jul 05, 2019 2:33 pm

Nervousninja wrote:
Fri Jul 05, 2019 7:13 am
Yes, sorry again if I am blatantly missing some simple facts, as I am "crash-coursing' a lot of this and trying to catch up on a lot of these tutorial. To be clear, I am referring to the fact that all of the tutorials I have read for Autostart end with pointing to a ".py" file. And I want to autostart a ".desktop" file. I suppose perhaps they are the same thing, and I am so used to Windows files stil (.gif vs .jpg). But to date I have not found a tutorial that states to do autostart ending with .desktop... Does that make sense :-)? Perhaps I am missing the main critical part still. Thanks for the aid.
Quite a few people ask how to autostart their own software creation which often is a Python file.
Lots want to know how to autostart a browser or slideshow software....
However almost nobody has a need to autostart other random applications.
As mentioned you need to find the actual filename which can be used from terminal command line.
In addition to editing the .desktop file other ways to find the real name:

- Just drop the .desktop extension and try that.
- The [Help] -->[About] link in the running program usually shows the name and/or a web site link to the author or maintainers web site.
- If there is a menu entry then right click on the item and select [Properties] then click on the [Desktop Entry] tab. Use the name in the command box without the %x if any.
- Google

Once you find the real name that can be executed from the command line then use that in autostart.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

Return to “Beginners”