Jho*_*doe 12 command-line lxde raspberry-pi raspbian
LXDE 工具栏上有没有办法通过终端更改快速启动部分上的应用程序,以便可以将其放入批处理文件中以在多个客户端上进行更改?
iyr*_*rin 17
这可以通过.desktop
为要添加到菜单的每个应用程序创建一个文件来轻松完成。这在 LXDE wiki 的主菜单1 中都有清楚的解释。
如果您希望应用程序出现在系统上所有用户的菜单中,请将文件添加到目录/usr/share/applications/
. 例如,您可能有/usr/share/applications/gimp.desktop
gimp 应用程序。这是包通常创建.desktop
文件的地方,建议使用。
如果要将应用程序添加到特定用户的菜单中,请在目录中创建文件$HOME/.local/share/applications/
。
阅读您现有的一些.desktop
文件/usr/share/applications/
以了解它们的工作原理。它们相当简单,但 wiki 提供了常用设置的简要说明。
这是来自维基warsow.desktop
文件的稍微修改的解释。实际设置以粗体显示。
如果您已经创建了一个.desktop
文件或者在安装应用程序时创建了一个文件,您可以将应用程序添加到 lxpanel 内的启动栏中。面板的配置位于配置文件目录中。例如,您的面板之一可能位于$HOME/.config/lxpanel/LXDE/panels/panel
。
编辑文件 vim ~/.config/lxpanel/LXDE/panels/panel
,我可以看到添加启动栏插件和配置的位置。如果插件尚未添加到面板中,您将需要为每个用户添加此插件。请注意,启动栏插件将按照它们在此文件中出现的顺序出现在面板中。
此外,您需要为希望出现在启动栏中的每个应用程序添加Button
带有文件id
路径的配置.desktop
。这是它的外观示例。
Plugin {
type = launchbar
Config {
Button {
id=pcmanfm.desktop
}
Button {
id=/var/lib/menu-xdg/applications/menu-xdg/X-Debian-Applications-Network-File-Transfer-transmission_bittorrent_client_(gtk).desktop
}
Button {
id=/usr/share/applications/gimp.desktop
}
Button {
id=/var/lib/menu-xdg/applications/menu-xdg/X-Debian-Applications-Terminal-Emulators-gnome_terminal.desktop
}
Button {
id=/usr/share/applications/gedit.desktop
}
Button {
id=/usr/share/applications/gcalctool.desktop
}
Button {
id=/usr/share/applications/keepassx.desktop
}
}
}
Run Code Online (Sandbox Code Playgroud)
wiki 甚至提供了一个方便的脚本来重新启动 lxpanel 以确保它会更新您的更改。
#!/bin/bash
# lxpanel processes must be killed before it can reload an lxpanel profile.
killall lxpanel
# Finds and deletes cached menu items to ensure updates will appear.
find ~/.cache/menus -name '*' -type f -print0 | xargs -0 rm
# Starts lxpanel with the `--profile` option and runs as a background process.
# In this example the profile is LXDE. Profiles are the directories located
# in $HOME/.config/lxpanel/. In this case, $HOME/.config/lxpanel/LXDE.
lxpanel -p LXDE &
Run Code Online (Sandbox Code Playgroud)
如果您lxpanel
在终端中运行该命令,我建议您使用nohup
它,以便在终端关闭时它不会终止 lxpanel 进程。
nohup lxpanel -p LXDE &