3

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;
Kom-Si
  • 115
  • 1
  • As to marking this question as dupicate I totally disagree as the answer you're referring me to covers several versions of Ubuntu to varied degree. Code samples given there are NOT applicable to 13.04. – Kom-Si Apr 15 '13 at 20:46
  • 1
    @Kom-Si If that is the case you should put a bounty on that question or ask someone else to do it for you. Make sure you explain what you need in the bounty text. Since you already have an answer for this problem though I'll ask a moderator to merge it. – Seth Apr 15 '13 at 20:52
  • @Seth I don't know what 'bounty' is or how should I go about it. If you could do that for me, I'd appreciate your efforts. I don't want this question to be merged with the one proposed by Rinzwind and others - it's already a mess, besides as I'd found out syntax for this particular task had changed in 13.04. One more thing: I'd like to post here the finalized code that works for me, but seem to be unable to answer my ow question anymore. In comments it looks ugly. – Kom-Si Apr 15 '13 at 21:24
  • @Kom-Si Oh sorry for any confusion I caused. For information on what a bounty is see the bounty section of the [FAQ#bounty]. Here on Stack Exchange we like to consolidate information all in the same place, which is why we only allow one question per topic. In order to keep it this way, instead of asking a new question when the old answers don't work we add a bounty explaining why the old answers don't work, including any relevant information. This draws more attention to the question, hopefully providing you an answer in the process. – Seth Apr 15 '13 at 22:36
  • @Seth, it seems to me you 'on Stack Exchange' are making the same old mistake of turning simple things into complicated ones. Linux way, isn't it? From my standpoint 'AskUbuntu' ought to be a simple service where common users (noobs like me) can ask their fellow Ubuntu users ANY questions and luckily get an answer without having to jump through loops administering their questions.

    If mine is a duplicate, it's up to admins to merge it or remove it - I couldn't care less. Personally I was unable to find any useful info in the previous question of which mine seems to be a 'duplicate'.

    – Kom-Si Apr 17 '13 at 08:08

1 Answers1

4

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;
valmynd
  • 156
  • Thank you, user852994, after several attemps managed to create a working .desktop file using your first link. – Kom-Si Apr 15 '13 at 20:39
  • crucial was this part omitted in all other places: Actions=Writer;Calc;Impress;Draw – Kom-Si Apr 15 '13 at 20:41
  • 1
    @Kom-Si - please edit this answer with your findings - otherwise it will look confusing to have two similar answers, one accepted, one not. Thanks. – fossfreedom Apr 15 '13 at 21:50
  • @fossfreedom, I don't see a link to answer my own question anymore. Only 'share, edit, delete, flag'. How can I add an answer? – Kom-Si Apr 16 '13 at 16:07
  • @Kom-Si I edited my answer, so people who find this with google won't get problems, I guess the 'Icon' attributes where missplacex inside the Actions? Honestly, I didn't test it, as I'm using Xfce, so I'm glad I still could help ;) – valmynd Apr 16 '13 at 16:22
  • @Kom-Si - click the edit link - add your extra bits to user852994 excellent answer. Thanks. – fossfreedom Apr 16 '13 at 17:58
  • @user852994, thanks for your help - although code did not work you pointed me in the right direction. I don't quite understand what you mean by 'Icon' attributes since icons aren't needed at all for the actions. Action list (header) was crucial for making the whole thing work as I said in my second comment. – Kom-Si Apr 16 '13 at 20:18