How to add icons for toolbar commands without existing icons?

I wish to improve my current icon theme. I’d like to add some new icons for commands without existing icons (eg. 150% zoom) on the Theme so I can share its improved version.

I’m not looking to modify icons on my current installation (eg. Modify > Change Icon).

I’ve tried creating a new icon using the .uno ID of the command. For example, there’s currently an icon for “.uno:Zoom100Percent”. Its file name is sc_zoom100percent.png or lc_zoom100percent.png depending on its size.

I’ve tried doing the same for the “.uno:Zoom150Percent” command, by using the name sc_zoom150percent.png / lc_zoom150percent.png.

However it doesn’t appear on the toolbar.

Anyone knows if it’s possible ?

You are likely to get better response, if you follow “Get in contact” at Welcome to the Design and User Experience team - The Document Foundation Wiki.

Thanks to Heiko Tietze from the Design and User Experience team Matrix chat, I was able to do it.

I added this line to my config.xcu on the icon theme oxt file:

<item oor:path="/org.openoffice.Office.UI.GenericCommands/UserInterface/Commands/org.openoffice.Office.UI.Commands:LabelType['.uno:Zoom150Percent']"><prop oor:name="Properties" oor:op="fuse"><value>1</value></prop></item>

Then I added my sc_zoom150percent.png / lc_zoom150percent.png files to the cmd folder and the new icon now shows up when installing the theme without any extra configuration.

1 Like

Method A

  1. Create your icons as png files. You need at least a 24x24 pixels version and 16x16 pixels version. You might want to design a 32x32 pixels icon as well. Store these icons e.g. in your user profile folder.

  2. Go to Tools > Options > LibreOffice > View and select Small for Icon Size field Toolbar.

  3. Go to Tools > Customize. Select the changed toolbar and go to item 150%. Open the drop-down Modify and select item Change Icon.

  4. In that dialog click on Import and select your created 16x16 pixel icon. Then find your icon in the icon list and select it. It is likely at first or last position. OK.

Repeat steps 2 to 4 for icon size Large with 24x24 pixel icon and for icon size Extra Large and 32x32 pixel icon.

After setting the icons, you can go to Tools > Options > LibreOffice > View and set the icon size back to Automatic.

For Method A the icons must be in png file format.

Method B

  1. Copy the zip-file of your favorite icon-theme, e.g. images_colibre.zip, and save it in the same folder with a new name, e.g. images_colibre_expanded.zip. The new name must not have any blanks or special characters besides the underscore. You find the icon-themes zip-files in <installation-folder>/share/config.

  2. Create your new icons. The file format must be the same as those in the copied icon-theme. Name the icon sc_zoom150percent.png for the Small icon size. For Large icon size use lc_zoom150percent.png and for Extra Large use zoom150percent.png (or .svg respectively). In general, the name must correspond to the uno command, which is .uno:Zoom150percent in your case.

  3. Open the zip-file with e.g. 7-Zip and therein subfolder cmd. With modern packing tools you need not unpack the zip file, opening is sufficient.

  4. Drag the sc_zoom150percent.png and the lc_zoom150percent.png into the cmd folder and the zoom150percent.png into the cmd/32 folder. Of cause, for a svg icon-theme use svg icons.

  5. Close 7-Zip or your packing tool, respectively.

Now we need to tell LibreOffice, that it has to use the icons:

  1. Make a backup of file <installation-folder>/share/registry/main.xcd.

  2. Open the file share/registry/main.xcd in an editor. I use Notepad++ for such edits.

  3. Search for “.uno:zoom150percent”. You should see

    <node oor:name=".uno:Zoom150Percent" oor:op="replace">
    <prop oor:name="Label" oor:type="xs:string">
    <value xml:lang="en-US">150%</value>
    </prop>
    </node>

    Change it to
    <node oor:name=".uno:Zoom150Percent" oor:op="replace">
    <prop oor:name="Label" oor:type="xs:string">
    <value xml:lang="en-US">150%</value>
    </prop>
    <prop oor:name="Properties" oor:type="xs:int">
    <value>1</value>
    </prop>
    </node>
    You can copy&paste the new part from the node “.uno:Zoom100Percent”.

  4. Save the file and close editor.

And finally:
Start LibreOffice, go to Tools > Options > LibreOffice > View and select your icon-theme.

In contrast to method A, method B can handle icons not only in png format but in svg format as well.

3 Likes

Thank you for the extensive response. Unfortunately it’s not what I’m looking for. As I’ve written in my question, “I’m not looking to modify icons on my current installation (eg. Modify > Change Icon)” and both methods are about my current installation.

I’ll go with Mike Kaganski’s suggestion.