From 9b662e26095a237357f6294cf96d634bc99dcaa8 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 2 Nov 2021 22:01:31 -0700 Subject: 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. --- flameshot/.config/systemd/user/flameshot.service | 8 ++++++++ herbstluftwm/.config/herbstluftwm/autostart | 2 ++ herbstluftwm/.config/systemd/user/wm.target | 3 +++ kdeconnect/.config/systemd/user/kdeconnect-indicator.service | 8 ++++++++ polybar/.config/herbstluftwm/autostart.d/polybar.sh | 2 -- polybar/.config/systemd/user/polybar.service | 8 ++++++++ syncthing/.config/systemd/user/syncthing-gtk.service | 8 ++++++++ unclutter/.config/systemd/user/unclutter.service | 8 ++++++++ x11/.xsession | 10 ---------- 9 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 flameshot/.config/systemd/user/flameshot.service create mode 100644 herbstluftwm/.config/systemd/user/wm.target create mode 100644 kdeconnect/.config/systemd/user/kdeconnect-indicator.service delete mode 100755 polybar/.config/herbstluftwm/autostart.d/polybar.sh create mode 100644 polybar/.config/systemd/user/polybar.service create mode 100644 syncthing/.config/systemd/user/syncthing-gtk.service create mode 100644 unclutter/.config/systemd/user/unclutter.service diff --git a/flameshot/.config/systemd/user/flameshot.service b/flameshot/.config/systemd/user/flameshot.service new file mode 100644 index 0000000..954718d --- /dev/null +++ b/flameshot/.config/systemd/user/flameshot.service @@ -0,0 +1,8 @@ +[Unit] +Description=Flameshot + +[Service] +ExecStart=flameshot + +[Install] +WantedBy=wm.target diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart index b1b00c3..bf011cd 100755 --- a/herbstluftwm/.config/herbstluftwm/autostart +++ b/herbstluftwm/.config/herbstluftwm/autostart @@ -253,3 +253,5 @@ if [ -d "${HOME}/.config/herbstluftwm/autostart.d" ]; then done unset f fi + +systemctl --user start wm.target diff --git a/herbstluftwm/.config/systemd/user/wm.target b/herbstluftwm/.config/systemd/user/wm.target new file mode 100644 index 0000000..5665e68 --- /dev/null +++ b/herbstluftwm/.config/systemd/user/wm.target @@ -0,0 +1,3 @@ +[Unit] +Description=Window Manager +Wants=dunst.service diff --git a/kdeconnect/.config/systemd/user/kdeconnect-indicator.service b/kdeconnect/.config/systemd/user/kdeconnect-indicator.service new file mode 100644 index 0000000..3166c7f --- /dev/null +++ b/kdeconnect/.config/systemd/user/kdeconnect-indicator.service @@ -0,0 +1,8 @@ +[Unit] +Description=KDE Connect System Tray Icon + +[Service] +ExecStart=kdeconnect-indicator + +[Install] +WantedBy=wm.target diff --git a/polybar/.config/herbstluftwm/autostart.d/polybar.sh b/polybar/.config/herbstluftwm/autostart.d/polybar.sh deleted file mode 100755 index 3dd29ab..0000000 --- a/polybar/.config/herbstluftwm/autostart.d/polybar.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -pgrep polybar || { autohide-polybar.sh && polybar "$(hostname)" 2> /dev/null & } diff --git a/polybar/.config/systemd/user/polybar.service b/polybar/.config/systemd/user/polybar.service new file mode 100644 index 0000000..3e29f3f --- /dev/null +++ b/polybar/.config/systemd/user/polybar.service @@ -0,0 +1,8 @@ +[Unit] +Description=Polybar + +[Service] +ExecStart=polybar %H + +[Install] +WantedBy=wm.target diff --git a/syncthing/.config/systemd/user/syncthing-gtk.service b/syncthing/.config/systemd/user/syncthing-gtk.service new file mode 100644 index 0000000..305c184 --- /dev/null +++ b/syncthing/.config/systemd/user/syncthing-gtk.service @@ -0,0 +1,8 @@ +[Unit] +Description=Syncthing Gui + +[Service] +ExecStart=syncthing-gtk + +[Install] +WantedBy=wm.target diff --git a/unclutter/.config/systemd/user/unclutter.service b/unclutter/.config/systemd/user/unclutter.service new file mode 100644 index 0000000..78e0996 --- /dev/null +++ b/unclutter/.config/systemd/user/unclutter.service @@ -0,0 +1,8 @@ +[Unit] +Description=Unclutter: Hide the mouse while typing + +[Service] +ExecStart=unclutter + +[Install] +WantedBy=wm.target diff --git a/x11/.xsession b/x11/.xsession index 70efe31..58d40b1 100755 --- a/x11/.xsession +++ b/x11/.xsession @@ -8,13 +8,3 @@ xrdb -cpp m4 -merge "${HOME}/.config/X11/Xresources" \ load_machine_config ".config/X11/machines" 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) -- cgit v1.2.3-54-g00ecf