Creating desktop icons

Create desktop icons to start the smart mirror software.

Advertisements

In this article I’ll be describing a way to quickly start the applications with a shortcut on the desktop.  For a good working smart mirror I will need to start at least the following applications :

  • The smart mirror software itself
  • The Java Client
  • The Wake word agent

In order to avoid hooking up a keyboard every time I want to start them, I will create desktop icons.  That way I’ll only have to connect a mouse to start the applications.

Turns out that’s quite easy.

Log on to the Raspberry Pi with ssh, or take over the screen using VNC, and open a terminal on the desktop.

Next, navigate to the Desktop directory :

cd Desktop

Create a new file called client.desktop :

nano client.desktop

This will automatically open the nano editor.  There is a fixed format in which these files are structure.  First of all, it needs to start with [Desktop Entry], and the settings are key value pairs separated with an equals sign.  The settings to start the java client are as follows :

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Path=/home/pi/smartmirrorproject/alexa-avs-sample-app/samples/javaclient
Exec=mvn exec:exec
Terminal=false
Name=client

A few settings are important :

  • Always use “Application” as the Type.
  • Set a path.  It is the working directory for the application where it can find its configuration files etc.
  • Set Terminal=false to avoid starting a terminal every time.

More info on the other settings can be found here.

I’ve pasted the settings for the smart mirror and the wake word engine below.

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Path=/home/pi/smartmirrorproject/Smartmirrorproject/
Exec=npm start
Terminal=false
Name=mirror
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Path=/home/pi/smartmirrorproject/alexa-avs-sample-app/samples/wakeWordAgent/src
Exec=lxterminal -e "/home/pi/smartmirrorproject/startup.sh"
Terminal=false
Name=wwa

Notice above how the “Exec” value is configured.  For the wake word engine a script is started instead of an executable.  In order to show its progress in a terminal I chose to start is as a command with inside a terminal by using the lxterminal command.

The result looks like this :

Schermafbeelding 2017-01-14 om 20.11.33.png

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s