Apr 30th

Editing skins for Midnight Commander

2010, 13:24 UTC | By | In *iX
Leave a comment | Trackback  | 4411 views

Text mode doesn't have to be ugly :)

GNU Midnight Commander

Working on a text console is sometimes necessary, even if you don't like it and prefer a graphical desktop. But on many *iX systems which are mainly performing server tasks, a graphical desktop often doesn't exist. That doesn't mean you have to live with zero comfort.

There are many tools for the character based text mode (or console) and one of the better known is the GNU Midnight Commander. It is a text-mode based file manager, file viewer and text editor, combined in a relatively small and fast package. Its feature set is vast and its interface basically resembles a more than 20 years old concept - the dual pane view.

By default, MC also imitates the color scheme of the first Norton Commander - white text on a medium blue background - a scheme instantly recognized by many older users out there. But not anyone may like this default scheme and the developers know this, so they always allowed you to change the colors in the Midnight Commander INI file.

The last major release (4.7) improved on this basic feature and now it is easily possible to create skins (or better: color themes) for MC. Such a theme is a collection of color values used in various areas of the program and MC 4.7 even allows you to colorize different file types so you can instantly recognize, from the color of an entry, whether it is an archive, an executable script or program or a media file.

Using skins in MC

First, you must make sure you have a version that supports themes or skins. You need at least MC 4.7.x. To check your MC version number simply type

$ mc -V

(a capitalized v) in the command line. The output of this command will look similar to the following:

GNU Midnight Commander 4.7.0.2
Virtual File System: tarfs, extfs, cpiofs, ftpfs, fish, smbfs
With builtin Editor
Using system-installed S-Lang library with terminfo database
With subshell support as default
With support for background operation
[... more follows ]

Once you have checked that you have a compatible version, you must create a folder with the name skins in your already existing $HOME/.mc folder. All skins must be installed into this folder and, by convention, the filename must have the .ini extension, so for example:

$HOME/.mc/skins/darkone.ini

Would be available as a theme with the name "darkone".

Activating a skin

Before editing the ini file, make sure to close all instances of Midnight Commander or else you will lose your changes (Midnight Commander writes the ini file when it closes).

Edit your $HOME/.mc/ini file. Yes, this sounds a bit weird, but this file is really called ini (small letters, no extension, just ini). If it does not exist, you can create it (touch ~/.mc/ini) and thereafter edit it. Usually, the file should already exist when you have changed options in MC but on a completely fresh install, it may not yet have been created, which means, your MC will use the default settings, usually located somewhere in /usr/share or /usr/local/share (where it really lives depends on your type of operating system or distribution).

[Midnight-Commander]
skin=darkone

That's it basically. You need to find the section [Midnight-Commander] and add the line skin=yourskinname where yourskinname refers to the name of the ini file you have copied to ~/.mc/skins WITHOUT the filename extension.

Caution: The skin= line may already exist in the ini file, so search before you add it. Only one skin= entry is be allowed and the last one is valid.

Editing a skin

A skin is a simple text file that follows the traditional INI syntax. Sections are defined by names enclosed in square brackets, definitions follow the name=value pair syntax.

You can use the default 16 console colors and must reference them by name:

  • The darker colors: blue, cyan, green, brown, red, gray, black, magenta
  • The brighter colors: lightblue, lightcyan, lightgreen, lightred, lightgray, lightmagenta, white, yellow

Sample skin with a dark background, colorized file types

I've attached a sample dark theme which you can use as a base for your own creations. Simply unpack it, copy the darkone.ini to $HOME/.mc/skins and edit $HOME/.mc/ini to enable it. Remember, close all instances of mc before editing the ini file.

Download

1 Like Like
No comments yet.

Subject

  (this is optional)

Comment text

Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>