如何自动生成所有*.desktop 文件?

如何自动生成所有*.desktop 文件?

我正在使用 Xubuntu 14.04,应用程序菜单我使用默认应用程序,菜单编辑器是 Alacarte。

我一直在编辑菜单项,结果弄得一团糟。所以我决定删除 *.desktop 文件。

我已删除以下位置的所有 *.desktop 文件:

~/.local/share/applications
/usr/local/share/applications
/usr/share/applications

我以为再次打开 Alacarte 会重新生成所有默认 *.desktop 文件。但是没有。

问题是:

有什么方法可以自动为我的所有应用程序重新创建所有 *.desktop 文件吗?

答案1

尝试运行update-menus。如果这不起作用,下面这个可能会奏效:

sudo apt-get remove --purge xubuntu-default-settings
sudo apt-get install xubuntu-default-settings

答案2

您删除的文件/usr/share来自已安装的软件包。恢复这些文件的唯一方法(无需主动数据恢复)是重新安装所有包含文件的软件包。

幸运的是,这可以相当容易地完成,但需要下载大量文件。首先,让我说明一下混乱情况。以下是所有包含文件的软件包在我的系统上

$ dpkg -S /usr/share/applications | cut -d: -f1 | tr -d , | fold -w 80

aftershot3x64 aisleriot alacarte apport-gtk apturl-common audio-recorder baobab 
bless california cheese chrome-gnome-shell cubic dbeaver-ce dconf-editor deja-du
p dolphin-emu eog evince evolution-data-server-online-accounts file-roller firef
ox font-manager gcr gedit geoclue-2.0 gimp gkbd-capplet gksu gnome-bluetooth gno
me-boxes gnome-calculator gnome-calendar gnome-characters gnome-color-manager gn
ome-contacts gnome-control-center gnome-disk-utility gnome-documents gnome-font-
viewer gnome-logs gnome-mahjongg gnome-maps gnome-mines gnome-music gnome-photos
 gnome-screenshot gnome-session-common gnome-shell gnome-software gnome-sudoku g
nome-system-monitor gnome-tweak-tool gnome-user-share gnome-weather google-chrom
e-stable handbrake hexchat htop hugin ibus ibus-table imagemagick-6.q16 im-confi
g i-nex inkscape libreoffice-calc libreoffice-common libreoffice-draw libreoffic
e-impress libreoffice-math libreoffice-writer meld menulibre mono-runtime-common
 mutter nautilus network-manager-gnome nvidia-settings printer-driver-foo2zjs-co
mmon python2.7 python3.5 simple-scan software-properties-gtk steam sublime-text 
terminator totem transmission-gtk update-manager usb-creator-gtk uzbl vim-common
vino virtualbox-5.1 vlc xdg-desktop-portal-gtk xterm yelp

要重新安装所有这些,我们可以只是运行。这也应该适用于您的系统。

sudo apt install --reinstall $(dpkg -S /usr/share/applications | cut -d: -f1 | tr -d ,)

来自的文件/usr/local/...不受包控制。我无法帮助你。

相关内容