Author |
Message |
stu90

Joined: 25 Feb 2010 Posts: 1399 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Mon 20 Jun 2011, 12:33 Post subject:
Countdown to Action - GUI timer |
|
[Admin note: the posts in this thread were moved from this thread.]
Hi L18L,
Sorry for not replying sooner
I got side tracked with another little yad project 'Countdown to Action' (circumstance permitting your input would be greatly appreciated)
No biggie with the font selection - your original fc-list update has been working ok for me. - i think urxvtset has turned out pretty sweet considering it was only a few input boxes to start with.
thanks for help.
Description |
|

Download |
Filename |
countdown.gz |
Filesize |
770 Bytes |
Downloaded |
429 Time(s) |
Last edited by stu90 on Mon 20 Jun 2011, 12:37; edited 1 time in total
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Mon 20 Jun 2011, 14:21 Post subject:
Countdown to Action Subject description: input |
|
Hi stu90 you wrote: | I got side tracked with another little yad project 'Countdown to Action' (circumstance permitting your input would be greatly appreciated) |
I have installed 'Countdown to Action' and at first run I had some problems. Code: | # ./cou*
Countdown: 0,000000 minutes
Execute: urxvt
rxvt: unable to calculate font width for 'Dingbats:style=Regular:pixelsize=16:minspace=True', ignoring.
rxvt: unable to load base fontset, please specify a valid one using -fn, aborting.
# |
Having changed the font to Fixed Bold it was OK.
So I am thinking there is a bug with Dingbats.
Or why is it rxvt instead of urxvt???
What input are you expecting?
-Date?
-Drag and drop for Execute?
-Editable Combobox ?
-Passing the task to cronjob?
Everything seems to be possible.
Cheers
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Mon 20 Jun 2011, 15:40 Post subject:
Countdown to Action |
|
v 0.2
Code: | #!/bin/bash
TITLE="Countdown To Action"
VERSION="0.2"
ICON="/usr/share/pixmaps/yad.png"
TEXT="<b>Enter Time \nto countdown\nbefore Action. </b> "
TIME=`date +%H:%M`
DATE=`date +%Y-%m-%d`
### GUI countdown - action ###
COUNTDOWN=$(yad --title="$TITLE $VERSION" --text="$TEXT" --image=/usr/share/pixmaps/away.png \
--form --separator=" " \
--field="Minutes":NUM "0!0..59" \
--field="Hours":NUM "0!0..23" \
--field="Action" "urxvt" )
echo $COUNTDOWN
if [ "$COUNTDOWN" = "" ];then
echo "Exiting" && exit
else
## get minutes ##
MINS=`echo $COUNTDOWN | cut -d" " -f1 | cut -d "." -f1 | cut -d "," -f1`
echo "Countdown: $MINS minutes"
## get hours ##
HOURS=`echo $COUNTDOWN | cut -d" " -f2 | cut -d "." -f1 | cut -d "," -f1`
echo "Countdown: $HOURS hours"
## get new action ##
# SETACTION=`echo $COUNTDOWN | cut -d" " -f2-`
SETACTION=`echo $COUNTDOWN | cut -d" " -f 3`
[[ ! "$SETACTION" ]] && yad --title="$TITLE Info" --text=" Make sure to add an Action to perform " && echo "Exiting" && exit
echo "Execute: $SETACTION "
TIMER=`echo $(($MINS*60))`
ASTART=`date | cut -d" " -f-4`
exec 3> >(yad --notification --image="$ICON" --listen)
echo tooltip: "Countdown action will be performed in $MINS minutes time from <b>$ASTART</b> " >&3
sleep $TIMER
exec 3>&-
### 10 seconds to cancel action ###
(
echo "99" ; sleep 1
echo "90" ; sleep 1
echo "80" ; sleep 1
echo "70" ; sleep 1
echo "60" ; sleep 1
echo "50" ; sleep 1
echo "40" ; sleep 1
echo "30" ; sleep 1
echo "20" ; sleep 1
echo "10" ; sleep 1 ) |
# yad --progress --title="$TITLE $VERSION" --text=" Your action will executed in 10 seconds.\n <b>To abort click cancel!</b> " \
# --percentage=0 --auto-close --auto-kill
yad --progress --title="$TITLE $VERSION" --text=" Your action will executed in 10 seconds.\n To abort click cancel! " \
--percentage=0 --auto-close --auto-kill
if [ "$?" = -1 ] ; then
yad --error --text=" Aborted by user! "
fi
### action to execute ###
echo $SETACTION startet.
time eval $SETACTION
fi
exit
|
 |
Description |
- |
Filesize |
9.29 KB |
Viewed |
1878 Time(s) |

