6

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
  • 10,666

2 Answers2

7

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
  • 4,439
0

I put together a Python script to close documents matching a substring. I'm no expert on Libreoffice remote control, but it seems to be working. It also works with Wayland, which xdotool does not.

This will save (-s) and close a file which name contains part-of-name:

lo-remote-close.py close -s part-of-name

https://github.com/thomasa88/lo-remote-close

thomasa88
  • 121