Skip to content

Instantly share code, notes, and snippets.

@pandaninjas
Created March 31, 2023 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandaninjas/3c8c1e80e4a6d736b93b11382f79d0d8 to your computer and use it in GitHub Desktop.
Save pandaninjas/3c8c1e80e4a6d736b93b11382f79d0d8 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Resolve the location of the installation.
# This includes resolving any symlinks.
PRG=$0
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
if expr "$link" : '^/' 2> /dev/null >/dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
PRG_BIN=`dirname "$PRG"`
# absolutize dir
oldpwd=`pwd`
cd "${PRG_BIN}"
PRG_BIN=`pwd`
cd "${oldpwd}"
ICON_NAME=jetbrains-idea
TMP_DIR=`mktemp --directory`
DESKTOP_FILE=$TMP_DIR/jetbrains-idea.desktop
cat << EOF > $DESKTOP_FILE
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Intellij IDEA
Keywords=java;intellij;idea
GenericName=Java Integrated Development Environment
Type=Application
Categories=Development;Programming
Terminal=false
StartupNotify=true
Exec="$PRG_BIN/idea.sh" %u
Icon=$ICON_NAME.png
EOF
xdg-desktop-menu install $DESKTOP_FILE
xdg-icon-resource install --size 128 "$PRG_BIN/idea.png" $ICON_NAME
rm $DESKTOP_FILE
rm -R $TMP_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment