fedora23添加GUI桌面快捷方式

下载的ECLIPSE直接解压可以用,没有GUI快捷方式,启动不方便。参照 smartsvn带的脚本,稍微改动一下添加成功。指定加载图标的地方稍微不一样。

添加ECLIPSE快捷方式脚本:

#!/bin/bash
# double.620 (at) 163.com
# modified from SmartSVN installation.
# Resolve the location of the ECLIPSE 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

ECLIPSE_BIN=`dirname "$PRG"`

# absolutize dir
oldpwd=`pwd`
cd "${ECLIPSE_BIN}"
ECLIPSE_BIN=`pwd`
cd "${oldpwd}"

ICON_NAME=icon
TMP_DIR=`mktemp --directory`
DESKTOP_FILE=$TMP_DIR/clipse-juno.desktop
cat << EOF > $DESKTOP_FILE
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Eclipse Juno
Keywords=eclipse;juno
GenericName=Eclipse Juno
Type=Application
Categories=Development;RevisionControl
Terminal=false
StartupNotify=true
Exec="$ECLIPSE_BIN/eclipse" %f
MimeType=x-directory/normal
Icon=$ICON_NAME.xpm
X-Ayatana-Desktop-Shortcuts=NewWindow;RepositoryBrowser

[NewWindow Shortcut Group]
Name=Open a New Window
Exec="$ECLIPSE_BIN/eclipse"
TargetEnvironment=Unity

[RepositoryBrowser Shortcut Group]
Name=Open the Repository Browser
Exec="$ECLIPSE_BIN/eclipse" --repository-browser
TargetEnvironment=Unity
EOF

# seems necessary to refresh immediately:
chmod 644 $DESKTOP_FILE

xdg-desktop-menu install $DESKTOP_FILE
xdg-icon-resource install --size  32 --novendor "$ECLIPSE_BIN/icon.xpm"  $ICON_NAME
xdg-icon-resource install --size  48 --novendor "$ECLIPSE_BIN/icon.xpm"  $ICON_NAME
xdg-icon-resource install --size  64 --novendor "$ECLIPSE_BIN/icon.xpm"  $ICON_NAME
xdg-icon-resource install --size 128 --novendor "$ECLIPSE_BIN/icon.xpm" $ICON_NAME

rm $DESKTOP_FILE
rm -R $TMP_DIR

smartsvn 脚本:

#!/bin/bash
#
# Resolve the location of the SmartSVN 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

SMARTSVN_BIN=`dirname "$PRG"`

# absolutize dir
oldpwd=`pwd`
cd "${SMARTSVN_BIN}"
SMARTSVN_BIN=`pwd`
cd "${oldpwd}"

ICON_NAME=smartsvn-9_1
TMP_DIR=`mktemp --directory`
DESKTOP_FILE=$TMP_DIR/smartsvn-9_1.desktop
cat << EOF > $DESKTOP_FILE
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=SmartSVN 9.1
Keywords=svn;subversion
GenericName=SVN Client
Type=Application
Categories=Development;RevisionControl
Terminal=false
StartupNotify=true
Exec="$SMARTSVN_BIN/smartsvn.sh" %f
MimeType=x-directory/normal
Icon=$ICON_NAME.png
X-Ayatana-Desktop-Shortcuts=NewWindow;RepositoryBrowser

[NewWindow Shortcut Group]
Name=Open a New Window
Exec="$SMARTSVN_BIN/smartsvn.sh"
TargetEnvironment=Unity

[RepositoryBrowser Shortcut Group]
Name=Open the Repository Browser
Exec="$SMARTSVN_BIN/smartsvn.sh" --repository-browser
TargetEnvironment=Unity
EOF

# seems necessary to refresh immediately:
chmod 644 $DESKTOP_FILE

xdg-desktop-menu install $DESKTOP_FILE
xdg-icon-resource install --size  32 "$SMARTSVN_BIN/smartsvn-32.png"  $ICON_NAME
xdg-icon-resource install --size  48 "$SMARTSVN_BIN/smartsvn-48.png"  $ICON_NAME
xdg-icon-resource install --size  64 "$SMARTSVN_BIN/smartsvn-64.png"  $ICON_NAME
xdg-icon-resource install --size 128 "$SMARTSVN_BIN/smartsvn-128.png" $ICON_NAME

rm $DESKTOP_FILE
rm -R $TMP_DIR
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值