#!/bin/bash
myfile=$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
myfilename=${myfile##*/}
myfilename=${myfilename%.*}
myhome=~
linkpath=~/Desktop/${myfilename}.desktop echo [Desktop Entry] >> $linkpath
echo Name=$myfilename >> $linkpath
echo Exec=env WINEPREFIX=\"${myhome}/.wine\" wine \"$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS\" >> $linkpath
echo Type=Application >> $linkpath
echo StartupNotify=true >> $linkpath
echo Icon=terminal.0 >> $linkpath
echo Comment= >> $linkpath
echo Path=${myfile%/*} >> $linkpath
进入以下位置,新建一个文件,文件名就是右键菜单名,例如:“生成Wine桌面快捷键”
~/.local/share/nautilus/scripts/
文件中加入第一段代码
done
PS: 传入变量有以下几种
https://help.ubuntu.com/community/NautilusScriptsHowto
-
NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
- newline-delimited paths for selected files (only if local)
-
NAUTILUS_SCRIPT_SELECTED_URIS
- newline-delimited URIs for selected files
-
NAUTILUS_SCRIPT_CURRENT_URI
- current location
-
NAUTILUS_SCRIPT_WINDOW_GEOMETRY
- position and size of current window