Multiple instances of LibreOffice in multiple monitor (multiple X session) machine


After a strange crash that I still can’t explain, I updated my video driver (nvidia) and could no longer function with Xinerama.  Running 3 monitors with separate X screens is okay for my use for now –  it is limited in that you can’t drag windows from one screen to another,  but it also lets you swap workspaces in each screen individually.

I can handle not being able to drag windows between screens, but some applications really benefit from having different windows open – and they fall apart when you attempt to open separate windows in different screens.   Firefox,  and LibreOffice being top of my list.

Firefox works with separate profiles.  Start the program with a -P once, define a new profile,  and then you can have it prompt on startup each time.  I may set up something like my LibreOffice fix later.

$ firefox -P

Some reading on LibreOffice revealed that feeding it a -env option will allow you to set a non-default user profile path.     My distribution had LibreOffice 3.3 in the repository, and with -env:UserInstallation specified, it just popped up the splash screen then died.  So I installed 4.4.

After some reading, I found something that works:

$ libreoffice4.4 --display $DISPLAY -env:UserInstallation=file://`echo ~`/LibreOffice/$DISPLAY

the –display option probably isn’t necessary,  but including the $DISPLAY variable in the -env  path means that I can have one script executing and it will always give me a window on THAT X screen.

Next step was to make it work in my desktop environment.  (running XFCE4).   Identified the .desktop files in /usr/local/share/applications/  and modified the Exec= line.  This didn’t accept the $DISPLAY environment variable, but I found a way to do it.

Thank you:  and other forum posts I encountered.

$ vi libreoffice4.4-calc.desktop

Exec=sh -c "libreoffice4.4 -env:UserInstallation\=file://\`echo ~\`/LibreOffice/\$DISPLAY --display \$DISPLAY --calc %U"

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>