How to set default apps in Gnome via command

Is there a command that can change the default apps?
I mean specifically this setting:

Changed the association from Photo Viewer to gThumb. But I’d like to do this via a command as well to automate it during system (re-) installs.

1 Like

I think gsettings or dconf would be the way to script this :thinking: , which is how you would do Shortcuts as well in dconf.


Just checked dconf editor and could not find it. So i assume it’s gonna have to be gsettings.

edit :

I had better success with :

xdg-mime query default 

application/  audio/        font/         image/        message/      model/        multipart/    text/         video/

which for example returned :

xdg-mime query default video/mp4
org.videolan.VLC.desktop

2 Likes

Yes but that is not what I meant. I know I can use xdg-mime to change the default application per file-type.
What I am referring to is a command to change the default application for an entire category of file types such as images/photos.

I already did dconf watch / while changing the setting in my screenshot, but nothing appeared so indeed no gsettings/dconf solution will work.

1 Like

Take a look to ~/.config/mimeapps.list

At least when I set Chrome as Default Web App, in such file I get

...
x-scheme-handler/https=com.google.Chrome.desktop
...

When I switch back to Firefox, I get

...
x-scheme-handler/https=org.mozilla.firefox.desktop
...

More info: Override the default registered application for individual users

Edit. Hint: explore gio command

1 Like