Attachments: Desktop Files

Linux has LNK similar applications named .desktop files, these type of files allow us to execute commands or call applications a small demonstration here calling the Gnome-Calculator application:

[Desktop Entry]
Version=1.0
Name=GNOME Calculator
Comment=A simple calculator for GNOME
Exec=gnome-calculator
Icon=accessories-calculator
Terminal=false
Type=Application
Categories=Utility;Calculator;

The previous command sets up a LNK file type that can call the calculator application using the "Exec" Tag but we can actually use full commands as well:

Exec= python3 -c "import os; os.system('gnome-calculator')"

This actually calls python and uses it's scripting capabilities to execute commands this is a familiarity as using "/c" from the CMD prompt in Windows, but we use more scripting such as Ruby, Perl, PHP, BASH since they tend to be installed by Default in Linux OS Distributions, of course these files do come with their issues as well since on Linux OS everything is a file the user needs to tell the system that the .Desktop file is an "executable"

Once this is set or maybe the OS has a setup where these files are automatically turned into executable via the Users Profile Setup then execution should not be an issue, a demo below on this technique:

The allow Launching can be avoided and a simple double-click should do the trick if this file is in a container.

References:

https://dev.to/ha7shu/how-to-create-a-desktop-entry-in-linux-23p9

Last updated

Was this helpful?