MC (Midnight Commander) is a great piece of software and I use it a lot, even when I’m using a graphical desktop environment. Unfortunatly, it had to reach version 4.7 and many-many years of development until it got proper color themes support! But I’m not complaining (oh well, maybe a little) – I am now the happy user of MC 4.7 running on my brand-new Ubuntu 10.4 install, and I just noticed the skins support.
Of course, it is not perfect and it’s not the best approach either, but before we’ll get into that, let me show you an example of what coloring MC was like a few releases ago:
You see that horrible cryptic line? It was supposed to go into ~/.mc/ini and would change MC colors. Any typo would lead to colors not loading. And it doesn’t end here.
Since that file is overwritten when you exit MC, you can’t edit it with MC’s internal editor, so you have to edit a copy, exit MC and overwrite the file. Yes, talk about dubious design decisions. So I’m not going into that.
What I am going to write about is how the skins support work in MC 4.7 or later. The skins are simple ini files that are placed in /usr/share/mc/skins.
You can load any of the skins there with the command:
$ mc -S skinfile
Don’t write any path or the .ini extension of skinfile.
If you want to make the changes permanent, you need to edit the ~/.mc/ini file to contain this line:
Of course, make sure you don’t have MC started or you’ll lose the settings when you exit it. Edit a copy and replace the ini file:
$ cd ~/.mc $ cp ini ini.new $ mcedit ini.new (do your stuff) $ mv -f ini.new ini
MC comes with some predefined skins, so it’s pretty easy to “fork” one of them so you can customize it to your liking.
The skins support is (incompletely) documented on the mc wiki. The options that are not described on the wiki are pretty easy to understand – for exemple the characters used to draw the boxes.
To create a new skin, you just need to copy one of the existing files (I used default.ini) and edit it. After you save your changes, you should first test it with mc -S skinfile. The changes are not permanent, so if you messed up the display, you don’t have to kill all your MC settings.
The bad news is that there’s no option in the interface to choose the skin and no documented support to load a skin from your own home directory, so if you don’t have root access (or a friendly sysadmin), you can’t use the skins support.
Leaving the bad parts aside, in less than 20 minutes I was able to convert the horrible line at the beginning of the post to a complete skin, and now my MC changed looks from this:
You can download my skin file here – just save it to /usr/share/mc/skins and you can use it.
Enjoy and let me know what you think in the comments! Also, if you have improvements, I’m interested to see them!
For my romanian small-biz friends: make sure you read the NOVIT news!