You are not logged in.

#1 2015-01-26 00:48:47

smohr
Member
Registered: 2012-05-29
Posts: 33

[SOLVED] set default applications

Hey everybody!

I have a problem with my default applications. If I open a text file, it will be opened by libreoffice writer instead of gedit.
I would like to change this behaviour for all users.

The information in https://wiki.archlinux.org/index.php/De … plications is not useful. There are no mimeapps.list files, just mimeinfo.cache.

So I added /usr/local/share/applications/mimeapps.list

[Default Applications]
text/plain=org.gnome.gedit.desktop

[Added Associations]
text/plain=org.gnome.gedit.desktop

[Removed Associations]
text/plain=libreoffice-writer.desktop

Nothing changes.
I have deleted $HOME/.config/mimeapps.list and $HOME/.local/share/applications/mimeapps.list.
I have renamed  /usr/local/share/applications/mimeapps.list to  /usr/local/share/applications/defaults.list and also moved to  /usr/share/applications/mimeapps.list.
It does not work.

What is my fault?

Thanks for helpful advices.

P.S. I don't want to change mimeinfo.cache or modify the desktop-files in /usr/share/applications. I also like to avoid creating $HOME/.config/mimeapps.list because I have multiple user accounts on my system.

Last edited by smohr (2015-01-26 15:59:28)

Offline

#2 2015-01-26 00:51:16

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] set default applications

Are you using Gnome? Some details of your setup would be helpful...


Moving to NC.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-01-26 00:55:18

smohr
Member
Registered: 2012-05-29
Posts: 33

Re: [SOLVED] set default applications

I'm using gnome 3.14.2, linux 3.18.3.
But I think that doesn't matter,  "xdg-open is a desktop-independent tool for starting default applications."

Offline

#4 2015-01-26 09:37:34

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: [SOLVED] set default applications

GNOME, KDE etc have their own tool that replaces/builds upon xdg-open. If you run a desktop session in a DE, xdg-open will pass the command to the file opener used by that DE (wiki). That would probably also mean that the files you've been editing are not sourced at all.

In GNOME you should be able to set the default applications using the file manager or maybe the settings menu.

P.S. See the link you provided for a gnome centric solution.

Offline

#5 2015-01-26 15:58:59

smohr
Member
Registered: 2012-05-29
Posts: 33

Re: [SOLVED] set default applications

Thank you for the information.
I have been able to solve my problem.

The filename is defaults.list and it doesn't mapper whether /usr/local/share/applications/ or /usr/share/applications/ is used.

The fault was somehow with the brackets in [Default Applications].
Can somebody explain the difference? The files are located here:
https://www.dropbox.com/sh/mq1xmaq2isu3 … aMJya?dl=0

The defaults.list works, the other one not.


By the way, the tip in https://wiki.archlinux.org/index.php/GN … le_manager doesn't work anymore:

% sudo xdg-mime default org.gnome.Nautilus.desktop inode/directory
touch: cannot touch ‘/root/.local/share/applications/mimeapps.list’: No such file or directory
/usr/bin/xdg-mime: line 820: /root/.local/share/applications/mimeapps.list.new: No such file or directory

Offline

#6 2015-01-26 16:03:01

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: [SOLVED] set default applications

smohr wrote:

By the way, the tip in https://wiki.archlinux.org/index.php/GN … le_manager doesn't work anymore:

% sudo xdg-mime default org.gnome.Nautilus.desktop inode/directory
touch: cannot touch ‘/root/.local/share/applications/mimeapps.list’: No such file or directory
/usr/bin/xdg-mime: line 820: /root/.local/share/applications/mimeapps.list.new: No such file or directory

The reason why that trick doesn't work is because you shouldn't use sudo for that. '$' means run as normal user, not root.

EDIT: Sorry, seems that you can run it as root. However, the file created will not be sourced before the local user file. Thus you'll need to delete the user's file for the trick to work.

EDIT2: The file that the command created is not the file mentioned in the wiki, so indeed that will not work when run with sudo.

Last edited by runical (2015-01-26 16:06:42)

Offline

Board footer

Powered by FluxBB