Skip to main content

桌面启动器操作

🌐 Desktop Launcher Actions

概述

🌐 Overview

在许多 Linux 环境中,你可以通过修改 .desktop 文件向系统启动器添加自定义条目。有关详细信息,请参阅 freedesktop.org 桌面条目规范

🌐 On many Linux environments, you can add custom entries to the system launcher by modifying the .desktop file. For details, see the freedesktop.org Desktop Entry Specification.

要创建快捷方式,你需要为想要添加到快捷方式菜单的条目提供 NameExec 属性。用户点击快捷方式菜单项后,桌面将执行 Exec 字段中定义的命令。一个 .desktop 文件的示例如下:

🌐 To create a shortcut, you need to provide Name and Exec properties for the entry you want to add to the shortcut menu. The desktop will execute the command defined in the Exec field after the user clicks the shortcut menu item. An example of the .desktop file may look as follows:

Actions=PlayPause;Next;Previous

[Desktop Action PlayPause]
Name=Play-Pause
Exec=audacious -t

[Desktop Action Next]
Name=Next
Exec=audacious -f

[Desktop Action Previous]
Name=Previous
Exec=audacious -r

桌面指示你的应用该做什么的首选方式是使用参数。你可以在应用的全局变量 process.argv 中找到它们。

🌐 The preferred way for the desktop to instruct your application on what to do is using parameters. You can find them in your application in the global variable process.argv.