From 28dd41b67a0c0adee99e5571f47704be81fca94e Mon Sep 17 00:00:00 2001 From: osbm Date: Sun, 4 Jan 2026 17:40:29 +0300 Subject: [PATCH] beautifuru --- .../wakeup-music-player.sh | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/nixos/services/wakeup-music-player/wakeup-music-player.sh b/modules/nixos/services/wakeup-music-player/wakeup-music-player.sh index 95eaa00..f111600 100755 --- a/modules/nixos/services/wakeup-music-player/wakeup-music-player.sh +++ b/modules/nixos/services/wakeup-music-player/wakeup-music-player.sh @@ -37,16 +37,19 @@ if [ ! -f "$MUSIC_FILE" ]; then exit 1 fi -echo "Playing wakeup music from $MUSIC_FILE..." - -# Play the music file using mpv -# --no-video: Don't show video window -# --loop=3: Play 3 times in case user is deep asleep -# --volume=80: Set volume to 80% -mpv --no-video --loop=3 --volume=80 "$MUSIC_FILE" - -# Create marker file with today's date so we don't play again today +# Create marker file BEFORE playing music so we don't play again even if interrupted echo "$TODAY" > "$MARKER_FILE" echo "Created marker file: $MARKER_FILE with date: $TODAY" -echo "Wakeup music finished playing" +echo "Playing wakeup music from $MUSIC_FILE..." + +# Play the music file using mpv in the background, detached from this script +# --no-video: Don't show video window +# --loop=3: Play 3 times in case user is deep asleep +# --volume=80: Set volume to 80% +# Run in background and disown so the script can exit immediately +mpv --no-video --loop=3 --volume=80 "$MUSIC_FILE" & +MPV_PID=$! +disown + +echo "Wakeup music started in background (PID: $MPV_PID)"