Loading Blog Search...

Thursday, January 20, 2005

Set default application tips for debian

In debian, sensible-browser and sensible-editor point to default Web browser and editor. You can invoke differenct default browsers by set the BROWSER environement var. The problem is how to set.
The following method is due to Osamu Aoki. It works OK with xfce, and maybe with other desktop environments. The commands are, unfortunately, run before the window manager starts. This makes this method somewhat unsuitable if you have icewm.

Three steps:

  1. As root, create a file /etc/X11/Xsession.d/40xfree86-common_user-xsession with the following contents:
    if [ -d $HOME/.xsession.d ]; then
    UXFILES=$(run_parts $HOME/.xsession.d)
    #or run-parts --list $HOME/.xsession.d
    #read man page of run-parts or run_parts*/
    if [ -n "$UXFILES" ]; then
    for UX in $UXFILES; do
    . $UX
  2. As user, create a directory called .xsession.d in your home directory.
  3. Put any commands you want to run when X starts (including commands for setting environment variables) in a file. Put this file inside ~/.xsession.d . Commands in any files (they do not need to be executable files) inside .xsession.d will be run on each X startup, provided the filename consists of aphanumeric characters, underscores, and hyphens only. So in particular backup files (filename ending in ~), and files with a dot in the filename will not be run.

Example: you want to run scim, which needs the following commands to be run when X starts:
export GDK_USE_XFT=1
scim -d
export GTK_IM_MODULE="scim"
export XMODIFIERS="@im=SCIM"
You can put these commands in a file called ~/.xsession.d/scim. The commands will be run when X starts. If you don't want these commands to be run anymore, you can re-name the file to e.g. ~/.xsession.d/scim.old. Because the filename now has a dot in it, its commands will not be run.

Another example: to run skype (the Internet telephony program) each time X starts, you put a file (called, e.g., skype) inside ~/.xsession.d, just containing the command skype&.

CategorySoft More to read ...

1 comment:

Li-Zhao 李钊 said...

please strictly follow the instruction to add scim support, I met some input problem when I didn't follow the instruction, e.g., use /etc/X11/Xsession.d/95input to replace the 40xxx script. GTK_IM_MODULE="scim" conflicts with acroread, thus, we can remove it.