Fix flickering Ubuntu-mono-dark keyboard icon in Gnome Shell
I've been using Gnome Shell with Ubuntu's Ubuntu-mono-dark theme for some time. However, since the release of Ubuntu Precise Pangolin, which ships with Gnome 3.4, I've noticed a problem with the keyboard icon, which appears next to the user menu in the upper right corner when you use input methods like iBus. Right after you log on, the keyboard icon starts jumping around, changing size every few milliseconds. This usually stops at some point, but still, it's a major annoyance and enough to put some people off using the theme I imagine. There is a way to fix it, though.
Here is what is happening: the icon file
input-keyboard.svg is located in the subfolder for status icons
status/22 in the Ubuntu-mono-dark theme directory. As the name suggests, all icons in this folder are 22 pixels wide — all but the keyboard icon. I assume Gnome is having trouble scaling the icon while preserving its aspect ratio, which causes the weird flickering behaviour. To get rid of this problem, all you have to do is change the width of the icon file to 22 pixels:
- Confirm the file “input-keyboard.svg” exists in the theme directory (
/usr/share/icons/ubuntu-mono-dark/status/22) and is 23px wide. Create a backup of the file, e.g. by copying it to your home folder:
cp -ivra /usr/share/icons/ubuntu-mono-dark/status/22/input-keyboard.svg ~/.input-keyboard.svg.bak
- Open the file in your favourite vector graphics editor, e.g. Inkscape. Since you need root privileges to edit files outside of your home directory, the “gksu” command is required:
gksu inkscape /usr/share/icons/ubuntu-mono-dark/status/22/input-keyboard.svgSelect File –> Document Properties and enter a width of 22.00, then select the keyboard object and enter a width of a little more than 22 pixels (something like 22.500) in the panel on top, right below the toolbar. Save. Done.
- Press Alt + F2, and enter “
r” (without the quotes) to restart Gnome Shell, or just log out and back on.
Alternatively, download a modified, 22-pixel-wide input-keyboard.svg file here and copy it to the theme folder shown above (needs root privileges). Enjoy!