Old laptop as Digital Clock [SOLVED][and SOLVED even more]

Using applications, configuring, problems
Message
Author
User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

Old laptop as Digital Clock [SOLVED][and SOLVED even more]

#1 Post by davids45 »

G'day,

I'm looking to use an old lap top as a digital finishing clock at some night orienteering events where the runners coming in need to see if they can beat the clock. That is, the laptop screen displays the hours, minutes and seconds in maximum font.
Windows used to have a screen saver that sort of did this but a screen saver will disappear if the keyboard is hit - I think I want a wall-paper or fixed display.

Probably would like to be able to set the numeral colour and the back-ground as well for best readability.

Any Pets or ideas?

Additionally, sounding a beep at the .00 seconds (ie on the whole minute) would be handy.

Thanks,
David S.
Last edited by davids45 on Sat 01 May 2010, 23:09, edited 2 times in total.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#2 Post by 01micko »

Hi David

Try running this in a terminal

Code: Select all

 yaf-splash -font "-misc-dejavu sans-bold-r-normal--240-0-0-0-p-0-iso10646-1" -bg black -fg white -outline 0  -clock

it can be tweaked of course

Cheers
Puppy Linux Blog - contact me for access

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#3 Post by abushcrafter »

What about pcountdown that should do most of what you want. May be mod it to your needs? Then again maybe its not what you want.

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#4 Post by davids45 »

G'day 01micko,

Yes, that's pretty much exactly what I wanted in terms of a maximal screen-filling display including seconds. I've made a small executable file of your script.

I just need to set up a Puppy on a usb thumb drive which auto-runs the clock and doesn't hide or stop it when a screen-saver kicks in - DPup looks good for this so far on the old lap-top.

Thanks again,
David S.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#5 Post by 01micko »

Would you like a config gui with that? Perhaps sound choice, colour choice?

Code: Select all

#!/bin/sh -a

rm -f /tmp/killclock

SCREEN=`xwininfo -root | grep ' \-geometry ' | tr -s ' ' | cut -f 3 -d ' ' | cut -f 1 -d '+' | tr 'x' ' '`
HEIGHT=`echo -n "$SCREEN" | cut -f 2 -d ' '`
WIDTH=`echo -n "$SCREEN" | cut -f 1 -d ' '`
RATIO=`dc $WIDTH $HEIGHT div 100 mul p | cut -f 1 -d '.'`

if [ $RATIO -gt 140 ]; then MF=3
    else MF=60
fi

SIZE=`expr $HEIGHT / 4`
MARGINGET=`expr $HEIGHT \* 1`
MARGIN=`expr $MARGINGET / $MF`

function YAF (){
yaf-splash -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -margin $MARGIN -bg $BG -fg $FG -outline 0  -clock
}

function BELL (){
	#ZEROTIME=`date +%T|cut -d ':' -f3`
	
	until [ -f  /tmp/killclock ]
	    do 
	    if [ "`date +%T|cut -d ':' -f3`" = "00" ];then aplay $NOISE ;fi
	       sleep 0.5
	    done
}
function KILLSWITCH (){

	kill `ps|grep "clockgui"|awk '{print $1}'`
	export killswitch='
   <window decorated="false">
	<vbox>
     <hbox>
      <button> 
       <label>KILLSWITCH</label>
       <input file>/usr/share/doc/puppylogo96.png</input>
       <action>echo "" > /tmp/killclock &</action>
       <action>exit:Exit</action>
      </button>
     </hbox>
    </vbox>
   </window>'
   gtkdialog3 -p killswitch
   unset killswitch
  
}
clockgui="
<vbox>
 <hbox>
  <text><label>Enter a colour for background</label></text>
   <entry>
    <variable>BG</variable>
   </entry>
  </hbox> 
  <hbox>
  <text><label>Enter a colour for foreground</label></text>
   <entry>
    <variable>FG</variable>
   </entry>
  </hbox> 
  <hbox>
  <text><label>Enter the path to a sound</label></text>
   <entry>
    <variable>NOISE</variable>
   </entry>
  </hbox> 
  <hbox>
  <button> 
   <label>Sound</label>
   <input file stock=\"gtk-directory\"></input>
   <action>exec rox /usr/share/audio &</action>
  </button>
  <button> 
   <label>Colour</label>
   <input file stock=\"gtk-select-color\"></input>
   <action>exec gcolor2 &</action>
  </button>
  <button> 
   <label>Go!</label>
   <input file stock=\"gtk-yes\"></input>
   <action>YAF &</action>
   <action>BELL &</action>
   <action>KILLSWITCH &</action>
  </button>
 </hbox>
