This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] Cannot set default application for text/plain

Tags: None
(comma "," separated)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Hi, I've just moved to KDE (Kubuntu) after using Unity and Gnome Shell, which are both still installed on my system (so I'm not sure if there's some conflict there).

I'm having a lot of trouble trying to set kate up as the default application for text/plain files. At the moment, all text files open with gedit, whether I start from dolphin, konqueror, or command line (either xdg-open or kde-open). I have tried the following.

1) System settings > File associations > text/plain: move kate to top (above gedit).
When I tried to save, I was told that Configuration file "~/.local/share/applications/mimeapps.list" not writable. I checked the file and changed it from root ownership to writable by me.
I tried again, but the default did not change, and when I went back to the top menu and then reloaded "File associations", the order had reverted.

2) I checked ~/.local/share/applications/mimeapps.list , which seems fine. The relevant parts are here:
Code: Select all
[Added Associations]
text/plain=kate.desktop;kde4-kate.desktop;gedit.desktop;kde4-kwrite.desktop;libreoffice-writer.desktop;abiword.desktop;wine-extension-txt.desktop;geany.desktop;
...
[Default Applications]
text/plain=kate.desktop
...
[Removed Associations]
text/plain=kate-2.desktop;

Also, there is a file at ~/.local/share/applications/kate-2.desktop. I think this is a red herring. When I remove the final line above, I get two entries in the system settings named "kate" and "Kate", which makes sense. I'm not sure where the duplicate came from in the first place, but I guess I can delete it?

3) I tried modifying the default application with the terminal, but this also failed.
Code: Select all
$ xdg-open foo.txt # opens in gedit
$ kde-open foo.txt # opens in gedit
$ xdg-mime query filetype foo.txt
text/plain
$ xdg-mime query default text/plain
gedit.desktop
$ xdg-mime default kate.desktop text/plain
$ xdg-mime query default text/plain
gedit.desktop
$ sudo xdg-mime default kate.desktop text/plain
$ xdg-mime query default text/plain
gedit.desktop


Is there any way to fix my system and change the default application for text/plain? Thanks in advance.

Last edited by sparhawk on Mon Nov 12, 2012 11:41 pm, edited 1 time in total.
User avatar
google01103
Manager
Posts
6668
Karma
25
what if you rename ~/.local/share/applications/mimeapps.list, it should be recreated with the KDE defaults

for the file to have been not writable by you might imply that you had done some actions using sudo instead of kdesudo (sudo can mess with permissions as it runs the command as root but uses your config and other files so if some thing is changed it is saved as root) so making sure you have ownership of all your KDE files might be a good idea

chown -R account_name ~/.kde


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Ah excellent. Renaming the file worked for me. A bit of a mystery why it didn't work in the first place, as the relevant line is the same.
Code: Select all
[Added Associations]
text/plain=kde4-kate.desktop;kde4-kwrite.desktop;libreoffice-writer.desktop;gedit.desktop;abiword.desktop;wine-extension-txt.desktop;geany.desktop;

FWIW there was nothing else in the ~/.kde/ directory with non-me ownerships. Thank you for your help.
User avatar
freerunner
Registered Member
Posts
1
Karma
0
OS
sparhawk wrote:A bit of a mystery why it didn't work in the first place, as the relevant line is the same.


I think the point is to run kbuilsycoca4 after altering any of these values inside the .desktop files or mimeapps.list in order to get the new configuration registered.

PS: I hope this isn't considered necro-bumping...
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
freerunner wrote:I think the point is to run kbuilsycoca4 after altering any of these values inside the .desktop files or mimeapps.list in order to get the new configuration registered.

PS: I hope this isn't considered necro-bumping...


I can't exactly remember if I did `kbuildsycoca4` after this, but I think that I probably restarted several times after I first noticed this issue, which I assume does a similar thing. Also, I presume that messing with the system settings also does something similar.

P.S. I dislike necro-bumping-phobia, because I think that one function of forum threads are to be preserved to help other people in a similar situation. Hence, I think that any new pertinent information is useful, whenever it comes. (Although others obviously disagree.)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Just as a note, kbuildsycoca4 is invoked on each user login and by System Settings when you change application associations.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]