In the last video, we set up BikeCAD to run on a Chromebook, launching the program from a command line in the terminal. In this video, I'll demonstrate how we can build on this setup by launching the program from a desktop icon.
We'll begin by noting that we still have the BikeCAD Jar file in the Linux files directory. In addition we've downloaded a PNG image file to serve as our icon for launching BikeCAD from the desktop. This image file was downloaded from https://bikecad.ca/icons.zip. This zip file has the BikeCAD icon in various sizes. The image file I have here was called BikeCADPro-3.png. I've renamed it to logo.png for this demonstration.
We'll start this process by launching the terminal. If we type ls, we'll see that our current working directory is the same one we were just looking at in our Files manager.
We'll now type cd .. to go up to the parent directory. We'll type cd .. once again to go another level higher. If we type ls here, we'll see there are a number of subdirectories.
We'll type cd usr to go into the usr directory.
Typing ls again, we'll see the next directory we want to enter is share.
Typing cd share will bring us into the share directory and we'll now type ls -l to see the file permissions associated with all the subdirectories here.
Scrolling up we can see the applications directory where we want to place our desktop file. But we don't have the required permissions to create a file in this directory, so we'll type sudo chmod 777 applications.
We'll then type cd applications to enter this directory. Typing ls will list the various desktop files already contained here. We'll create a new one by typing touch bikecad.desktop.
By typing vim bikecad.desktop we can enter a text editor to add some lines to this file. To get started, we'll type the letter i to enter INSERT mode.
We'll type the following lines being careful to replace the term username with our own specific username.
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Path=/home/username
Exec=java -jar "/home/username/bikeCADPro.jar"
Name=BikeCAD
Icon=/home/username/logo.png
By typing :x we'll save our file and quit the Vim editor.
Now, if we go to the menu at the bottom left, we'll see our new BikeCAD icon grouped with other Linux applications. We can drag the icon from here down into our shelf at the bottom of the screen. As you can see, this icon now works to launch BikeCAD Pro.
One final thing to do is to go back up to the parent directory which is the share directory and we'll want to type sudo chmod 755 applications to restore the previous file permissions for the applications directory.