Desktop Launcher Actions桌面启动器操作
Overview概述
On many Linux environments, you can add custom entries to the system launcher by modifying the 在许多Linux环境中,您可以通过修改.desktop
file. .desktop
文件向系统启动器添加自定义项。For Canonical's Unity documentation, see Adding Shortcuts to a Launcher. 有关Canonical的Unity文档,请参阅向启动器添加快捷方式。For details on a more generic implementation, see the freedesktop.org Specification.有关更通用实现的详细信息,请参阅freedesktop.org规范。
NOTE: The screenshot above is an example of launcher shortcuts in Audacious audio player注意:上面的屏幕截图是“大胆的音频播放器”中的启动器快捷方式示例
To create a shortcut, you need to provide 要创建快捷方式,需要为要添加到快捷菜单的条目提供Name
and Exec
properties for the entry you want to add to the shortcut menu. Name
和Exec
属性。Unity will execute the command defined in the 用户单击快捷菜单项后,Unity将执行Exec
field after the user clicked the shortcut menu item. Exec
字段中定义的命令。An example of the .desktop
file may look as follows:.desktop
文件的示例如下:
Actions=PlayPause;Next;Previous
[Desktop Action PlayPause]
Name=Play-Pause
Exec=audacious -t
OnlyShowIn=Unity;
[Desktop Action Next]
Name=Next
Exec=audacious -f
OnlyShowIn=Unity;
[Desktop Action Previous]
Name=Previous
Exec=audacious -r
OnlyShowIn=Unity;
The preferred way for Unity to instruct your application on what to do is using parameters. Unity指导应用程序的首选方法是使用参数。You can find them in your application in the global variable 您可以在应用程序的全局变量process.argv
.process.argv
中找到它们。