最近把工作环境迁移到ubuntu,装了WPS for Linux ,说实话确实是十分良心啊!运行效率奇高,绿色无广告,并且和windows版本无异,感觉就可以抛弃自带的libreoffice了。
但是有个问题就是没有办法使用双击打开(由于我安装的是免安装版),最主要的问题还是无法在右键-》打开方式-》其它方式里面找到。
这修改两个路径文件是修改默认打开方式的方法之一,但是感觉治标不治本,还是想办法把程序添加到右键菜单吧。
/etc/gnome/defaults.list
~/.local/share/applications/mimeinfo.cache
于是在国外的网站找到了,原来我的/usr/share/applications/*.desktop文件需要添加一个参数变量。成功加入程序到右键菜单!
我的wps.desktop现在改成这样了,注意Exec的写法,增加%F参数即可,%F是文件名称参数,能够使用前面路径的程序,一次打开一个或多个文件。
[Desktop Entry] Encoding=UTF-8 Name=WPS Comment=kingsoftwps Exec=/ubt1/softs/wps/wps-office_10.1.0.5672~a21_x86_64/wps %F Icon=/ubt1/softs/wps/wps-office_10.1.0.5672~a21_x86_64/resource/icons/hicolor/48x48/apps/wps-office-wpsmain.png Terminal=false Type=Application MimeType=application/msword;application/vnd.openxmlformats-officedocument.wordprocessingml.document; Categories=Application;IDE;Development;
其它的desktop参数配置方法看这个吧:desktop-entry-specification
https://developer.gnome.org/desktop-entry-spec/#exec-variables
方便查看,参数配置单独列出来了:
Code
Description | |
---|---|
%f |
A single file name, even if multiple files are selected. The system reading the desktop entry should recognize that the program in question cannot handle multiple file arguments, and it should should probably spawn and execute multiple copies of a program for each selected file if the program is not able to handle additional file arguments. If files are not on the local file system (i.e. are on HTTP or FTP locations), the files will be copied to the local file system and %f will be expanded to point at the temporary file. Used for programs that do not understand the URL syntax. |
%F |
A list of files. Use for apps that can open several local files at once. Each file is passed as a separate argument to the executable program. |
%u |
A single URL. Local files may either be passed as file: URLs or as file path. |
%U |
A list of URLs. Each URL is passed as a separate argument to the executable program. Local files may either be passed as file: URLs or as file path. |
%d |
Deprecated. |
%D |
Deprecated. |
%n |
Deprecated. |
%N |
Deprecated. |
%i |
The Icon key of the desktop entry expanded as two arguments, first --icon and then the value of the Icon key. Should not expand to any arguments if the Icon key is empty or missing. |
%c |
The translated name of the application as listed in the appropriate Name key in the desktop entry. |
%k |
The location of the desktop file as either a URI (if for example gotten from the vfolder system) or a local filename or empty if no location is known. |
%v |
Deprecated. |
%m |
Deprecated. |