Skip navigation.

Blog

Skip the blog side panel.

On 23rd of April 2015, Mihai Șucan passed away due to metastatic cancer caused by RDEB.

My name is Mihai and I work on the Firefox developer tools. When it comes to web development, I like both server-side and client-side work. I am mainly interested in web browsers, web standards and related technologies.

Fix/configure Linux font rendering

One of the most common issues on Linux is font rendering. Usually the Arial font renders really badly, especially if you use Gnome and you try KDE/Qt applications (for example Opera).

Gnome and KDE use fontconfig to render fonts, but both use different settings. As such, if you pick your Gnome-based distro, you usually have problems with KDE/Qt, and vice-versa.

The Appearance properties (gnome-appearance-properties) allows you to nicely change the font rendering options. You can also manually adjust these settings using the gconf-edit tool, just go to the /desktop/gnome/font_rendering preference keys.

KDE has it's own appearance properties, but usually Gnome users don't know which one it is, and they don't want to install the entire KDE package.

To adjust the font rendering options for KDE/Qt applications, here's what you need to know. You can create a per-user ~/.fonts.conf file, or you can set system-wide settings by editing /etc/fonts/fonts.conf (and/or /etc/fonts/conf.d).

Download my .fonts.conf file. Just save this in your home folder and restart your KDE/Qt applications. I use the same settings in Gnome.

I do not recommend you to edit the /etc/fonts/fonts.conf file. However, you can still adjust global settings by changing the symbolic links in /etc/fonts/conf.d. I did that myself.

Please read man fonts.conf for more details.

Note: you might not like my font rendering configuration, because it also depends on your monitor and screen resolution. Please adjust the settings as needed.

Linux, Konqueror 4 and more

Sunday I upgraded my Ubuntu installation to the new version: Ubuntu 8.10. Almost three years ago I switched to using Linux exclusively. I haven't reinstalled Ubuntu since then. I always upgrade my system every 6 months, and then I spend a few days fixing post-upgrade issues. It's a pleasure. ;)

I am working on a new painting Web application. The greatest surprise to me was that the new Konqueror 4 implements <canvas>, and it does this theoretically better than Opera. I will make my Web application public and you will see this. Amazing and very quick work done by the Konqueror developers. Congratulations, guys!

Note: I initially thought that the Konqueror implementation of Canvas is just a copy of the code from Webkit, but it's not. They wrote their own code, which is great.

On a related note, I have published a new page with some of my Linux configuration files.

My KDE color scheme

Someone contacted me several months ago asking for my KDE color scheme, after he read my blog post about the Kubuntu theme.

Now I had the time to do so. Download my KDE Human color scheme.

Note: The color scheme was made for personal use. No changes were made for this release. I did not intend to make it look very good/professional. Actually, I believe it looks pretty bad in KDE. I use GNOME and the colors are picked such that the KDE applications look good enough in GNOME.

I use the Polyester KDE Style. You might want to try the Klearlook KDE style as well. Both styles are available in the Ubuntu repositories.

For making your KDE applications even more ... Human, make sure you pick the Human icons in KControl.

Good luck. :)

My .vimrc file

Since I started using Vim 7 I created my configuration file. I upload it to any remote server where I have vim installed. Here it is for anyone who likes vim:

Download .vimrc.

Highlights of the file:

  • Enabled maximum memory usage for better performance when you have lots of RAM (1 GB here).
  • Enabled the use of ~/.viminfo which remembers data across restarts of vim (open buffers, marks, history and such).
  • Automatic complete.
  • Automatic Indentation.
  • Syntax highlighting.
  • Code folding enabled.
  • Line numbering enabled.
  • Automatic file backup, on save.
  • Custom status line and ruler.
  • For code indentation tabs are used instead of spaces. Tab width is set to 4 spaces.
  • Word wrapping is enabled, but no automatic formatting is done in the actual file. Just like in Notepad (and other simple editors) you see the document wrapped on screen.
  • Changed the keyboard mapping such that when you press " you get the second ". Same goes for when you open a parenthesis (, vim automatically closes the paranthesis with ).
  • Added two new functions: Fullscreen and Eretidy.
  • Fullscreen disables line numbers, code folding column and also disables the status line. You only get a view very similar to the view of more (or less). At the bottom of the screen, on the right side you have a small ruler which tells the buffer number, file type, line number, and column number. I use this function when I edit text documents - very nice to have a "simple" editor.
  • Eretidy is specifically tailored for me. This function just opens the ReTidy files. I use this quite often when cleaning documents.

For readability, I didn't use short notations in the file. For example, I use set autoindent instead of set ai.

I will update the file from time to time.

Customize your Linux terminal

Hello!

How many like the terminal/console in Linux?

I myself like it, even if I do not use it too much. I use much of the X-based "bling bling": Gnome, Opera, Gaim, Xchat, Quanta, XMMS, etc. However, I particularly enjoy the power the console gives you: the one who says you're somehow limited in the terminal is very wrong. That's because you do almost everything you want: you can play music, you can play browse the web, use any Internet protocol (ftp, bittorent, pop3/imap/smtp mail, etc), you can do programming (of course), etc.

Simply forget about the MS-DOS console you know. That's limited (flame bait). Linux console, even if it looks the same, it's not the same. :)

One thing missing in the GUI approach (KDE, Gnome, Windows, Mac OS X, etc) is consistency. The terminal is always consistent, it's the same on Linux, on Windows and Macs. The commands differ between operating systems, but the basics are the same.

I did four things to customize my terminals on Ubuntu Linux:

1. Console font. I picked a font which includes the most-used non-english characters in the documents I usually view (romanian and french).

To do this after you booted use:

consolechars -f /usr/share/consolefonts/font-file-name

This is handy for testing because the changes will be lost after you restart, plus the changes are applied only to the current terminal.

You shall pick the font-file-name you want. Just take a look at the console fonts you have installed. The ones I have are named based on the character set they can display: iso01, iso02, latin1, koi, etc. I use iso-8859-2 (for Central European).

To make the change permanent just edit /etc/console-tools/config. Change SCREEN_FONT value to the font file name you found to like.

2. Keyboard layout. I changed the keyboard layout to a custom keyboard layout I made, based upon the romanian programmers keyboard layout provided by default in Ubuntu, plus the American international keyboard layout with dead keys. Last, but not least, I also looked into the French keyboard layouts :). My purpose was to have a normal english keyboard layout, but greatly enhanced for Level 3 (activated with the Right Alt key).

To make your own custom keyboard just go to /etc/X11/xkb/symbols and pick the keyboard language you want to start from. Edit it, look into other files to learn what needs to be changed, have fun. :)

Things to know about those files: they contain the symbols associated to each key on the layout. Therefore, they are not exactly keyboard layouts. The files are named based on the country code, and they contain all the keyboard variants belonging to the country. You should be able to add your own, but you need to learn how to do that (you need to edit other files aswell). My file does not add a new variant for two simple reasons: lack of knowledge (caused by lack of spare time to learn how), lack of motivation (caused by the fact I don't want to backup another file). I just modified the basic variant.

XKB is very advanced and complex: you can change the geometry, the rules, the symbols, everything. You can make a single key do wonderful things. Yet, don't ask me how LOL (I am still learning myself). All I know is enough to make my own nice keyboard layout :).

To learn more:

It is important to note all changes also apply to the X server. You can use the keyboard layout in Gnome, KDE and what else you wish.

To change the keyboard layout in the terminal just run kbd-config or

sudo dpkg-reconfigure console-data

In Gnome you must know how to do it, same goes for KDE.

Download my keyboard configuration: xkbd-ro.

If you are a romanian, you'll most likely want this layout :). Save the file as /etc/X11/xkb/symbols/ro (overwrite!).

For maximum fun I edited my xorg.conf to use the custom keyboard layout.

Section "InputDevice" 
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "ro"
Option "XkbVariant" "basic"
EndSection

For an unknown reason, the keyboard layout does not work exactly in the same way as in X. In the console, the keyboard map is a bit "screwed" and dead keys are out of the discussion, since they are not supported by the font. I'll probably have to make a new variant specialized for the console. Based on what I learned, the difference might be caused by the fact I do not have the same XkbdRules as xorg. I'll see. :)

Suggestion by csant: To edit the keyboard layout, you can also use a GUI-based tool:

sudo apt-get install xkeycaps

3. Sticky keys. I use sticky keys in X, so I wanted to use them in the terminal aswell. The above two guides also provide tips in regards to how to enable sticky keys. Based on other tutorials, there are several ways one can achieve this goal. I picked the "loadkeys method".

The file is:

keymaps 0-6,8-9,12 
keycode 29 = SCtrl
keycode 42 = SShift
keycode 56 = SAlt
keycode 54 = SShift
keycode 97 = SCtrl

Keymaps differ from a configuration to another. So, you need to learn which ones are on your system:

dumpkeys | head -1

Save the above file, after you update it and execute:

sudo loadkeys your-file

Warning: Providing a wrong keymap can render your keyboard unusable (I actually needed to do a forced reset :) ).

Warning 2: Your system might use different keycodes for the same keys. If this is the case, use showkey. Generally, if you have a PC which is "mainstream" (like mine), this should be safe.

If you take a close look at the above, you'll notice the missing second SAlt. That's because the second one (Right Alt = keycode 100) does provide access to level 3, used for inputting special chars. Making it sticky, loses the "special" attribute. I don't know currently how to make the it a sticky without losing the capability of switching to level 3.

The behavior is: you press Shift then a = A. Pressing again a = a. This means that pressing shift will not lock it. For locking-type of sticky keys, read the above two guides.

To make the change permanent, just add the call to loadkeys into your /etc/rc.local.

4. Higher resolution. To do this edit /boot/grub/menu.lst by adding vga=792 to the kernel you use. Something like this:

title           Ubuntu, kernel 2.6.15-25-386 
root (hd0,0)
kernel /vmlinuz-2.6.15-25-386 root=/dev/hda3 ro quiet splash vga=792
initrd /initrd.img-2.6.15-25-386
savedefault
boot

Tips and tricks:

1. VNC for the console. If you like VNC, you can also share your console :). Install the linuxvnc package (use apt-get).

Yet, it's recommended that you use the screen package, which is better. VNC is generally meant for graphical stuff. :)

2. To capture the screen of your terminal, as a text file, use:

sudo setterm -dump

What I want to do next is enable beep for sticky keys, same as in X. Also, I'd add the "locking-type" of sticky keys, exactly as in X: press Shift twice to lock it.