|
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1399 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Tue 21 Jun 2011, 07:26 Post subject:
Re: Countdown to Action |
|
Hi L18L,
Great update on Countdown to Action - perhaps we should start a new thread for this application?
My own need for it is to turn off my laptop when downloading torrents so as not to use up all my internet allowance.
I already though of another idea though as a PC/internet timer for parents - probably won't fool any of the older more savy kids who could kill its process but should work ok for younger kids with timedown progress window set to no buttons and borderless to stop them from canceling it.
thanks.
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Tue 21 Jun 2011, 08:42 Post subject:
Re: Countdown to Action |
|
Hi stu90, you wrote: | My own need for it is to turn off my laptop when downloading torrents so as not to use up all my internet allowance.
I already though of another idea though as a PC/internet timer for parents - probably won't fool any of the older more savy kids who could kill its process but should work ok for younger kids with timedown progress window set to no buttons and borderless to stop them from canceling it.  |
why not just
Code: | wget http://....... && shutdown |
timer,
there is /usr/local/pschedule
parents,
kid should use wary112 (unprivileged user fido)
Sorry, I do not see a reason to reinvent these wheels at the moment.
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1399 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Tue 21 Jun 2011, 09:16 Post subject:
Re: Countdown to Action |
|
L18L wrote: | Hi stu90, you wrote: | My own need for it is to turn off my laptop when downloading torrents so as not to use up all my internet allowance.
I already though of another idea though as a PC/internet timer for parents - probably won't fool any of the older more savy kids who could kill its process but should work ok for younger kids with timedown progress window set to no buttons and borderless to stop them from canceling it.  |
why not just
Code: | wget http://....... && shutdown |
timer,
there is /usr/local/pschedule
parents,
kid should use wary112 (unprivileged user fido)
Sorry, I do not see a reason to reinvent these wheels at the moment.  |
You can use wget to download torrent files - i was unaware of this
Yes running as fido would be best to stop any mishaps but Lucid puppy and most all the earlier puppies do not have this option
Sure most things have been done before - but i don't see it as reinventing the wheel - merely more choice, with the added bonus of of having some fun and hopefully learning something along the way
cheers.
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Tue 21 Jun 2011, 10:24 Post subject:
Re: Countdown to Action |
|
stu90 wrote: | added bonus of of having some fun and hopefully learning something along the way . |
Bingo
If you start a new thread I will join
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Thu 23 Jun 2011, 16:45 Post subject:
Countdown to Action |
|
Dear L18L,
Countdown to Action is a great little utility. I would only make one slight change to line 32. As written, the input field does not accept arguments. In order for parameters to be passed, line 32 should look like this:
Code: | SETACTION=`echo $COUNTDOWN | cut -d" " -f 3-` |
I just added a "-" after 'cut -d" " -f ', which means cut takes all fields starting with f3. Thanks for the utility.
With kind regards,
vovchik
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Thu 23 Jun 2011, 17:06 Post subject:
Re: Countdown to Action |
|
vovchik wrote: | ...
I just added a "-" after 'cut -d" " -f ', which means cut takes all fields starting with f3. Thanks for the utility.
... |
Learning from each other is fun.
Thank you very much for the - (Minus)
The credits go to stu90.
I have just added the field HOUR and ranges for the numeric fields.
|
Back to top
|
|
 |
stu90

Joined: 25 Feb 2010 Posts: 1399 Location: England. Dell Inspiron 1501. Dpup
|
Posted: Thu 23 Jun 2011, 22:42 Post subject:
|
|
This is a little Yad application to perform a simple countdown for x minutes or hours then perform a user defined action or string of actions, such as shutdown puppy (wmpoweroff) or play a media file etc.
When you set a countdown action there will be an icon in the system tray as a reminder - 10 second before the countdown action is performed a little gui window will open alerting you an action is to be performed in 10 seconds and giving the option to cancel the action if you wish.
urxvt in the action field is not needed to run an action, it is just there as an example.
Dependencies:
Countdown to Action requires Yad-0.12.2 to be installed - download is available on this link:
http://www.murga-linux.com/puppy/viewtopic.php?p=536533#536533
Tested on Lucid Puppy.
Thanks.
Description |
|

Download |
Filename |
countdown-0.3.pet |
Filesize |
5.28 KB |
Downloaded |
409 Time(s) |
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Fri 24 Jun 2011, 07:06 Post subject:
c2a |
|
Sorry Stu,
I guess my thanks should have been addressed mainly to you In any case, the utility is useful, and collaboration is always nice to see. To make this app even more complete, you might consider adding a launch at hh:mm and a file select button for the action that would update the input box.
With kind regards,
vovchik
PS. I use this icon for the GUI. It's a bit big, but I like it.
Description |
|
Filesize |
61.46 KB |
Viewed |
1852 Time(s) |

