最近把工作环境迁移到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-
Name=WPS
Comment=kingsoftwps
Exec=/ubt1/softs/wps/wps-office_10.1.0.~a21_x86_64/wps %F
Icon=/ubt1/softs/wps/wps-office_10.1.0.~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.

ubuntu 添加右键打开方式,无法添加程序打开方式的更多相关文章

  1. Ubuntu 在右键快捷菜单中添加“Open in Terminal”

    操作步骤翻译如下: 1.打开一个Terminal(ctrl+alt+t),输入如下指令 sudo apt-get install nautilus-open-terminal 2.使用以下指令来重启N ...

  2. XP下,文件夹添加右键命令行

    原文:XP下,文件夹添加右键命令行 总共有3种方式: --------------------1---------------------------------------------------- ...

  3. windows右键打开方式里面添加新的应用程序

    1.打开注册表编辑器.打开运行窗口,快捷键,开始+R.输入“regedit”,回车确定. 2.进入注册表编辑器的HKEY_CLASSES_ROOT文件夹下的*子文件夹下的shell文件夹. 3.右键s ...

  4. VSCode 绿色版(zip压缩包) 添加右键菜单 使用VSCode 打开文件或文件夹

    微软官方下载VSCode 可以下载exe安装外还可以下载zip 压缩包 下载地址: https://code.visualstudio.com/Download 但是zip压缩包却没有了 右键使用VS ...

  5. 添加右键使用 SublimeText 打开

    最近修改了系统,重新安装 SublimeText 但是在安装的时候忘记设置右键使用 SublimeText 打开,所以就需要写注册表. 可以复制下面的代码到一个记事本,然后保存为 sublime_ad ...

  6. 给IDEA添加右键打开功能

    添加文件夹右键程序打开 开始运行regedit 找到 HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell 1.右键shell目录新建项Idea 2. ...

  7. 添加右键菜单命令 在此处打开命令窗口(E)(带图标)

    @color 0A @title 添加右键菜单命令 在此处打开命令窗口(^&E)(带图标) by wjshan0808 @echo off reg add HKCR\Directory\Bac ...

  8. Wix打包系列(七) 添加系统必备组件的安装程序

    原文:Wix打包系列(七) 添加系统必备组件的安装程序 我们知道在vs的打包工程中添加系统必备组件是一件很容易的事情,那么在wix中如何检测系统必备组件并在安装过程中安装这些组件.这里以.Net Fr ...

  9. 怎样在Windows资源管理器中添加右键菜单以及修改右键菜单顺序

    有时,我们需要在Windows资源管理器的右键菜单中添加一些项,以方便使用某些功能或程序. 比如我的电脑上有一个免安装版的Notepad++,我想在所有文件的右键菜单中添加一项用Notepad++打开 ...

  10. Beyond Compare 3添加右键菜单

    目前是在Beyond Compare 3.1.9版本上试验可行,其他版本上尚未测试. 添加右键菜单步骤: 1.新建为.bat后缀的文本,将下面“添加右键菜单批处理”复制到此文本中. 2.将批处理移动到 ...

随机推荐

  1. Spring Clould负载均衡重要组件:Ribbon中重要类的用法

    Ribbon是Spring Cloud Netflix全家桶中负责负载均衡的组件,它是一组类库的集合.通过Ribbon,程序员能在不涉及到具体实现细节的基础上"透明"地用到负载均衡 ...

  2. 【MySQL】MySQL零碎积累

    MySQL零碎积累 ■ 在给MySQL添加新用户时可以这么操作: create user 'newUser' identified by 'password'; grant all privilege ...

  3. New UWP Community Toolkit

    概述 UWP Community Toolkit 是一个 UWP App 自定义控件.应用服务和帮助方法的集合,能够很大程度的简化和指引开发者的开发工作,相信广大 UWPer 并不陌生. 下面是截取自 ...

  4. 在用jQuery时遇到的小问题

    1. class类名问题? 在我在class ='看看(2)' ,凡是这样的居然给自身加其他style样式,居然添加不上,后来改成其他类名不带括号里的,居然好了. 2. line-height 引入的 ...

  5. JSON字符串转为JSON对象

    在数据传输流程中,json是以文本,即字符串的形式传递的,而JS操作的是对象,所以,JSON对象(js对象)和JSON字符串之间的相互转换是关键. JSON可以有两种格式,一种是对象格式的,另一种是数 ...

  6. ava集合---LinkedList源码解析

    一.源码解析 public class LinkedList<E> extends AbstractSequentialList<E> implements List<E ...

  7. poj1183 反正切函数

    poj1183 反正切函数 第一道poj的题更博,类似于博主这种英文水平,也就切一切这种中文题了吧! 题目大意:给你正整数a,求满足条件的 b 和 c,使得 $\frac {1}{a}=\frac { ...

  8. 获取服务器时间js代码

    function getSevertime(){ var xmlHttp = new XMLHttpRequest(); if( !xmlHttp ){ xmlHttp = new ActiveXOb ...

  9. Java编程配置思路详解

    Java编程配置思路详解 SpringBoot虽然提供了很多优秀的starter帮助我们快速开发,可实际生产环境的特殊性,我们依然需要对默认整合配置做自定义操作,提高程序的可控性,虽然你配的不一定比官 ...

  10. Mybatis学习笔记一

    Mybatis介绍 MyBatis 本是apache的一个开源项目iBatis, 2010年这个项目由apache software foundation 迁移到了google code,并且改名为M ...