Add systemd services for some background tasks

Add a ‘wm.target’ file that services can hook into and that Herbstluftwm starts
at the end of its startup script. This way different services can be sure that
the window manager itself has started up, and can be dependent on one another.
Hopefully this makes managing these background processes easier.
This commit is contained in:
Tom Willemse 2021-11-02 22:01:31 -07:00
parent 72d40a0936
commit 9b662e2609
9 changed files with 45 additions and 12 deletions

View file

@ -0,0 +1,8 @@
[Unit]
Description=Flameshot
[Service]
ExecStart=flameshot
[Install]
WantedBy=wm.target

View file

@ -253,3 +253,5 @@ if [ -d "${HOME}/.config/herbstluftwm/autostart.d" ]; then
done done
unset f unset f
fi fi
systemctl --user start wm.target

View file

@ -0,0 +1,3 @@
[Unit]
Description=Window Manager
Wants=dunst.service

View file

@ -0,0 +1,8 @@
[Unit]
Description=KDE Connect System Tray Icon
[Service]
ExecStart=kdeconnect-indicator
[Install]
WantedBy=wm.target

View file

@ -1,2 +0,0 @@
#!/usr/bin/env bash
pgrep polybar || { autohide-polybar.sh && polybar "$(hostname)" 2> /dev/null & }

View file

@ -0,0 +1,8 @@
[Unit]
Description=Polybar
[Service]
ExecStart=polybar %H
[Install]
WantedBy=wm.target

View file

@ -0,0 +1,8 @@
[Unit]
Description=Syncthing Gui
[Service]
ExecStart=syncthing-gtk
[Install]
WantedBy=wm.target

View file

@ -0,0 +1,8 @@
[Unit]
Description=Unclutter: Hide the mouse while typing
[Service]
ExecStart=unclutter
[Install]
WantedBy=wm.target

View file

@ -8,13 +8,3 @@ xrdb -cpp m4 -merge "${HOME}/.config/X11/Xresources" \
load_machine_config ".config/X11/machines" load_machine_config ".config/X11/machines"
load_config_directory ".config/X11/Xsession.d" load_config_directory ".config/X11/Xsession.d"
command -v kdeconnect-indicator \
&& (pgrep kdeconnect-indicator \
|| { kdeconnect-indicator & })
command -v syncthing-gtk \
&& (pgrep syncthing-gtk \
|| { syncthing-gtk & })
command -v unclutter && (pgrep unclutter || unclutter --fork)