Non VNC and VNC $Display confusion

1

I have an Ubuntu 16.06LTS system (let's call it Fred) that I use while sitting in front of it and on that same system I run a VNC server (FredVNC). My problem is that when I've started an application in one environment (i.e. Fred), it ONLY runs in that environment. For example, if I start Libre Office and work on a document at home on Fred, then leave the house and want to open a .doc file in an email I'm checking remotely via a VNC client connection (to FredVNC), that .doc file does not open within VNC, but rather on my local desktop...Fred. I have to return HOME to see it. Or (alternatively) I can kill -9 Libre Office, then open the application in VNC. But then any open docs that were on Fred risk losing data.

What I would LIKE is a way to have two parallel instances of apps open up individually...so that I could be working in Libre Office in VNC, while simultaneously having Libre Office documents open on Fred.

I am assuming (perhaps naively) that there's a command line way to open up an instance of a program that will assign it to the VNC or the Fred Display. I've tried searching for this and unfortunately am in a keyword nightmare. Nothing seems to be selecting the right terms and I get totally off topic results.

If anyone knows what I need to do that would be hugely helpful. Thanks in advance!

confused

Posted 2018-07-17T15:40:42.247

Reputation: 125

Answers

1

It looks like your VNC server creates a virtual desktop instead of providing the existing one (which is, I believe, more common behavior). Plus Libre Office uses a single "main" process per user. When you open an additional file, the new process detects the existing one, relies the job to it and exits. I guess the old process sticks to whichever display was right at the moment it started.

After you kill the old process, a new one can open a file and persist, becoming the "main" Libre Office process from now on. It uses the display it considers right.

I think you could reconfigure the VNC server to provide the existing desktop. On the other hand I guess you had your reasons to use a separate virtual desktop, so you may not want to change this.

What I would LIKE is a way to have two parallel instances of apps open up individually...so that I could be working in Libre Office in VNC, while simultaneously having Libre Office documents open on Fred.

I don't know any way to make Libre Office ignore the old process running for the same user. There's a --display option but I cannot make it work.

See this question: X11 forwarding - grab windows of programs already running. My answer there introduces xpra. If you run (the first) Libre Office with xpra, you will be able to attach to its window(s) from elsewhere.

See what else you can do. In my opinion the main advantage over VNC is the ability to choose the operation mode at the moment you connect. You can start a new desktop, clone an existing one, run a program or attach to a program already running with xpra. Quite flexible, I think.

In the worst case scenario you would get to your existing desktop only to gently close non-"xpra-ed" Libre Office windows without losing data. Then you would run Libre Office anew, this time with xpra, still from the remote client.

Kamil Maciorowski

Posted 2018-07-17T15:40:42.247

Reputation: 38 429

Thank you very much for the thoughts -- yes, exactly, you have understood what's wrong or what I need to do. It might be that xpra will help me prevent this issue, so I will look into it. Not exactly what I want (there's no way to force Libre Office to run 2 instances??) but perhaps enough of a work around. – confused – 2018-07-17T19:30:26.457

@confused There's a --display option (e.g. lowriter --display :1) but I cannot make it work. If it works for you then please write your own answer and I will upvote it. – Kamil Maciorowski – 2018-07-17T20:25:28.293

How can I tell which display my VNC server is using? I think it's the same, actually, based on the results of uname -n, that's the same whether I'm in VNC or not. So maybe if I could simply start VNC running in a different $DISPLAY environment that would at least solve part of it? Then I could try swriter --display :1 or something? – confused – 2018-07-18T00:27:33.753

I've figured out my VNC $DISPLAY is :3.0 and my localhost is :0.0. Can I tell a window to open in one versus the other? – confused – 2018-07-18T14:16:48.520