Sunday, January 28, 2018

unity - How do I modify Libre Office launcher's icon right-click menu on Ubuntu 13.04?




Upon right-click Libre Office Unity launcher icon shows only two items: to open Libre Office itself (i.e. its main menu) or to unpin the icon from launcher.



I want Libre Office icon in my Unity bar to present several options on right-click, e.g. 'Open Write', 'Open Calc', etc., similar to Files launcher icon which allows to open various folders upon right-click.



Is it possible to modify Libre Office Unity launcher's right-click menu to list all office applications?



EDIT: thanks to the help provided by @user852994 and especially this link to Ubuntu Documentation I finally managed to piece together launcher code that works for me on 13.04:



[Desktop Entry]

Version=1.0
Terminal=false
Icon=libreoffice-startcenter
Type=Application
Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Other;
Exec=libreoffice %U
MimeType=application/vnd.openofficeorg.extension;
Name=LibreOffice
GenericName=Office
Comment=Edit/Create documents


Actions=Writer;Calc;Impress;Draw

[Desktop Action Writer]
Name=Writer
Exec=libreoffice --writer %U
OnlyShowIn=Unity;

[Desktop Action Calc]
Name=Calc

Exec=libreoffice --calc %U
OnlyShowIn=Unity;

[Desktop Action Impress]
Name=Impress
Exec=libreoffice --impress %U
OnlyShowIn=Unity;

[Desktop Action Draw]
Name=Draw

Exec=libreoffice --draw %U
OnlyShowIn=Unity;


As described in here, you can edit the Desktop-File, that should be located here: /usr/share/applications/libreoffice-startcenter.desktop (as of Ubuntu 12.04 it is, look in that folder for a LibreOffice Shortcut otherwise). Copy that file to ~/.local/share/applications/ and modify the copy as described in the article mentioned before adding some [Desktop Action %younameit] sections, so in the end it might look like this:



#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public

# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file

# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
[Desktop Entry]
Version=1.0
Terminal=false
Icon=libreoffice-startcenter
Type=Application
Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Other;
Exec=libreoffice %U

MimeType=application/vnd.openofficeorg.extension;
Name=LibreOffice
GenericName=Office
GenericName[ne]=वर्ड प्रोसेसर (...)

Actions=Writer;Calc;

[Desktop Action Writer]
Exec=libreoffice --writer %U
Name=LibreOffice Writer

OnlyShowIn=Unity;

[Desktop Action Calc]
Exec=libreoffice --calc %U
Name=LibreOffice Writer
OnlyShowIn=Unity;

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...