For the last years I have been runnning Zotero headlessly. It starts as a user service when I log in and provides the same features except for the GUI. Other programs, e.g. browser, word processor, can interact with it without fault.

In the previous setup I was managing Zotero but today I need to use Flatpak. So let’s update this setup and have it work as well.

The major change is that we do not interact with the Zotero process directly but with wrapper processes, i.e. the bubblewrap sandboxing.

# ~/.config/systemd/user/zotero.service
[Unit]
Description=Run zotero in background

[Service]
# flatpak manages the lifecycle of zotero now, got to delegate
ExecStart=flatpak run org.zotero.Zotero --headless
ExecStop=flatpak kill org.zotero.Zotero
Restart=on-failure
RestartSec=30s

[Install]
# actually starts this service when I log in
WantedBy=default.target