|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Fri 24 Jun 2011, 16:43 Post subject:
Countdown Subject description: working in wary |
|
An additional combobox for choosing from /usr/share/applications.
The checkbox decides where to take the action from.
The input field which I have renamed to "Command" has to be at last position because it can contain more than 1 string.
Writing this down I have got the idea taking another separator than blank that this condition would exist no more.
Code: | #!/bin/bash
## Stu90 ## L18L ##
## Countdown to Action ##
## editable command or combobox v3a
TITLE="Countdown To Action"
VERSION="0.3a"
ICON="/usr/share/pixmaps/c2a.png"
TEXT="<b>Enter Time to countdown \nbefore\nAction or Command. </b> "
TIME=`date +%H:%M.%P`
DATE=`date +%d-%m-%Y`
### GUI countdown - action ###
COUNTDOWN=$( yad --title="$TITLE $VERSION" --text="$TEXT" --form --separator=" " --image="$ICON" \
--field="Minutes":NUM "0!0..59" \
--field="Hours":NUM "0!0..23" \
--field="Action":CB "`ls /usr/share/applications | tr '\n' '!' | sed s/.desktop//g `" \
--field="Ignore Command":CHK TRUE \
--field="Command" "urxvt" \
)
echo $COUNTDOWN
if [ "$COUNTDOWN" = "" ];then
echo "Exiting" && exit
else
## get minutes ##
MINS=`echo $COUNTDOWN | cut -d" " -f1 | cut -d "." -f1 | cut -d "," -f1`
echo "Countdown: $MINS minutes"
## countdown minutes ##
TIMERM=`echo $(($MINS))`'m'
## get hours ##
HOURS=`echo $COUNTDOWN | cut -d" " -f2 | cut -d "." -f1 | cut -d "," -f1`
echo "Countdown: $HOURS hours"
## coundown hours ##
TIMERH=`echo $(($HOURS))`'h'
## get new action ##
IGNORE_COMMAND=`echo $COUNTDOWN | cut -d" " -f4`
if [ "$IGNORE_COMMAND" = "TRUE" ] ; then
SETACTION=`echo $COUNTDOWN | cut -d" " -f 3`
SETACTION=`cat /usr/share/applications/${SETACTION}.desktop | grep Exec= | cut -d "=" -f 2 `
else
# must be the last input because number of parameters is unknown
SETACTION=`echo $COUNTDOWN | cut -d" " -f 5-`
[[ ! "$SETACTION" ]] && yad --title="$TITLE Info" --text=" Make sure to add an Action to perform " && echo "Exiting" && exit
fi
echo "Execute: $SETACTION "
## tray notification ##
exec 3> >(yad --notification --image="$ICON" --listen)
echo tooltip: "Countdown action will be performed \n in <b>$HOURS</b> hours and <b>$MINS</b> minutes time from \n <b>$TIME $DATE</b> " >&3
## sleep for x hours + x minutes ##
sleep $TIMERH | sleep $TIMERM
exec 3>&-
### 10 seconds / cancel notification ###
(
echo "99" ; sleep 1
echo "90" ; sleep 1
echo "80" ; sleep 1
echo "70" ; sleep 1
echo "60" ; sleep 1
echo "50" ; sleep 1
echo "40" ; sleep 1
echo "30" ; sleep 1
echo "20" ; sleep 1
echo "10" ; sleep 1 ) |
yad --progress --title="$TITLE $VERSION" --text=" Your action will be executed in 10 seconds. " \
--percentage=0 --auto-close --auto-kill
if [ "$?" = -1 ] ; then
yad --error --text=" Aborted by user! "
fi
### action to execute ###
echo $SETACTION startet.
time eval $SETACTION
fi
exit |
 |
Description |
|
Filesize |
9.03 KB |
Viewed |
1928 Time(s) |

|
|
Back to top
|
|
 |
RSH

Joined: 05 Sep 2011 Posts: 2420 Location: Germany
|
Posted: Fri 04 Nov 2011, 00:30 Post subject:
|
|
Hello,
i have downloaded and installed the pet, but it won't run.
Error Message: Code: | sh-3.00# /root/my-applications/bin/countdown
/root/my-applications/bin/countdown: line 17: yad: command not found
Exiting
sh-3.00#
|
What does it mean and what can i do, to get this tool running? I'm using Puppy Studio 3.3 and Lucid 525 (528).
RSH
Edit:
Sorry, but i must have been blind. Found the yadxxx.pet, downloaded it, and now it works.
|
Back to top
|
|
 |
DPUP5520
Joined: 16 Feb 2011 Posts: 813
|
Posted: Fri 04 Nov 2011, 00:36 Post subject:
|
|
_________________ PupRescue 2.5
Puppy Crypt 528
|
Back to top
|
|
 |
DPUP5520
Joined: 16 Feb 2011 Posts: 813
|
Posted: Fri 04 Nov 2011, 00:38 Post subject:
|
|
wtf thats weird, anyway you need yad which can be found here
http://www.murga-linux.com/puppy/viewtopic.php?p=438811
_________________ PupRescue 2.5
Puppy Crypt 528
|
Back to top
|
|
 |
|