From ad291d4b070c2f4b158e144110d802ba9807483d 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_github/pamidi.service | 1 + pamidi_github/pamidi.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/pamidi_github/pamidi.service b/pamidi_github/pamidi.service index 8f662c8a..93444f18 100644 --- a/pamidi_github/pamidi.service +++ b/pamidi_github/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_github/pamidi.sh b/pamidi_github/pamidi.sh index a483f912..997ece9d 100755 --- a/pamidi_github/pamidi.sh +++ b/pamidi_github/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" }