Skip to content

Instantly share code, notes, and snippets.

@grst
Last active June 23, 2020 14:58
Show Gist options
  • Save grst/34a6d7e60ec179406245565923565a0b to your computer and use it in GitHub Desktop.
Save grst/34a6d7e60ec179406245565923565a0b to your computer and use it in GitHub Desktop.
Run multiple instances of zettlr

It is currently not possible to run multiple instances of Zettlr (Zettlr/Zettlr#243).

As a workaround, I managed to run multiple instances of zettlr side-by-side by running them as different users.

For me this seems to work reasonably well, but this can lead to corruption of your settings or your notes -- Use at own risk.

Setup

# create a new user
useradd zettlr1

# create a new group
groupadd zettlr

# add the new user and myself to the zettlr group
usermod -a -G zettlr zettlr1
usermod -a -G zettlr sturm

# Make my notes directory be owned by the group
sudo chown -R sturm:zettlr /home/sturm/zettlr

# Make it group read and writable
chmod -R 664 /home/sturm/zettlr
find /home/sturm/zettlr -type d -print0 | xargs chmod 775

# Ensure new files inherit the group permissions
chmod g+s /home/sturm/zettlr
setfacl -Rdm g::rwx /home/sturm/zettlr

# Re-use config.json and custom.css across users - keep the settings in the shared notes directory
cd /home/sturm/.config/zettlr
mv config.json custom.css /home/sturm/zettlr
rm custom.css config.json
ln -s /home/sturm/zettlr/custom.css
ln -s /home/sturm/zettlr/config.json
cd /home/zettlr1/.config/zettlr
rm config.json custom.css
ln -s /home/sturm/.config/zettlr/custom.css
ln -s /home/sturm/.config/zettlr/config.json

Run the second instance

# enable X11 for non-login user
unset XAUTHORITY; sudo su - zettlr1 -c "unset XAUTHORITY; xargs xauth add < <(xauth list)"
sudo -u zettlr1 zettlr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment