在Linux中为Intellij IDEA创建桌面菜单项-适用manjaro

Instructions:
 

  1. Create the two  scripts in the /path/to/your/intellij-idea/bin directory
  2. cd /path/to/your/intellij-idea/bin
  3. chmod +x *menuitem.sh
  4. cp idea.png jetbrains-idea.png
  5. ./idea-add-menuitem.sh

 

idea-add-menuitem.sh:

#!/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/$ICON_NAME.png" $ICON_NAME

rm $DESKTOP_FILE
rm -R $TMP_DIR

idea-remove-menuitem.sh:

#!/bin/bash
xdg-desktop-menu uninstall jetbrains-idea.desktop
xdg-icon-resource uninstall --size 128 jetbrains-idea


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值