LWN.net Logo

A default desktop for openSUSE?

A default desktop for openSUSE?

Posted Aug 6, 2009 9:29 UTC (Thu) by NAR (subscriber, #1313)
In reply to: A default desktop for openSUSE? by drag
Parent article: A default desktop for openSUSE?

It's just outside of Alternative's scope. It's for setting system-wide defaults.

But the "feature-request" was for user-wide default. For example on my desktop Firefox open gedit to check textfiles, when I absolutely don't want to use gedit, I want to use gvim. Nautilus also uses gedit, while crontab uses the EDITOR variable (or the VISUAL variable?). Also in Firefox if I click on an e-mail link, it starts Evolution when I have absolutely no desire to run Evolution, I use alpine. In Nautilus when I click on an MP3 file, it starts banshee(?) when I want to use xmms. Now there's a "Default applications" (?) setting in GNOME, but that's very far from complete. Actually with my Windows experience I've found where I could change the default application for MP3 files to xmms, but maybe it would be useful if there would be a single window where the applications can be setup.


(Log in to post comments)

A default desktop for openSUSE?

Posted Aug 6, 2009 14:50 UTC (Thu) by drag (subscriber, #31333) [Link]

> But the "feature-request" was for user-wide default.

Hrm. I thought I read it as being able to set system-wide defaults AND user-specific defaults. Alternatives can do the system-wide so it 'sorta' meets the requirements.

> But the "feature-request" was for user-wide default. For example on my desktop Firefox open gedit to check textfiles, when I absolutely don't want to use gedit, I want to use gvim. Nautilus also uses gedit, while crontab uses the EDITOR variable (or the VISUAL variable?). Also in Firefox if I click on an e-mail link, it starts Evolution when I have absolutely no desire to run Evolution, I use alpine. In Nautilus when I click on an MP3 file, it starts banshee(?) when I want to use xmms. Now there's a "Default applications" (?) setting in GNOME, but that's very far from complete. Actually with my Windows experience I've found where I could change the default application for MP3 files to xmms, but maybe it would be useful if there would be a single window where the applications can be setup.

Ah.

That sort of stuff is easy to deal with. At least the file type associations. It's already taken care of.

It's part of the FreeDesktop.org .desktop standard. (as in DOT-desktop).

If you look at your system directory tree closely you'll notice that there are lot of these *.desktop files for various applications and whatnot. Like 'totem.desktop' and things of that nature.

These are used to tell your GUI system various details about applications and their executables. Stuff like International names, comments, mime associations, execution commands, and things of that nature. It's a simple ini configuration file for each application.

Then there are a system-wide defaults files called 'defaults.list' that contain the default associations with various file types and whatnot.

--------------------------------------------

So here is how it works in Gnome:

To set user-specific associations with file types you go to a file on your desktop and right click it. Goto properties --> "open with" tab --> then choose which item you want to be the default.

If the program you want associated with that file type is not in the list then you can click the '+ add' button and choose a installed application.

If the application you want is not in that list either then you can enter a command to be ran.

Now what happens with that is when you pick something other then a default your preference is record in your ~/.local/share/applications/ directory.

This is designed to be cross-platform and should be honored by all your applications. If you make settings in KDE it should be honored in Gnome and visa versa.

that is the 'GUI' way to set your defaults stuff.

So if you want to set vlc to launch mp3s instead of rhythmbox you just have to find a mp3 and right click it into the properties --> open with tab and select the vlc radio button and save it.

----------------------------

If these preferences are not honored by another application (say you want to listen to a MP3 from a RSS feed in Liferea) then that application probably has it hard coded or makes the user choose through preferences, which is stupid, but it is usually just because the program pre-dates xdg stuff and hasn't been fixed yet.

For applications like that that are kinda stupid you can have them just launch either 'xdg-open' or 'gnome-open' command which will then launch the prefered program with the associated mime-type automagically.

It's not perfect. For example if I want to have Mutt use my default browser I can't use gnome-open since Gnome-open kills itself as soon as it launches the browser, which confuses Mutt. So I have to use a python script to emulate gnome-open.

------------------------

Now if the idea of manually clicking through different file types to set associations does not appeal to you then you can do it manually.

Now I've done this in the past, so I am hoping that it still works.

So you pick a defaults.list file. For me, since I am using Gnome, then I'll pick /etc/gnome/defaults.list

Copy that file to ~/.local/share/applications/

Then edit it. If you want to swap gedit for gvim then you need to figure out gvim's *.desktop file (or manually make one if one does not exist) (which one does, called gvim.desktop) and then run something like this in vim:

:% s/gedit/gvim/g

And that is it. Your done. You've successfully switched all the defaults from gedit to gvim.

------------------------------

But that is not perfect. This is only for file ---> mimetype associations. So when you double click on a file or launch a file from another program then it should honor these settings.

but that does not change your default email settings.

For that see: http://portland.freedesktop.org/wiki/EmailConfig

There are a few different xdg-* style commands. Check them out.

they are very useful for scripts you want to integrate into your desktop.

-----------------------------

For setting defaults for launching applications during login it's pretty simple to....

Simply copy the file or make a symbolic link from the application's *.desktop file to the ~/.config/autostart/ directory.

This way you can launch applications. To make custom launchers for scripts and such then you can just make your own desktop file and copy it to that.

It's pretty simple.

This is why Gnome broke it's session management stuff a while back.. to be compliant with the XDG stuff. (hopefully they will eventually make it feature complete)

Now this isn't so important for Gnome and KDE, but if your using a something like LXDE this sort of thing makes your life much much easier.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds