Changing tab icons in Konsole
Today I was looking for a way to change the color of tabs in the KDE console, Konsole, to make it apparent to which remote host they are connected through SSH. This was possible in 3.5, but no longer in 4.x. However, I discovered something more awesome: it is possible to change the tab icons (small icons next to the title) using an escape sequence.
Icons can be set from a shell script with the following escape sequence:
It looks like this:
The search path for icons in kubuntu is
/usr/share/icons/default.kde4. It appears to be possible to use all the icons below this path, independent of category. It is also possible to specify a full path to the icon. Konsole rescales the icons to 16x16.
This gives us a way to make "favicons for SSH sites". One way to tdo this is to integrate the sequences into the shell prompt by setting the PS1 and PS2 environment variables. Or, maybe more convenient, you can set them on the host side before connecting through SSH. See this gist for an example of a script that sets per-host icons, by wrapping SSH.
With this trick, you'll never type
rm -rf in the wrong console tab again...