Help removing unwanted file templates from right-click menu

I have custom blank file templates made for file formats I use often, but after switching from MATE to LXQt these blank desktop entries claiming to be for LibreOffice showed up in the “Create New” dialog.

IDK how to get rid of these as they aren’t in my .Templates folder. Anyone got an idea what’s causing this?

My "Create New" right-click menu

My .Templates folder

image

Maybe coming from the .desktop itself?

Try this:

mkdir -p ~/.local/share/applications
cp /usr/share/applications/libreoffice-calc.desktop ~/.local/share/applications/.

Then edit ~/.local/share/applications/libreoffice-calc.desktop and remove this part at the bottom.

Actions=NewDocument;
[Desktop Action NewDocument]
Name=New Spreadsheet
Name[en]=New Spreadsheet
Icon=document-new
Exec=libreoffice --calc

See if that removes either or both of the LibreOffice Calc options from the menu.

I am not sure if that will require logging out or not to take affect.

If it doesn’t help, you can simply delete ~/.local/share/applications/libreoffice-calc.desktop.

Unfortunately this had no effect. My issue is with the create new file dialog, not the application menu.

I believe that is what that snippet does, adds the item to the New File menu.

This is the normal/expected behavior.

What are you referring to? There are files in the folder. Whatever is in that folder is parsed and presented as a Create New (document type) item.

I think you are confusing the GUI representation of those files in the File Manager, with the actual files.
Please post objective info, to help solve the misunderstanding. For example:

ls -l ~/Templates

Was in a hurry when I typed that and I admit I could have phrased it better. What I’m saying is that I made blank Blender, Krita, and LibreOffice files and put them in ~/.Templates so I could easily make new files on the fly. After switching to LXQt, new templates were added to the Create New right-click menu that don’t come from files in this directory. These are .desktop files and not blank .ods, .kra, etc… I didn’t manually create these and I don’t know what could have created these and the perfectionist in me wants them gone.

Since you asked
[josh@Mercury ~]$ ls -l ~/.Templates
total 1964
-rw-r--r-- 1 josh josh 953960 Nov 22 17:45 'Blender Project (2D).blend'
-rw-r--r-- 1 josh josh 829292 Nov 22 17:44 'Blender Project (3D).blend'
-rw-r--r-- 1 josh josh 187678 Nov 22 17:43 'Krita Document.kra'
-rw-r--r-- 1 josh josh   6964 Nov 22 17:46 'LibreOffice Calc Spreadsheet.ods'
-rw-r--r-- 1 josh josh  15074 Nov 22 17:47 'LibreOffice Impress Presentation.odp'
-rwxr-xr-x 1 josh josh   8272 Nov 22 17:48 'LibreOffice Writer Text Document.odt'

Note: directory is ~/.Templates and not ~/Templates. ~/Templates was the default and I hid it as I didn’t wish to see it when using the directory menu in the LXQt panel.

1 Like

libreoffice-fresh atleast does use /usr/share/templates for the desktop files & /usr/share/templates/.source

funny is if you copy the templates folder too ~/.local/share you get the double :slight_smile:

2 Likes

in libreoffice you can create templates and make them default. if you have a writer document, and set it in Libreoffice and set it as default, wil it use that document as standard, as blender i dont know :slight_smile:

1 Like

OK. Now we have enough info to troubleshoot.
Let me list what we know, and after you read this man page, and check more things, you can find your way and give some feedback, if you think it is a bug somewhere:

  • If you have xdg-user-dirs-update package installed, it will autostart by-default and create standard user data folders in $HOME/. Check:
pacman -Qs xdg-user-dirs && systemctl status --user xdg-user-dirs-update.service
  • XDG conforming applications (file managers, launchers, etc.) use $XDG_TEMPLATES_DIR/ to find document templates and create “Create New (Document type)” menu entries. In your case, ~/.Templates is not one of them. Confirm it by renaming this folder.
  • Also, XDG conforming applications use the aforementioned system templates folder to look for such “Create New” entries (.desktop files), and add them to the menu. Check with:
ls -1  /usr/share/templates
  • LibreOffice uses $XDG_CONFIG_HOME/libreoffice/4/user/template to store user defined templates, and does not create any file in $XDG_TEMPLATES_DIR/. It then creates an option inside the application, when creating a new document (of the relevant template type).
  • If you had created any file shortcut (app launcher icon) at any panel, this shortcut does not update the target when the shortcut PATH is changed/renamed (like renaming to ~/.Templates).

I think these are enough to solve the mystery :smiley: .
Let’s see what you can get :wink:

3 Likes

That was it. Something during the LXQt install must have created them as they weren’t present when I used MATE. I ran sudo rm * in /usr/share/templates and afterward sudo mv ~/.Templates/* /usr/share/templates to ensure this wouldn’t happen again. Thanks for the help man.

For libreoffice is just for text you can add a template and make it start… then you dont need remove the template folder it goes back with an update…nut you can add a template and make one default. Its in libreoffce start menu

https://help.libreoffice.org/6.2/en-US/text/swriter/guide/template_default.html

If you point out the defaults it should set that standard on right click on desktop

I think you misunderstood.
Everything under /usr/ is installed by pacman/packages. You should never delete/edit files in /usr/.
Even if you do, they will be recreated with any relevant package update, or there will be a conflict error in pacman update process. You may add files with different filenames than existing ones, although there are usually other paths that you can use for this (/etc/, or $HOME), depending on the task.

This is a fair warning. Remember it when you face any issues like above-mentioned. :wink:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.