Shortcuts are located in three places
/usr/share/applications/intellij.desktop for all users
a folder in the home dir for a given user
~/Desktop to see the shortcut on the desktop
Format is
[Desktop Entry]
Version=13.0
Type=Application
Terminal=false
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png
Name[en_US]=IntelliJ
Exec=/home/rob/.intellij-13/bin/idea.sh
Name=IntelliJ
Icon=/home/rob/.intellij-13/bin/idea.png
The function looks like this:
/usr/share/applications/intellij.desktop for all users
a folder in the home dir for a given user
~/Desktop to see the shortcut on the desktop
Format is
[Desktop Entry]
Version=13.0
Type=Application
Terminal=false
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png
Name[en_US]=IntelliJ
Exec=/home/rob/.intellij-13/bin/idea.sh
Name=IntelliJ
Icon=/home/rob/.intellij-13/bin/idea.png
The function looks like this:
function add_a_shortcut() {
APP=$1
ICON=$2
EXEFILE=$3
EXEC="bash -ic \"$EXEFILE &\""
SHORTCUT="/usr/share/applications/$APP.desktop"
USERSHORTCUT="/home/vagrant/Desktop/$APP.desktop"
if [ -e "$EXEFILE" ]; then
sudo touch $SHORTCUT $USERSHORTCUT
sudo chmod 777 $SHORTCUT $USERSHORTCUT
echo "[Desktop Entry]" | tee $SHORTCUT $USERSHORTCUT
echo "Encoding=UTF-8" | tee -a $SHORTCUT $USERSHORTCUT
echo "Comment=Launch $1" | tee -a $SHORTCUT $USERSHORTCUT
echo "Type=Application" | tee -a $SHORTCUT $USERSHORTCUT
echo "Terminal=false" | tee -a $SHORTCUT $USERSHORTCUT
echo "Exec=$EXEC" | tee -a $SHORTCUT $USERSHORTCUT
echo "Name=$APP" | tee -a $SHORTCUT $USERSHORTCUT
echo "Icon=$ICON" | tee -a $SHORTCUT $USERSHORTCUT
sudo chmod 644 $SHORTCUT
sudo chown root:root $SHORTCUT
sudo chown vagrant:vagrant $USERSHORTCUT
echo "INFO: Created $SHORTCUT $USERSHORTCUT"
else
echo "ERROR: Failed to create $SHORTCUT $USERSHORTCUT"
fi
}
EXAMPLE USAGE
add_a_shortcut aggregation-designer /opt/pentaho/design-tools/aggregation-designer/aggregation-designer.app/Contents/Resources/pad.icns /opt/pentaho/design-tools/aggregation-designer/startaggregationdesigner.sh
add_a_shortcut aggregation-designer /opt/pentaho/design-tools/aggregation-designer/aggregation-designer.app/Contents/Resources/pad.icns /opt/pentaho/design-tools/aggregation-designer/startaggregationdesigner.sh
No comments:
Post a Comment