参考

参考2

最简单的方法是多看两个applications目录下的文件总结下规律, 美滋滋

ubuntu的桌面配置项存在两个位置:

1
2
3
4
5
6
# 应用脚本位置
~/.local/share/applications
#对应的icon位置
~/.local/share/icons
/usr/share/applications
/usr/share/icons

在`~/.local/share/applications下新建`chifanbuhetang.desktop文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 这个文件是直接从`/usr/share/applications/google-chrome.desktop`文件复制的
[Desktop Entry] #指定文件类型
Version=1.0 # Version of the Desktop Entry Specification that the desktop entry conforms with. Entries that confirm with this version of the specification should use 1.1. Note that the version field is not required to be present.
Name=chifanbuhetang # Specific name of the application, for example "Mozilla".
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=我的浏览器 # Generic name of the application, for example "Web Browser".
# Gnome and KDE 3 uses Comment.
Comment=带了代理的chrome # Tooltip for the entry, for example "View sites on the Internet". The value should not be redundant with the values of Name and GenericName.
Exec=/usr/bin/google-chrome-stable %U --proxy-server="socks5://127.0.0.1:1080" # Program to execute, possibly with arguments.
StartupNotify=true # If true, it is KNOWN that the application will send a "remove" message when started with the DESKTOP_STARTUP_ID environment variable set. If false, it is KNOWN that the application does not work with startup notification at all (does not shown any window, breaks even when using StartupWMClass, etc.). If absent, a reasonable handling is up to implementations (assuming false, using StartupWMClass, etc.).
Terminal=false # Whether the program runs in a terminal window.
Icon=datou.png # 这个文件存在icons/datou.png目录下, 貌似jpg有问题 # con to display in file manager, menus, etc. If the name is an absolute path, the given file will be used. If the name is not an absolute path, the algorithm described in the Icon Theme Specification will be used to locate the icon.
Type=Application # This specification defines 3 types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3). To allow the addition of new types in the future, implementations should ignore desktop entries with an unknown type.
Categories=Network;WebBrowser; # Categories in which the entry should be shown in a menu (for possible values see the Desktop Menu Specification).
MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
Actions=new-window;new-private-window; # The MIME type(s) supported by this application.

[Desktop Action new-window]
Name=New Window
Exec=/usr/bin/google-chrome-stable --proxy-server="socks5://127.0.0.1:1080"

[Desktop Action new-private-window]
Name=New Incognito Window
Exec=/usr/bin/google-chrome-stable --incognito --proxy-server="socks5://127.0.0.1:1080"

最后, 脑洞下上面的Type字段:

linux一切皆为文件, ll一下目录:

1
2
3
4
5
6
ll
drwxrwxr-x 9 qq qq 4096 6月 27 11:35 ./
drwxr-xr-x 86 qq qq 4096 6月 27 11:27 ../
-rw-rw-r-- 1 qq qq 1995 5月 20 17:28 _config.yml
-rw-rw-r-- 1 qq qq 667766 6月 27 11:37 db.json
drwxrwxr-x 23 qq qq 4096 6月 16 09:37 .deploy_git/
  • .
    • 当前目录
  • ..

    • 上一级目录
  • drwxrwxr-x

    • 第1个字母:代表文件类型
    • 第2~4字母:代表用户的权限
    • 第5~7字母:代表用户组的权限
    • 第8~10字母:代表其他的用户的权限

linux系统的文件类型:

文件属性 文件类型
- 常规文件,即file

d | 目录文件
b | block device 即块设备文件,如硬盘;支持以block为单位进行随机访问
c | character device 即字符设备文件,如键盘支持以character为单位进行线性访问
l | symbolic link 即符号链接文件,又称软链接文件
p |pipe 即命名管道文件
s | socket 即套接字文件,用于实现两个进程进行通信