Results 1 to 9 of 9

Thread: Need help creating desktop launcher for LibreOffice bug workaround

  1. #1
    Join Date
    Apr 2014
    Beans
    88

    Need help creating desktop launcher for LibreOffice bug workaround

    Hi,

    In Lubuntu 20.04 there is a known bug in Libreoffice whereby it produces blank PDFs (instead of what you want it to output to PDF).
    There is a work-around. By running LibreOffice Writer from the command line the following way:
    SAL_VCL_QT5_USE_CAIRO=true libreoffice --writer
    But I'd rather not have to run it from the command line every time I want to use LibreOffice Writer, so I'm trying to figure out how to put this command into a desktop launcher. I just learned how to do desktop launders to start executables and made a few successfully.
    However, I am doing something wrong with the syntax in this particular desktop launcher:

    [Desktop Entry]
    Name=Writer (PDF fix)
    Comment=Launcher to start LibreOffice Writer without blank PDF bug
    Exec=SAL_VCL_QT5_USE_CAIRO=true libreoffice --writer
    Icon=Writer_fixed
    Terminal=false
    Type=Application
    Categories=Office;
    Because I get the error message "Invalid desktop entry file: '/home/brent/.local/share/applications/Libreoffice_Writer_fixed_PDF.desktop'

    Can anyone see what I'm doing wrong and explain how to implement what I wish to do properly?

    Thanks.
    Last edited by Brent_Santin; April 4th, 2021 at 01:49 AM.

  2. #2
    Join Date
    Jan 2017
    Beans
    235

    Re: Need help creating desktop launcher for LibreOffice bug workaround

    I have no idea whether this will work or not but try something like the following:
    Code:
    Exec=libreoffice -env:SAL_VCL_QT5_USE_CAIRO=true --writer
    From here: https://help.libreoffice.org/7.0/en-...61204014126760

  3. #3
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    8,430
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: Need help creating desktop launcher for LibreOffice bug workaround

    In general, you'd use env. So something like
    Code:
    Exec=env SAL_VCL_QT5_USE_CAIRO=true "libreoffice --writer"
    in this case. I don't know that you'd need the "" but it shouldn't hurt.

  4. #4
    Join Date
    Dec 2014
    Beans
    2,591

    Re: Need help creating desktop launcher for LibreOffice bug workaround

    Quote Originally Posted by CatKiller View Post
    In general, you'd use env. So something like
    Code:
    Exec=env SAL_VCL_QT5_USE_CAIRO=true "libreoffice --writer"
    in this case. I don't know that you'd need the "" but it shouldn't hurt.
    Well, actually they do hurt. The quotes break the word splitting and env will try to execute a program named 'libreoffice --writer' with the space as part of the name of the executable file's name. Since there is no such file ...

    Holger

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Need help creating desktop launcher for LibreOffice bug workaround

    libreoffice is just a softlink to the old staroffice startup script.
    Code:
    $ file /usr/bin/libreoffice /usr/bin/soffice
    /usr/bin/libreoffice: symbolic link to ../lib/libreoffice/program/soffice
    /usr/bin/soffice:     symbolic link to ../lib/libreoffice/program/soffice

    # file /usr/lib/libreoffice/program/soffice
    /usr/lib/libreoffice/program/soffice: POSIX shell script, ASCII text executable[/CODE]

    So ... if it was me, I'd copy /usr/lib/libreoffice/program/soffice to /usr/lib/libreoffice/program/soffice.local, changing the name slightly to avoid problems, and add the desired environment variable there. Leaving it in the same directory is required because the script figures out which directory it is in and assumes other things are there as well. Initially, I tried copying the script to my ~/bin/ and modifying it there. That failed because /usr/lib/libreoffice/program/oosplash wasn't available. Anyways, basically, add
    Code:
    SAL_VCL_QT5_USE_CAIRO=true
    export SAL_VCL_QT5_USE_CAIRO
    near the top of /usr/lib/libreoffice/program/soffice.local .

    Next, make a symlink from ../lib/libreoffice/program/soffice.local to /usr/bin/ (this is needed because the script
    and finally
    call it with whatever options the other .desktop file for Writer does.

    To run it:
    Code:
    $ soffice.local --writer
    I haven't tested it for PDFs, but soffice.local --writer is working and it created a TEST.pdf file correctly.
    Would be interesting to know if it works for others. The version here is :
    Code:
    ii  libreoffice-writer                    1:6.4.6-0ubuntu0.20.04.1
    The env= .... --writer would be easier, by far, provided that it works. If that isn't working, I'd try to have it run inside a shell first.

  6. #6
    Join Date
    Apr 2014
    Beans
    88

    Re: Need help creating desktop launcher for LibreOffice bug workaround

    Quote Originally Posted by norobro View Post
    I have no idea whether this will work or not but try something like the following:
    Code:
    Exec=libreoffice -env:SAL_VCL_QT5_USE_CAIRO=true --writer
    From here: https://help.libreoffice.org/7.0/en-...61204014126760
    That does still lauch Libreoffice Writer, but does not fix the blank PDF issue. So I assume it does not properly pass the arguement SAL_VCL-QT5_USE_CAIRO=true onto libreoffice.

  7. #7
    Join Date
    Apr 2014
    Beans
    88

    Re: Need help creating desktop launcher for LibreOffice bug workaround

    Quote Originally Posted by CatKiller View Post
    In general, you'd use env. So something like
    Code:
    Exec=env SAL_VCL_QT5_USE_CAIRO=true "libreoffice --writer"
    in this case. I don't know that you'd need the "" but it shouldn't hurt.
    With the quotation marks present "something" happens (no error message) but Writer never starts.
    Without the quotes, Libreoffice starts and prints PDFs properly, so ***THANK YOU VERY MUCH***!

    Just for future reference, this is the desktop launcher that works:

    Code:
    [Desktop Entry]
    Name=Writer (PDF fix)
    Comment=Launcher to start LibreOffice Writer without blank PDF bug
    Exec=env SAL_VCL_QT5_USE_CAIRO=true libreoffice --writer
    Icon=Writer_fixed
    Terminal=false
    Type=Application
    Categories=Office;
    Last edited by Brent_Santin; April 4th, 2021 at 04:55 PM.

  8. #8
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    8,430
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: Need help creating desktop launcher for LibreOffice bug workaround

    Quote Originally Posted by Holger_Gehrke View Post
    Well, actually they do hurt. The quotes break the word splitting and env will try to execute a program named 'libreoffice --writer' with the space as part of the name of the executable file's name. Since there is no such file ...

    Holger
    OK, good to know. My thinking was that the --writer part needed to stay with the libreoffice part rather than with the env part.

  9. #9
    Join Date
    May 2010
    Beans
    3,247

    Re: Need help creating desktop launcher for LibreOffice bug workaround

    Could make a script then have the launcher run the script

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •