How can I make an open LibreOffice save a file, without using the GUI?

2

I've gone abroad, leaving LibreOffice Writer open with some file I edited. Unfortunately - I forgot to press Save! Now, I have SSH access to that machine, but - how can I make LibreOffice save the file without me using the GUI? Can I signal it somehow?

I'm using Debian GNU/Linux Stretch.

einpoklum

Posted 2016-07-19T07:44:39.917

Reputation: 5 032

have a look at this question: http://unix.stackexchange.com/questions/55310/how-to-attach-to-remote-machines-local-display-session-over-ssh - You might be able to get a remote graphical view of the existing desktop session using vnc and x server

– GregHNZ – 2016-07-19T08:39:25.713

Answers

4

I did not test your setup, but this worked for me from a terminal:

xdotool search --name Untitled key ctrl+s
xdotool search --name Untitled key ctrl+q

"Untitled 1" was the name of the document in my test. Ctrl+s saves, and Ctrl+q quits.

See https://unix.stackexchange.com/questions/87831/how-to-send-keystrokes-f5-from-terminal-to-a-process.

Alternatively, if you force kill the process, next time it should open in recover mode. Probably it will be able to recover most or all of the changes.

Jim K

Posted 2016-07-19T07:44:39.917

Reputation: 2 601

Does this rely on the application and document being what is in focus on that machine? – fixer1234 – 2016-07-19T17:02:46.800

No, LibreOffice was never in the foreground during my test. A different window was active instead. – Jim K – 2016-07-19T18:16:43.913