You are not logged in.

#1 2024-10-06 18:36:49

miguel04685
Member
From: Rio de Janeiro, Brasil
Registered: 2024-09-24
Posts: 56

[SOLVED] Issue with an autostart script that should play startup audio

So, I have added the audio I want to play at startup at ~/.config/lxsession/LXDE and this is what I have at autostart (~/.config/lxsession/LXDE/autostart):

#@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@xfce4-panel
@volumeicon
@sleep 5 && amixer -D pulse sset Master 30% && paplay ./startup.mp3 &

Even with the script enabled on autostart, the last part of the script "paplay ./startup.mp3" doesn't play the audio

If needed to know, I am using Pipewire and it's services are enabled

Last edited by miguel04685 (2024-10-06 21:11:48)

Offline

#2 2024-10-06 19:48:38

seth
Member
Registered: 2012-09-03
Posts: 61,581

Re: [SOLVED] Issue with an autostart script that should play startup audio

1. don't "&&", if any step fails, the chain won't continue - just use ";"
2. you're passing a relative path to paplay - whether or nor startup.mp3 exists depend on the $PWD, try (I guess) "$HOME/startup.mp3"
3. idk about paplay but some players don't like not having an active terminal, don't fork the call - also b/c of the context, have you tried eg. mpg123?
4. "paplay $HOME/startup.mp3" generally works a expected?

Offline

#3 2024-10-06 20:29:00

miguel04685
Member
From: Rio de Janeiro, Brasil
Registered: 2024-09-24
Posts: 56

Re: [SOLVED] Issue with an autostart script that should play startup audio

Still doesn't play the audio file.

[miguel@archmiguel ~]$ cat /home/miguel/.config/lxsession/LXDE/autostart
#@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@xfce4-panel
@volumeicon
@sleep 5 ; amixer -D pulse sset Master 40% ; mpg123 $HOME/startup.mp3
[miguel@archmiguel ~]$

Offline

#4 2024-10-06 20:42:24

seth
Member
Registered: 2012-09-03
Posts: 61,581

Re: [SOLVED] Issue with an autostart script that should play startup audio

Since https://wiki.archlinux.org/title/LXDE#Autostart makes a point about not trying to fork the commands, I wonder whether shell syntax is supported here at all - what if you wrap that chain in an executable script and seize that opportunity to add a marker of it's invocation?

~/bin/startmeup.sh

#!/bin/sh
touch /tmp/yeahscriptran
sleep 5 
amixer -D pulse sset Master 40%
mpg123 $HOME/startup.mp3
chmod +x ~/bin/startmeup.sh

/home/miguel/.config/lxsession/LXDE/autostart

#@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@xfce4-panel
@volumeicon
@/home/miguel/bin/startmeup.sh

Offline

#5 2024-10-06 21:11:02

miguel04685
Member
From: Rio de Janeiro, Brasil
Registered: 2024-09-24
Posts: 56

Re: [SOLVED] Issue with an autostart script that should play startup audio

This has just solved my problem. Thank you so much, @seth!

Last edited by miguel04685 (2024-10-06 21:11:19)

Offline

Board footer

Powered by FluxBB