Change the icon size in Unity 2D Launcher


I have intalled ubuntu 11.04 for several days, the new unity looking is amazing, that’s why I try to upgrade all my ubuntu systems to version 11.04, including a several years old one.  The fancy effect can not be displayed because it does not support the unity 3D. Luckily, I got the unity 2D. It works good, but not configurable. The thing I want to change most is the icon size, 48 px for me is too biiiig.

A little google work gives me this link: http://www.ubunturoot.com/2011/02/remove-and-rearrange-items-in-unity-2d.html

Maybe it works for the other machines, but failed in my case.

I try to read these qml files for a while and figured out the way to change the size of the icon in unity 2d. It’s not perfect, (cause it only changes the size of the icon and the around decoration, the width of the launcher can not be changed 😦 ) but for me it is acceptable.

1. The first thing you need to do is backup these three files in /usr/share/unity-2d/launcher

Launcher.qml      LauncherItem.qml      LauncherList.qml

2. Modify the LauncherList.qml file

sudo gedit /usr/share/unity-2d/launcher/LauncherList.qml

modify the two properties in the file like this:

property int itemPadding: 1
property int tileSize: 38

3. Open the file LauncherItem.qml

sudo gedit /usr/share/unity-2d/launcher/LauncherItem.qml

look for the code and change the icon size from 48 to 32

Image {
id: icon
anchors.centerIn: parent
smooth: true

sourceSize.width: 48           <—-change 48 to 32
sourceSize.height: 48          <—-change 48 to 32

4. Edit Launcher.qml:

sudo gedit /usr/share/unity-2d/launcher/Launcher.qml

Find out the code like this:

LauncherList {
id: main
anchors.top: parent.top
anchors.bottom: shelf.top
width: parent.width            <—-modify parent.width to 42

autoScrollSize: tileSize / 2
autoScrollVelocity: 200
reorderable: true

model: ListAggregatorModel {
id: items
}

focus: true
KeyNavigation.down: shelf
}

LauncherList {
id: shelf
anchors.bottom: parent.bottom;
height: (tileSize + itemPadding) * count
width: parent.width       <—-modify parent.width to 42
itemPadding: 0

model: ListAggregatorModel {
id: shelfItems
}

KeyNavigation.up: main
}

change the parent.width to 42

5. restart unity 2d

killall unity-2d-launcher

Now your launcher should look like:

Advertisements

5 thoughts on “Change the icon size in Unity 2D Launcher

  1. Hi, just ran into your page from mixx. It is not something I would normally read, but I loved your perspective on it. Thank you for making an article worth reading!

  2. FYI: After apllying this hack, the Unity 3D started to show the launcher under the other overlapping windows, so it was invisible and inaccessible. I changed the config files back to the default values and the Unity 3D works well again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s