services: Reorganize services, detect X

Detect X autostart a bit better with a separate service. The service
relies on a shell script which searches for a socket which X creates on
startup and only finishes when it finds the socket succesfully.

This makes services which need X to start successfully a bit more
robust, and while it can still break if X takes too long, it should be
more stable now.

Finally, services can restart more quickly when ended since they don't
require the 2+ `RestartSec` option to be present anymore to successfully
start.
This commit is contained in:
Marty Oehme 2020-09-24 16:24:42 +02:00
parent 3fa7f8a6db
commit 7bee413323
Signed by: Marty
GPG key ID: B7538B8F50A1C800
24 changed files with 145 additions and 11 deletions

View file

@ -1,13 +1,13 @@
[Unit]
Description=Todo.md floating vim instance
After=display-manager.service
Requires=x-started-confirm.service
After=x-started-confirm.service
[Service]
Type=simple
# workaround to allow relative executable invocation (i.e. current users' home dir)
ExecStart=/bin/bash -c 'alacritty --title "dropdown-todo" --class "Alacritty,scratchpad" -e nvim -c ":set nonumber norelativenumber noshowmode noruler laststatus=0 noshowcmd shortmess=F | :Limelight" %h/documents/records/todo.md'
Restart=always
RestartSec=2
[Install]
WantedBy=default.target