Adding A New Desktop Shortcut
Create a new text file called yourname.desktop in the /home/pi/Desktop/ directory, e.g. /home/pi/Desktop/yourname.desktop
It should contain the following:
[Desktop Entry]
Name=My Name
Comment=My application which does this
Icon=/usr/share/pixmaps/openbox.xpm
Exec=/usr/bin/leafpad
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;
Name – The name you want displayed
Comment – Your comment
Icon – A file to use for the icon. Your own or have a look in the /usr/share/pixmaps/ directory for something suitable.
Exec – The executable (can include sudo if your executable uses the IO). Can be the name of an executable program, or more complex, e.g. Exec=lxterminal –command “less /root/README.TXT”
Executing A Command In LX Terminal
The following will open LX terminal, wait for 5 seconds and then it will close:
[Desktop Entry]
Name=Name to be shown on desktop
Comment=My comment
Icon=/usr/share/pixmaps/openbox.xpm
Exec=lxterminal -t "Tile to display" -e sleep 5
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;
LX Terminal will auto close once the command is complete. You can’t give more than 1 command in the -e launch options (you can’t give it “-e dosomething ; sleep 5” for instance as a way to make it hold showing the result after dosomething.
Stopping The LX Terminal Auto Closing Or Doing Multiple Things
The simple way to get round the Lxterminal only being able to take one command is to have it run a bash script.
The .desktop file
[Desktop Entry]
Name=Name to be shown on desktop
Comment=My comment
Icon=/usr/share/pixmaps/openbox.xpm
Exec=lxterminal -t "Sending Crack The Code MAIN Leader Board To Internet" --working-directory=/home/pi/projects/scripts/ -e ./myscript.sh
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;
The .sh script
#!/bin/bash
echo "Starting upload of database"
read dummy
echo "next"
mysqldump -h localhost -u user1 -p123456789 mydatabase tbl_universities | mysql -h mydomain.com -u user1 -p123456789 mydatabase
echo "Complete. Press return to exit"
read dummy
Remember to set the files permissions so it is executable (right click > properties in the file manager)