File associations in Linux (Gnome and Mailcap)

File associations in Linux can be tricky. On my Gnome-based Ubuntu machine, I can associate a filetype by right-clicking a file in Nautilus, and slecting “Open with”. To modify the defaults using config files, this post describes it well. Basically, the two main locations to check out are /usr/share/applications/defaults.list and ~/.local/share/applications/. File associations made using these methods apply to the commands gnome-open and xdg-open as well.

File associations in the command line is mainly done via MIME types (I think). At least file associations in conkeror, org-mode’s org-open-at-point (also look at org-file-app), and the see commands are done by MIME. MIME handlers are defined in a user’s ~/.mailcap file.

I think this information is enough to modify default apps throughout Linux. Do see this post where I outline how I launch all my files using Emacs’ dired mode. Now I can launch apps more uniformly in Nautlius, Emacs, and on the command line based on configuring default apps.


Since Canonical decided to ship Ubuntu with Unity as opposed to GNOME as the default desktop in their next release, I decided to take a look at StumpWM again.

Although I like keyboard driven apps like emacs, conkeror, and screen, GNOME with Tracker + deskbar-applet (similar to Mac OS X’s Spotlight) has been sufficient; I think any stable Linux desktop is sufficient for me since they’re all very configurable by default (keyboard shortcuts!). The need for a tiling window manager doesn’t apply to me since 1) I work on my laptop/netbook (10in-13in), so I usually have windows maximized; 2) I’m pretty fast with Alt-Tab; and 3) non-minimal window manangers have certain services all set up, such as sound/video control (with shortcuts), network manager, etc. Basically, having convenient applets, a quick way to move between windows, and a quick way to launch apps (think Mac OS X’s Spotlight) makes me happy.

Nonetheless, I toyed with StumpWM again but decided I’m not ready for it yet. Maybe I will be ready the next time when I’m using a bigger screen. I’ll outline my trial for documentation.

I followed this to set up StumpWM on Ubuntu. This screencast gives a good overview of the powers of StumpWM.


sudo apt-get install sbcl sbcl-doc ## common lisp compiler
sudo sbcl
## enter following in sbcl prompt
## select [SKIP-GPG-CHECK] when asked. Have to do this a few times
(require 'asdf)
(require 'asdf-install)
(asdf-install:install 'clx)
(asdf-install:install 'cl-ppcre)
## more install
sudo apt-get install xorg-dev
git clone git:// ## use latest version
cd stumpwm
sudo make install
sudo make install stalonetray ## for docking applets from GNOME

Add StumpWM as an entry in GDM Sessions Menu

sudo emacs -q -nw /usr/share/xsessions/stumpwm.desktop
## add following
[Desktop Entry]
Comment=This session logs you into StumpWM (a minimalistic window manager)

Restart computer and choose StumpWM when logging in.


;; -*- lisp -*-
(in-package :stumpwm)

;mode line
(stumpwm:set-fg-color "green")
(stumpwm:set-bg-color "black")

;startup apps
(stumpwm::run-shell-command "stalonetray")
(stumpwm::run-shell-command "nm-applet")
(stumpwm::run-shell-command "gnome-volume-control-applet")
(stumpwm::run-shell-command "gnome-power-manager")
(stumpwm::run-shell-command "system-config-printer-applet")
(stumpwm::run-shell-command "dropbox start -i")
(stumpwm::run-shell-command "gnome-power-manager")
;; (stumpwm::run-shell-command "")
;; (stumpwm::run-shell-command "")

(define-key *top-map* (kbd "M-Tab") "pull-hidden-next")
(define-key *top-map* (kbd "M-ISO_Left_Tab") "pull-hidden-previous") ;; shift
(define-key *top-map* (kbd "M-]") "pull-hidden-next")
(define-key *top-map* (kbd "M-[") "pull-hidden-previous")
(define-key *top-map* (kbd "s-Tab") "fnext")
(define-key *top-map* (kbd "s-]") "gnext")
(define-key *top-map* (kbd "s-[") "gprev")
(define-key *top-map* (kbd "s-b") "move-focus left")
(define-key *top-map* (kbd "s-n") "move-focus down")
(define-key *top-map* (kbd "s-p") "move-focus up")
(define-key *top-map* (kbd "s-f") "move-focus right")
(define-key *top-map* (kbd "M-F4") "kill")
(define-key *top-map* (kbd "s-s") "fullscreen")
(define-key *top-map* (kbd "M-F2") "exec")
(define-key *top-map* (kbd "s-SPC") "exec")

(define-key *root-map* (kbd "M-F") "fullscreen")

I want to try xmonad next when I have time. My verdict now is to stay with GNOME.