Posted Jun 2, 2010 21:47 UTC (Wed) by kmself (subscriber, #11565)
In reply to: Giggle: A Git GUI by ikm
Parent article: Giggle: A Git GUI
There are a few general places to look.
Your environment for starters. $EDITOR, $VISUAL, and several BROWSER variables (console, WWW, and unqualified).
The generic commands "sensible-browser", "sensible-editor", and "sensible-pager". These are shell scripts generally invoking what's defined in the environment. Look under /usr/bin.
The /etc/alternatives/ subsystem. man (8) update-alternatives for how to configure. This works by redirecting generic program names (say, 'editor', 'vi', or 'awk') through symlinks in /etc/alternatives/ to the system preferred default.
Depending on the tool, /etc/mailcap may get invoked. There's a user-defineable area at the top of the file.
GNOME, KDE, and XFCE4 each have their standard application associations which are more or (usually) less coordinated. Manage through their respective configuration utilities (gconf-editor, gconftool, gconftool-2 for GNOME, if you want to avoid the GUI configurator, not sure that KDE or XFCE4 have similar tools).
Some apps (OpenOffice.org and Iceweasel come to mind) have their own associations particularly for mail clients.
Yeah, it's a bit of a mess. There were good (or at least middlin') reasons for most of this at the time.
Posted Jun 2, 2010 23:47 UTC (Wed) by drag (subscriber, #31333)
[Link]
GNOME, KDE, and XFCE4 each have their standard application associations which are more or (usually) less coordinated. Manage through their respective configuration utilities (gconf-editor, gconftool, gconftool-2 for GNOME, if you want to avoid the GUI configurator, not sure that KDE or XFCE4 have similar tools).
No... Not really. Not at least for well-written applications. There are tons of applications that do not follow the standards setup for handling file associations, but there are standards and they do not involve anything to do with gconf or anything like that.
In Gnome and KDE the file type association should be handled the same. I don't know about KDE 3.x stuff, but KDE 4.x should work sanely.
They all use the .desktop FreeDesktop.org standard.
The idea is that every typical desktop-oriented application should have a *.desktop file associated with it that gets installed to your system. This file describe what icon to use for it, internationalization names, short names, comments, how to launch he application, and that sort of thing.
That way your desktop environment can educate itself and use automatically generated menus so that you don't have to hard code menus and file associations like you did in the bad old days.
------------------
Some examples on how to use it.
FOR LAUNCHING APPLICATIONS AT LOGIN:
To launch a application at start up make a symbolic link, copy the *.desktop file, or create your own *.desktop file and stick it into "$HOME/.config/autostart"
You can specify in there if you only want it to be launched from a particular desktop environment, or you can eliminate that and then all compliant desktop session managers should launch it at log in.
You can easily create your own .desktop file and store it at "$HOME/.local/share/applications"
MANAGING FILE TYPE ASSOCIATIONS:
File associations are managed by 'defaults.list' file. This file lists the mime type and then the corresponding *.desktop file for the application you want to be used by default.
This file is can be manually created and managed, or it will be created by your desktop environment (usually your file manager) when you change the defaults. You can edit it directly and will be honored right away.
Gnome and KDE (and probably other desktop environments) will have their own set of default lists. On my system (Debian) the Gnome list is located at "/usr/share/gnome/applications/defaults.list"
Your own settings will override the generic defaults and that file can be found at: "$HOME/.local/share/applications/defaults.list"
HOW TO DEAL WITH STUPID APPLICATIONS/APP AUTHORS:
These are applications that launch other applications to handle media whose authors don't have a clue about the freedesktop.org stuff, or are legacy applications.
Most of these applications you have to manually set their own application-specific configuration for launching external apps. (like you really want to spend your time configuring each and every application you use to use every other application you want to use)
To easily deal with them you just tell them to use the '/usr/bin/xdg-open' (or gnome-open) application. These are standardized tools designed to be used by scripts and application authors to make it possible to conform to the standards with minimal effort.
One example application I use that I need to do this with is Liferea. I use it for a variety of feeds, some of which are podcasts and some are video feeds. I just go through and use 'xdg-open' for every thing.
Similar problems exist for the users of Firefox and other non-Gnome/non-KDE applications. Also this is very common problem for GTK-using, but otherwise non-Gnome applications.
For applications like 'mutt' that want the spawned process to block until your finished with it then you'll have to go to greater lengths.
This python script will launch applications similar to xdg-open or gnome-open, but will block until you close out the child app.
#! /usr/bin/env python
import gnomevfs
import os
import sys
# taken from http://therning.org/magnus/archives/251
mime_type = gnomevfs.get_mime_type(sys.argv[1])
mime_app = gnomevfs.mime_get_default_application(mime_type)
application = os.popen('whereis %s' % mime_app[2]).readline().split(' ')[1]
os.execl(application, application, sys.argv[1])
I call it 'mutt-helper.py' and my $HOME/.mailcap file looks like this:
I use KDE 3.5. Do they all apply? Which one takes precedence? I am sure I could find out, but who has time for such nonsense...
Seriously, this is a sad state of affairs.
Debian associations
Posted Jun 7, 2010 8:32 UTC (Mon) by ikm (subscriber, #493)
[Link]
> I am sure I could find out, but who has time for such nonsense...
Yep, that's exactly why I just try not to use associations at all. It's not really handy, but it seems simpler than trying to figure out how to fix them.
Re: Debian associations
Posted Jun 10, 2010 4:30 UTC (Thu) by ldo (subscriber, #40946)
[Link]
Ummm .. I notice you have single quotes instead of double ones in '$DISPLAY'. Does that do what you intend?