Making Linux Command-line Programs Graphically Startable
Many Linux applications are started from the command-line, and this is fine. However, if frequently used, it can become slightly inconvenient, especially when the command name is not properly remembered. It would be nice to have it available somewhere on the desktop to click and start.
I now do this as a matter of course. I use .desktop files. There are many ways to put this together - I'll describe the system I use.
I use, in my home directory, the .local subdirectory. In .local I create (if not there) a share directory and beneath that applications and icons.
cd mkdir -p .local/share cd .local/share mkdir applications icons
Perhaps you want to get the program my_command that you put in .local/bin somewhere on your desktop. You'll want an icon. I suggest searching Google for some text describing the function of the application, choosing "Images" and downloading an appropriate small image, or, using a screen grabber like Gnome Screenshot to select a part of such an image. Save it to .local/share/icons. Let's say you call it MyCommand.png.
In .local/share/applications open an editor and create a file called - say - MyCommand.desktop. In it, put the following:
[Desktop Entry]
Name=My Command
Comment=This command does what I want it to
Exec=/home/your_username/.local/bin/my_command
Icon=/home/your_username/.local/share/images/MyCommand.png
Type=Application
And that's it. You will now be able to search on "My Command" which will bring up your icon. You will be able to add this to Favorites or as a clickable item on a side bar or similar.
There are other features - you can have parameters and the command can open a terminal window e.g. - this is documented by Gnome.
Comments
Post a Comment