From 6a7b64ccbbfea472a781738606fab949fd912ba7 Mon Sep 17 00:00:00 2001 From: Jafner <40403594+Jafner@users.noreply.github.com> Date: Sat, 13 Nov 2021 15:38:49 -0800 Subject: [PATCH] Improve handling of startup order --- pamidi.service | 1 + pamidi.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/pamidi.service b/pamidi.service index 8f662c8..93444f1 100644 --- a/pamidi.service +++ b/pamidi.service @@ -1,5 +1,6 @@ [Unit] Description=Control PulseAudio with a Midi device +After=pulseaudio.service [Service] ExecStart=/usr/bin/pamidi diff --git a/pamidi.sh b/pamidi.sh index a483f91..997ece9 100755 --- a/pamidi.sh +++ b/pamidi.sh @@ -38,6 +38,11 @@ initialize(){ else echo "xdotool found" fi + echo "Waiting for pulseaudio service to start..." + while [ ! $(systemctl --machine=joey@.host --user status pamidi.service) ]; do + echo "Pulseaudio service not started, waiting..." + sleep 2 + done col_1_app_pid=-1 col_2_app_pid=-1 col_3_app_pid=-1 @@ -48,6 +53,7 @@ initialize(){ col_8_app_pid=-1 assign_profile_1 print_col_app_ids + echo "Initialized pamidi" notify-send "Initialized pamidi" }