ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It doesn't directly apply to your issue (or does it?), but it may give you a few things to check.
notifyd doesn't support system sounds. There's requests for it, but the devs haven't gotten to them yet apparently. For now I'm looking for a theoretically easy workaround.
notifyd doesn't support system sounds. There's requests for it, but the devs haven't gotten to them yet apparently. For now I'm looking for a theoretically easy workaround.
Okay. I don't really know what else to do. Best of luck on finding solutions though!
[schneidz@hyper ~]$ cat ./egg.ksh
#!/bin/bash
# Filename: progbar-timer.sh
# Version: 110212
# Author: robz
# Improved from the "Egg Timer" script, a countdown timer with progress bar.
# This one has an indication of time remaining provided by Zenity's progress
# bar function. As usual you'll need to find a sound and icon for the variables
# below, you might find the icon variable is correct, check the directory.
ICON=/usr/share/app-install/icons/kalarm.png # Existing icon?
SOUND=/home/schneidz/music/Finding-Forever/01-Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro--Intro.mp3 # Your sound pref.
COUNT=$(zenity --title "Egg Timer" --window-icon $ICON --text "No decimals"\
--entry-text "eg. 10s or 5m or 2h" --entry) # Input dialogue.
if [ $? = 1 ]; then exit $?; fi
# Determine number of seconds to count down from depending on input suffix.
case "${COUNT: -1}" in
"S" | "s" ) COUNT=$(echo $COUNT | sed -s "s/[Ss]//") ;;
"M" | "m" ) COUNT=$(echo $COUNT | sed -s "s/[Mm]//"); ((COUNT*=60)) ;;
"H" | "h" ) COUNT=$(echo $COUNT | sed -s "s/[Hh]//"); ((COUNT*=3600)) ;;
* ) zenity --error --text "<span color=\"red\"><b>\
\nUse the form of 10s or 5m or 2h\nNo decimals allowed either.</b></span>"
sh -c "$0" # On error restart.
exit ;;
esac
START=$COUNT # Set a start point.
until [ "$COUNT" -eq "0" ]; do # Countdown loop.
((COUNT-=1)) # Decrement seconds.
PERCENT=$((100-100*COUNT/START)) # Calc percentage.
echo "#Time remaining$(echo "obase=60;$COUNT" | bc)" # Convert to H:M:S.
echo $PERCENT # Outut for progbar.
sleep 1
done | zenity --title "Egg Timer" --progress --percentage=0 --text=""\
--window-icon=$ICON --auto-close # Progbar/time left.
if [ $? = 1 ]; then exit $?; fi
notify-send -i $ICON "Egg Timer > ## TIMES UP ##" # Attention finish!
/usr/bin/canberra-gtk-play --volume 4 -f $SOUND # Ding-dong finish!
zenity --notification --window-icon="$ICON"\
--text "Egg Timer > ## TIMES UP ##" # Indicate finished!
Looks to be unrelated, as you can see there the canberra sound just follows another line that just happens to be after notify-send'ing a notification. There's no, if you like, "system event checking" going on.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.