You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For several months I have been running a bash script (under Ubuntu 24.04) that looks like this:
#!/bin/bash
# Define the lock file
LOCKFILE="/tmp/$(basename "$0").lock"
# Use flock to acquire the lock
exec 200>"$LOCKFILE"
if ! flock -n 200; then
# echo "Another instance of $(basename "$0") is already running. Exiting."
exit 1
fi
# Ensure the lock file is removed on exit
trap 'flock -u 200' EXIT
# Function to check if the system has been rebooted within the last 2 minutes
has_recent_reboot() {
local uptime_seconds
uptime_seconds=$(awk '{print $1}' /proc/uptime | cut -d. -f1)
if [ "$uptime_seconds" -le 120 ]; then
return 0 # True: system has been rebooted within the last 2 minutes
else
return 1 # False: system has not been rebooted recently
fi
}
# Sleep for 30 seconds only if the system has been rebooted recently
if has_recent_reboot; then
sleep 30
fi
# Initialize a variable to track the last time the sound was played
last_played=0
# Monitor D-Bus messages
/usr/bin/dbus-monitor --session "interface='org.asamk.Signal'" | while read -r line; do
# echo "$line"
if [[ $line =~ (Body:\ |MessageReceived) ]]; then
current_time=$(date +%s)
# Check if the sound has been played in the last ten seconds
if (( current_time - last_played >= 10 )); then
/usr/bin/aplay /home/user/.sounds/incoming.wav
last_played=$current_time # Update the last played time
fi
fi
done
I don't recall where I got this but the point is that when an incoming message is received it plays a sound I can actually hear rather than the wimpy "bursting bubble" sound the Signal desktop client plays. And it worked fine until a couple of days ago. But now when I run it doesn't seem to do anything, and if I uncomment the '# echo "$line"' and run it then I get:
So it appears to connect and then disconnect almost immediately. Did something change in the last week or so that would cause this?
As an aside I never really liked using this method, for one thing it plays the sound if I send a message, and I only really wanted it to play if I received one, but also I just never really quite understood the script completely, especially the top part which I guess is trying to prevent it from playing the sound if the sound is already playing? But anyway it seems you can't change the sound played in the Signal desktop client, and if there is any mechanism in signal-cli to play a sound when a message is received, I never could find it. I don't hear incoming message notifications if I can't play the louder, longer sound so any help would be appreciated.
The text was updated successfully, but these errors were encountered:
For several months I have been running a bash script (under Ubuntu 24.04) that looks like this:
I don't recall where I got this but the point is that when an incoming message is received it plays a sound I can actually hear rather than the wimpy "bursting bubble" sound the Signal desktop client plays. And it worked fine until a couple of days ago. But now when I run it doesn't seem to do anything, and if I uncomment the '# echo "$line"' and run it then I get:
So it appears to connect and then disconnect almost immediately. Did something change in the last week or so that would cause this?
As an aside I never really liked using this method, for one thing it plays the sound if I send a message, and I only really wanted it to play if I received one, but also I just never really quite understood the script completely, especially the top part which I guess is trying to prevent it from playing the sound if the sound is already playing? But anyway it seems you can't change the sound played in the Signal desktop client, and if there is any mechanism in signal-cli to play a sound when a message is received, I never could find it. I don't hear incoming message notifications if I can't play the louder, longer sound so any help would be appreciated.
The text was updated successfully, but these errors were encountered: