ekartoyev
2/21/2019 - 2:30 AM

Bash - Create Desktop Item. This file is to be placed just above the bin directory.

Bash - Create Desktop Item. This file is to be placed just above the bin directory.

  1. Don't forget to save the icon to the bin directory.
  2. The launching file may be changed to as follows:
#!/bin/sh
DIR=`dirname $0`
cd $DIR
./java -m Passwords/passwords.Main -Dfile.encoding=UTF-8 $@

This will ensure that the working directory of the app will be the bin directory.

#!/bin/bash
#
# Hello!!!
#
# To run this file, click with the right button of the mouse 
# and check Properties > Permissions > Allow Executing this app
# then click on it again and execute it.
#
# After that, go to the Desktop. There you will see a new desktop item.
# Click on this desktop item and allow it run
# to launch the application
#
 
DIR="$(dirname $0)"
FILE="$HOME/Desktop/mypasses.desktop"
if [ -e $FILE ]; then
  echo "Desktop item $FILE already exists!"
  read -n 1 -s -r -p "Press any key to finish... "
else 
  echo "#!/usr/bin/env xdg-open" >> $FILE
  echo "[Desktop Entry]" >> $FILE
  echo "Type=Application" >> $FILE
  echo "Terminal=true" >> $FILE
  echo "Exec=bash $DIR/bin/password" >> $FILE
  echo "Name=My New Passwords" >> $FILE
  echo "Icon=$DIR/bin/password.png" >> $FILE
  chmod u+x $FILE
fi