</vbox>"
gtkdialog3 -p clockgui
unset clockgui
Oh yeah, clicking anywhere will stop the big yaf-splash as you probably discovered, but the the script won't finish without the killswitch.

EDIT:tweaking the values for a normal screen, I have a widey :oops: , on a standard screen the background will not cover the screen, so you can remove icons, hide the JWM taskbar and use a solid colour wallpaper the same colour as the yaf-splash background
:wink:
Puppy Linux Blog - contact me for access

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#6 Post by davids45 »

G'day 01micko,

Thanks muchly for the extras, including the beeper.

The time itself sits only partly on-screen on my 19inch desktop display (it's off at the bottom right, showing the hour and some of the minutes). I'll try to change the variables to see how it works later (I've got to go to the Zoo this morning ("her indoors" has some free tickets)).

But the beeper works when I see the minute numeral change.

Can the config be saved? I thought I may have just been being fooled by the blank dialog box asking for colour and sound inputs when I re-started the clock, but I just got a blank screen <GO>-ing from the empty boxes.

David S.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#7 Post by 01micko »

don't know if you saw the edit, but there are new variables as of about 20 minutes ago.

Cheers

a bit later, saves config

Code: Select all

#!/bin/sh -a

rm -f /tmp/killclock

if [ -f $HOME/.bigclockrc ];then . $HOME/.bigclockrc
fi

SCREEN=`xwininfo -root | grep ' \-geometry ' | tr -s ' ' | cut -f 3 -d ' ' | cut -f 1 -d '+' | tr 'x' ' '`
HEIGHT=`echo -n "$SCREEN" | cut -f 2 -d ' '`
WIDTH=`echo -n "$SCREEN" | cut -f 1 -d ' '`
RATIO=`dc $WIDTH $HEIGHT div 100 mul p | cut -f 1 -d '.'`

SIZE=`expr $HEIGHT / 4`
if [ $RATIO -gt 140 ]; then 
    MARGINGET=`expr $HEIGHT \* 1`
    MARGIN=`expr $MARGINGET / 3`
  else MARGIN=20
fi



function YAF (){
echo BG="\"$BG\"" >$HOME/.bigclockrc
echo FG="\"$FG\"" >>$HOME/.bigclockrc
echo NOISE="\"$NOISE\"" >>$HOME/.bigclockrc
yaf-splash -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -margin $MARGIN -bg $BG -fg $FG -outline 0  -clock
}

function BELL (){
   #ZEROTIME=`date +%T|cut -d ':' -f3`
   
   until [ -f  /tmp/killclock ]
       do
       if [ "`date +%T|cut -d ':' -f3`" = "00" ];then aplay $NOISE ;fi
          sleep 0.5
       done
}
function KILLSWITCH (){

   kill `ps|grep "clockgui"|awk '{print $1}'`
   export killswitch='
   <window decorated="false">
   <vbox>
     <hbox>
      <button>
       <label>KILLSWITCH</label>
       <input file>/usr/share/doc/puppylogo96.png</input>
       <action>echo "" > /tmp/killclock &</action>
       <action>exit:Exit</action>
      </button>
     </hbox>
    </vbox>
   </window>'
   gtkdialog3 -p killswitch
   unset killswitch
 
}

clockgui="
<vbox>
 <hbox>
  <text><label>Enter a colour for background</label></text>
   <entry>
    <variable>BG</variable>
    <input>echo \"$BG\"</input>
    </entry>
  </hbox>
  <hbox>
  <text><label>Enter a colour for foreground</label></text>
   <entry>
    <variable>FG</variable>
    <input>echo \"$FG\"</input>
    </entry>
  </hbox>
  <hbox>
  <text><label>Enter the path to a sound</label></text>
   <entry>
    <variable>NOISE</variable>
    <input>echo $NOISE</input>
    </entry>
  </hbox>
  <hbox>
  <button>
   <label>Sound</label>
   <input file stock=\"gtk-directory\"></input>
   <action>exec rox /usr/share/audio &</action>
  </button>
  <button>
   <label>Colour</label>
   <input file stock=\"gtk-select-color\"></input>
   <action>exec gcolor2 &</action>
  </button>
  <button>
   <label>Go!</label>
   <input file stock=\"gtk-yes\"></input>
   <action>YAF &</action>
   <action>BELL &</action>
   <action>KILLSWITCH &</action>
  </button>
 </hbox>
</vbox>"
gtkdialog3 -p clockgui
unset clockgui
Ok, I tested this out at 800x600 and 1024x768 and it's good, but of course it can't fill the screen, so we don't even try hence the "fixed" variable for margin. Widescreen is perfect at 1360x768, the script detects widescreen.
Puppy Linux Blog - contact me for access

Laie
Posts: 318
Joined: Sun 20 Jan 2008, 18:42
Location: Germany

#8 Post by Laie »

nice!

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#9 Post by zigbert »

Hi Mick
I hope you don't mind that I stole some nifty code from you. This one goes straight to fullscreen clock when executed. Colors are defined in command 'clock black red'. My thought was; wouldn't this be cool to add as a corner-activated app in DuDE. Drag the mouse-pointer to the tray-clock, and you get a fullscreen clock. 8)

Do you know if it possible to move the numbers slightly (maybe every minute) for screensaver features?

Thank you!!!!
Sigmund

Code: Select all

#!/bin/sh -a

BG=$1; [ ! "$BG" ] && BG=black
FG=$2; [ ! "$FG" ] && FG=gray20

HEIGHT=`xwininfo -root | grep ' \-geometry ' | tr -s ' ' | cut -f 3 -d ' ' | cut -f 1 -d '+' | tr 'x' ' ' | cut -f 2 -d ' '`
WIDTH=`xwininfo -root | grep ' \-geometry ' | tr -s ' ' | cut -f 3 -d ' ' | cut -f 1 -d '+' | tr 'x' ' ' | cut -f 1 -d ' '`
RATIO=`dc $WIDTH $HEIGHT div 100 mul p | cut -f 1 -d '.'`

SIZE=`expr $HEIGHT / 4`
if [ $RATIO -gt 140 ]; then
    MARGINGET=`expr $HEIGHT \* 1`
    MARGIN=`expr $MARGINGET / 3`
  else
	MARGIN=20
fi

yaf-splash -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -margin $MARGIN -bg $BG -fg $FG -outline 0 -clock

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#10 Post by 01micko »

Hi Sigmund

Well you can certainly position yaf-splash anywhere you like on the screen. I suppose a 1 minute loop could be made with set or random values. I guess the trick is to actually keep it on screen, which would be easier done by increasing the SIZE divisor making the clock display a little smaller and giving more placement options for a screensaver.

Oh yeah, the code for detecting widescreen is Barry's,(from the widescreen wallpaper cropper) I just manipulated it to suit the need here.

Run with it mate!

Cheers
Puppy Linux Blog - contact me for access

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#11 Post by zigbert »

Here is a simplified code, using -geometry instead of -margin to center the clock correct.

Code: Select all

#!/bin/sh

BG=$1; [ ! "$BG" ] && BG=black
FG=$2; [ ! "$FG" ] && FG=gray20
HEIGHT=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f2 -d 'x' | cut -f1 -d '+'`
WIDTH=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f1 -d 'x'`
SIZE=$((HEIGHT/44*10))

yaf-splash -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -bg $BG -fg $FG -outline 0 -clock -24 -geometry ${WIDTH}x${HEIGHT}

User avatar
abushcrafter
Posts: 1418
Joined: Fri 30 Oct 2009, 16:57
Location: England
Contact:

#12 Post by abushcrafter »

Combined zigbert's and 01micko's code. So now we have a proper full screen clock which plays a sound ever minute and with the colour options all of which are saved into a configuration file. I also got rid of the kill sound button so when you click on the yaf-splash clock to close it kills the sound with it.

Code: Select all

#!/bin/sh -a

rm -f /tmp/killclock

if [ -f $HOME/.bigclockrc ];then . $HOME/.bigclockrc
fi

HEIGHT=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f2 -d 'x' | cut -f1 -d '+'`
WIDTH=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f1 -d 'x'`
SIZE=$((HEIGHT/44*10))


function YAF (){
echo BG="\"$BG\"" >$HOME/.bigclockrc
echo FG="\"$FG\"" >>$HOME/.bigclockrc
echo NOISE="\"$NOISE\"" >>$HOME/.bigclockrc
yaf-splash -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -geometry ${WIDTH}x${HEIGHT} -bg $BG -fg $FG -outline 0  -clock
echo "" > /tmp/killclock &
}

function BELL (){
   #ZEROTIME=`date +%T|cut -d ':' -f3`
   
   until [ -f  /tmp/killclock ]
       do
       if [ "`date +%T|cut -d ':' -f3`" = "00" ];then aplay $NOISE ;fi
          sleep 0.5
       done

    rm -v -f /tmp/killclock
    echo ""
    echo "Finished. Will Now Exit."
    exit
}
function KILLCLOCKGUI (){

   kill `ps|grep "clockgui"|awk '{print $1}'` 
}

clockgui="
<vbox>
 <hbox>
  <text><label>Enter a colour for background</label></text>
   <entry>
    <variable>BG</variable>
    <input>echo \"$BG\"</input>
    </entry>
  </hbox>
  <hbox>
  <text><label>Enter a colour for foreground</label></text>
   <entry>
    <variable>FG</variable>
    <input>echo \"$FG\"</input>
    </entry>
  </hbox>
  <hbox>
  <text><label>Enter the path to a sound</label></text>
   <entry>
    <variable>NOISE</variable>
    <input>echo $NOISE</input>
    </entry>
  </hbox>
  <hbox>
  <button>
   <label>Sound</label>
   <input file stock=\"gtk-directory\"></input>
   <action>exec rox /usr/share/audio &</action>
  </button>
  <button>
   <label>Colour</label>
   <input file stock=\"gtk-select-color\"></input>
   <action>exec gcolor2 &</action>
  </button>
  <button>
   <label>Go!</label>
   <input file stock=\"gtk-yes\"></input>
   <action>YAF &</action>
   <action>BELL &</action>
   <action>KILLCLOCKGUI &</action>
  </button>
 </hbox>
</vbox>"
gtkdialog3 -p clockgui
unset clockgui
[url=http://www.adobe.com/flashplatform/]adobe flash is rubbish![/url]
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#13 Post by Béèm »

01micko wrote:don't know if you saw the edit, but there are new variables as of about 20 minutes ago.

Cheers

a bit later, saves config

Code: Select all

#!/bin/sh -a

rm -f /tmp/killclock

if [ -f $HOME/.bigclockrc ];then . $HOME/.bigclockrc
fi

SCREEN=`xwininfo -root | grep ' \-geometry ' | tr -s ' ' | cut -f 3 -d ' ' | cut -f 1 -d '+' | tr 'x' ' '`
HEIGHT=`echo -n "$SCREEN" | cut -f 2 -d ' '`
WIDTH=`echo -n "$SCREEN" | cut -f 1 -d ' '`
RATIO=`dc $WIDTH $HEIGHT div 100 mul p | cut -f 1 -d '.'`

SIZE=`expr $HEIGHT / 4`
if [ $RATIO -gt 140 ]; then 
    MARGINGET=`expr $HEIGHT \* 1`
    MARGIN=`expr $MARGINGET / 3`
  else MARGIN=20
fi



function YAF (){
echo BG=""$BG"" >$HOME/.bigclockrc
echo FG=""$FG"" >>$HOME/.bigclockrc
echo NOISE=""$NOISE"" >>$HOME/.bigclockrc
yaf-splash -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -margin $MARGIN -bg $BG -fg $FG -outline 0  -clock
}

function BELL (){
   #ZEROTIME=`date +%T|cut -d ':' -f3`
   
   until [ -f  /tmp/killclock ]
       do
       if [ "`date +%T|cut -d ':' -f3`" = "00" ];then aplay $NOISE ;fi
          sleep 0.5
       done
}
function KILLSWITCH (){

   kill `ps|grep "clockgui"|awk '{print $1}'`
   export killswitch='
   <window decorated="false">
   <vbox>
     <hbox>
      <button>
       <label>KILLSWITCH</label>
       <input file>/usr/share/doc/puppylogo96.png</input>
       <action>echo "" > /tmp/killclock &</action>
       <action>exit:Exit</action>
      </button>
     </hbox>
    </vbox>
   </window>'
   gtkdialog3 -p killswitch
   unset killswitch
 
}

clockgui="
<vbox>
 <hbox>
  <text><label>Enter a colour for background</label></text>
   <entry>
    <variable>BG</variable>
    <input>echo "$BG"</input>
    </entry>
  </hbox>
  <hbox>
  <text><label>Enter a colour for foreground</label></text>
   <entry>
    <variable>FG</variable>
    <input>echo "$FG"</input>
    </entry>
  </hbox>
  <hbox>
  <text><label>Enter the path to a sound</label></text>
   <entry>
    <variable>NOISE</variable>
    <input>echo $NOISE</input>
    </entry>
  </hbox>
  <hbox>
  <button>
   <label>Sound</label>
   <input file stock="gtk-directory"></input>
   <action>exec rox /usr/share/audio &</action>
  </button>
  <button>
   <label>Colour</label>
   <input file stock="gtk-select-color"></input>
   <action>exec gcolor2 &</action>
  </button>
  <button>
   <label>Go!</label>
   <input file stock="gtk-yes"></input>
   <action>YAF &</action>
   <action>BELL &</action>
   <action>KILLSWITCH &</action>
  </button>
 </hbox>
</vbox>"
gtkdialog3 -p clockgui
unset clockgui
Ok, I tested this out at 800x600 and 1024x768 and it's good, but of course it can't fill the screen, so we don't even try hence the "fixed" variable for margin. Widescreen is perfect at 1360x768, the script detects widescreen.
Stumbled on this post and wanted to try.
I get in the terminal

Code: Select all

# ./full-screen-clock

** ERROR **: GtkDialog: Could not find the dialog description in the environment variable 'clockgui'.
aborting...
./full-screen-clock: line 101: 11728 Aborted                 gtkdialog3 -p clockgui
# 

Something I am missing? (lucid 5.1)
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#14 Post by Karl Godt »

I copy and pasted the code to geany, saved it as /root/bin/EXPERICLOCK, chmod 755 /root/bin/EXPERICLOCK, typed `EXPERICLOCK` at console and it opened up fine. Two icons were missing - that`s all. I haven`t tested it deeper, but rox showed up and `gcolor2`. I didn`t give it a 'go'. The code is as usual somehow not understandable but bash seem to interpret the code right. (Macpup F3 4.3.0/1)
Maybe Lucy has got different version of `gtkdialogNR`

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#15 Post by 01micko »

Béèm

Did you be sure to add -a option to the shebang?

Code: Select all

#!/bin/sh -a
Anyway, there's a new one because in late model woof builds Barry has replaced yaf-splash with gtk-dialog splash, however the yaf-splash binary still exists so we call it with it's full path.

See first variable in the updated script. I also changed the yaf-splash options with zigbert's DuDE improvements, now you get it full screen on any screen.

Hey davids45... see what you started :lol:

Copy paste this to text editor, name it something and make executable

Code: Select all

#!/bin/sh -a

YAFSPLASH="/usr/X11R7/bin/yaf-splash"	

rm -f /tmp/killclock

if [ -f $HOME/.bigclockrc ];then . $HOME/.bigclockrc
fi

HEIGHT=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f2 -d 'x' | cut -f1 -d '+'`
WIDTH=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f1 -d 'x'`
SIZE=$((HEIGHT/5))

SIZE=`expr $HEIGHT / 4`
if [ $RATIO -gt 140 ]; then
    MARGINGET=`expr $HEIGHT \* 1`
    MARGIN=`expr $MARGINGET / 3`
  else MARGIN=20
fi



function YAF (){
echo BG="\"$BG\"" >$HOME/.bigclockrc
echo FG="\"$FG\"" >>$HOME/.bigclockrc
echo NOISE="\"$NOISE\"" >>$HOME/.bigclockrc
$YAFSPLASH -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -bg $BG -fg $FG -outline 0  -clock -geometry $((WIDTH+PLACEMENT_X))x$((HEIGHT+PLACEMENT_Y))+0+0 
#$YAFSPLASH -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -margin $MARGIN -bg $BG -fg $FG -outline 0  -clock
}

function BELL (){
   #ZEROTIME=`date +%T|cut -d ':' -f3`
   
   until [ -f  /tmp/killclock ]
       do
       if [ "`date +%T|cut -d ':' -f3`" = "00" ];then aplay $NOISE ;fi
          sleep 0.5
       done
}
function KILLSWITCH (){

   kill `ps|grep "clockgui"|awk '{print $1}'`
   export killswitch='
   <window decorated="false">
   <vbox>
     <hbox>
      <button>
       <label>KILLSWITCH</label>
       <input file>/usr/share/doc/puppylogo96.png</input>
       <action>echo "" > /tmp/killclock &</action>
       <action>exit:Exit</action>
      </button>
     </hbox>
    </vbox>
   </window>'
   gtkdialog3 -p killswitch
   unset killswitch
 
}

clockgui="
<vbox>
 <hbox>
  <text><label>Enter a colour for background</label></text>
   <entry>
    <variable>BG</variable>
    <input>echo \"$BG\"</input>
    </entry>
  </hbox>
  <hbox>
  <text><label>Enter a colour for foreground</label></text>
   <entry>
    <variable>FG</variable>
    <input>echo \"$FG\"</input>
    </entry>
  </hbox>
  <hbox>
  <text><label>Enter the path to a sound</label></text>
   <entry>
    <variable>NOISE</variable>
    <input>echo $NOISE</input>
    </entry>
  </hbox>
  <hbox>
  <button>
   <label>Sound</label>
   <input file stock=\"gtk-directory\"></input>
   <action>exec rox /usr/share/audio &</action>
  </button>
  <button>
   <label>Colour</label>
   <input file stock=\"gtk-select-color\"></input>
   <action>exec gcolor2 &</action>
  </button>
  <button>
   <label>Go!</label>
   <input file stock=\"gtk-yes\"></input>
   <action>YAF &</action>
   <action>BELL &</action>
   <action>KILLSWITCH &</action>
  </button>
 </hbox>
</vbox>"
gtkdialog3 -p clockgui
unset clockgui
Have fun!

Cheers
Puppy Linux Blog - contact me for access

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#16 Post by davids45 »

G'day 01micko,
Hey davids45... see what you started
Well, I did want this for an 'el cheapo' start clock - a fully blown beeping+LED start clock (Norwegian - G'day zigbert) is costing my orienteering club over AU$3000 by the time we get it through our customs.
.
I'm hoping to give the 'el cheapo' a try this Wednesday at some night orienteering in Chatswood (Lowanna Park, 7-8pm). A discount will be offered for any Puppy Linux users, and free use of our First Aid kit :wink: .

And thanks for everyone's interest and input.

David S.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#17 Post by 01micko »

I'm hoping to give the 'el cheapo' a try this Wednesday at some night orienteering in Chatswood (Lowanna Park, 7-8pm). A discount will be offered for any Puppy Linux users, and free use of our First Aid kit
bit far for me mate, but maybe cthisbear or jamesbond can make it. :wink:

Cheers
Puppy Linux Blog - contact me for access

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#18 Post by zigbert »

davids45 wrote:a fully blown beeping+LED start clock (Norwegian - G'day zigbert) is costing my orienteering club over AU$3000 by the time we get it through our customs.
Sounds like a reasonable price......after all it's not more than we have to pay for 1 kg marinated kangaroo meat :D
davids45 wrote:I'm hoping to give the 'el cheapo' a try this Wednesday at some night orienteering in Chatswood (Lowanna Park, 7-8pm). A discount will be offered for any Puppy Linux users, and free use of our First Aid kit :wink: .
I would really like to come.......

I have Germany on my agenda this year. - But Australia.......sounds like a dream to me.


Sigmund

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#19 Post by Béèm »

01micko wrote:Béèm
Did you be sure to add -a option to the shebang?

Have fun!

Cheers
Well I took the script where you told davids45 'there has been an update 20 minutes ago' and there was no -a in it.
I now took your latest and it's working.

Now I think the next question from people would be to start this clock when the screen locks. :wink:
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

ken geometrics
Posts: 76
Joined: Fri 23 Jan 2009, 14:59
Location: California

#20 Post by ken geometrics »

01micko wrote:Would you like a config gui with that? Perhaps sound choice, colour choice?
The bell function did not work on my PC. Here is a replacement that does work but is less than ideal. I was going to make it phase lock the delay timing to get exactly onto the minutes roll over but I had an attack of the lazies.

It dings on the minute roll over plus just a smidge. It also doesn't loop every 0.5 seconds while waiting. It does some math to work out the delay that is needed then does that delay.

Code: Select all

function BELL (){

  PREVDING="`date +%M`"
   
  until [ -f  /tmp/killclock ] ;  do
    THISDING="`date +%M`"
    THISTICK="`date +%S`"
    THISTICK=`expr 60 - $THISTICK`

    if [ "$THISDING" != "$PREVDING" ] ; then
      aplay $NOISE 
      PREVDING="$THISDING"
      fi
    sleep ${THISTICK}.3
    done
  }

Post Reply