Created
March 31, 2023 21:18
-
-
Save pandaninjas/3c8c1e80e4a6d736b93b11382f79d0d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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