Configuring Midnight Commander
#194 Henry, Saturday, 23 August 2014 8:52 PM (Category: UNIX Tools)
(Tags: mc midnight commander)

I use Midnight Commander a lot. I depend on it. Over the years, it's gone through a lot of configuration changes. At one point, I had the mc.ext file working nicely so when I had an image file highlighted, and pressed Enter, it would display that file with gqview. Gqview went away, and was replaced with geeqie. I reconfigured Midnight Commander to use geeqie. But somehow, my change disappeared.

Here's what I think happened.

The config files for Midnight Commander are currently in ~/.config/mc. They've been in lots of different places over the years, but this is where they currently live. The file that controls what handles files is mc.ext.

All the different file types are listed in there like this:


and further down, handling of type Image is controlled by this:

    View=%view{ascii} /usr/libexec/mc/ext.d/ view ALL_FORMATS
    Open=/usr/libexec/mc/ext.d/ open ALL_FORMATS

That will push images out to Firefox. Why, I don't know. I've read that file, and it doesn't mention Firefox. But in action, if I hit Enter on a file, it displays it in Firefox, moving Firefox from the window it was open in, and doing other things I don't want to happen.

I think in the past, I edited that file to force images to geeqie. But that's a mistake. Next time there's an upgrade, that file gets overwritten. If you want customised changes to be permanent, you must make them in your local config file.

So I edited ~/.config/mc/mc.ext and changed the Image section to this:

    View=/usr/bin/geeqie %f
    Open=/usr/bin/qeeqie %f

and now it behaves the way I want it to behave.