1

I'm using Xubuntu 14.04, as app menu I use the default app and the menu editor is Alacarte.

I have been editing the menu entries and made a total mess. So I decided to delete the *.desktop files.

I have deleted all *.desktop files from:

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

I thought that opening again Alacarte, it will regenerate all default *.desktop files. But no.

The question is:

Is there any way to recreate all *. desktop files for all my apps automatically?

  • Finally I'm just recreating the files as I need it. So, when I need an app, I look if I have the *.desktop of that app and if not, I create it. – user445444 Aug 4 '17 at 5:58
0

Try running update-menus. If this doesn't work, this may do the trick:

sudo apt-get remove --purge xubuntu-default-settings
sudo apt-get install xubuntu-default-settings
  • I don't have update-menus command. I tried to remove and install the package and didn't work. – user445444 Aug 1 '17 at 10:21
0

The files you deleted in /usr/share come from the installed packages. The only way to get them back (short of active data recovery) is by reinstalling all the packages that had files there.

Luckily, this can be done fairly easily but it's going to involve an amount of downloading. First, let me illustrate the mess. Here are all the packages that have files in there on my system:

$ 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

To reinstall all of those we can just run. This should work on your system too.

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

Files from /usr/local/... aren't package-controlled. I can't help you there.

  • It should work, but I have the problem that I have deleted all *.desktop. So the only result is alacarte. The menu editor. I think that I have to insert all one by one.... – user445444 Aug 1 '17 at 12:09
  • Sorry, the applied command (the second one) wasn't supposed to use the illustrated version. I've updated it. – Oli Aug 2 '17 at 15:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.