This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How do I make a .desktop file that runs an executable?

Tags: None
(comma "," separated)
Doctype_
Registered Member
Posts
1
Karma
0
I think it's a .desktop file. Either way, I just want something that will run an executable file when you click it. I compiled some code in Code::Blocks and was able to run it in the terminal but I am not sure how to run it like most programs do (one click and it just opens).
j8a
Registered Member
Posts
156
Karma
0
OS
Hi,
First be sure to know the path to Code::Blocks. For example, type on a terminal whereis Code::Blocks
Did you try right click-> open with -> go to the folder and select the Code::Blocks executable. Be sure you mark you want to always open the files type with the seam program, at the bottom of the dialog box .
By the way, try to make a directory on your home folder called scripts or whatever and put all the files here.
Hope it helps, regards
airdrik
Registered Member
Posts
1854
Karma
5
OS
In dolphin you can create the .desktop file by right-clicking in the directory you want to create the launcher and selecting Create New -> Link to Application. In the dialog that pops up you can pick a name for the link, provide the icon by clicking on the icon and browsing to the icon you want to use, and under the Application tab specify the path to the executable and working path. Hitting OK will create the appropriately-formatted .desktop file for it.
For more details on the .desktop file format you can check out the FreeDesktop documentation.

On the other hand, if all you want is to be able to click on the compiled executable and have it launch, it may be that you just need to mark the file as being executable. You can do that by right-clicking on the file in Dolphin (or really any file manager) -> File Properties -> Permissions and checking Executable, or by using chmod +x from the command line (which presumably you may be able to do in your build scripts if they don't do that for you. You should be able to click on files with the executable bit set in the file manager and it will run it.

If the application relies on terminal output or interaction and you want it to open the konsole when you launch it, then you'll need to create the .desktop file as mentioned above, but in the Application tab click on Advanced Options and check Run in terminal.


airdrik, proud to be a member of KDE forums since 2008-Dec.
j8a
Registered Member
Posts
156
Karma
0
OS
Hi, aldrik
Very nice answer, thanks in advance.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]