Tiny Core Linux

General TC => Programming & Scripting - Unofficial => Topic started by: Rich on August 06, 2012, 01:59:32 AM

Title: Script to create a real barebones desktop clock
Post by: Rich on August 06, 2012, 01:59:32 AM
The title says it all. Directions on how to launch are in the attached script. For something fancier, see:
http://forum.tinycorelinux.net/index.php/topic,13793.msg77140.html#new

Title: Re: Script to create a real barebones desktop clock
Post by: Rich on May 26, 2020, 01:31:18 AM
Attached is an updated version of tinierclock. This version runs directly without the need for any external commands. Just
download, then:
Code: [Select]
chmod 775 tinierclock2.sh
./tinierclock2.sh

There are variables for changing the XY coordinates of the clock as well as the font.
Title: Re: Script to create a real barebones desktop clock
Post by: Juanito on May 26, 2020, 01:52:06 AM
If I set the width to 8 for a 24h clock, it displays just "AM" - maybe the default font is too wide?
Title: Re: Script to create a real barebones desktop clock
Post by: Rich on May 26, 2020, 01:56:44 AM
Hi Juanito
A 24 hour clock doesn't have AM or PM, just 6 digits and 2 colons.
Title: Re: Script to create a real barebones desktop clock
Post by: Rich on May 26, 2020, 02:01:15 AM
Hi Juanito
You also have to change this:
Code: [Select]
# For 24 hour format, comment the 12 hour line and uncomment the 24 hour line.
# echo -ne `/bin/date +'%T'` > $TTY # Display the time (24 hour format)
echo -ne `/bin/date +'%I:%M:%S%p'` > $TTY # Display the time (12 hour format)
sleep 1
done

to this:
Code: [Select]
# For 24 hour format, comment the 12 hour line and uncomment the 24 hour line.
echo -ne `/bin/date +'%T'` > $TTY # Display the time (24 hour format)
# echo -ne `/bin/date +'%I:%M:%S%p'` > $TTY # Display the time (12 hour format)
sleep 1
done
Title: Re: Script to create a real barebones desktop clock
Post by: Juanito on May 26, 2020, 02:31:08 AM
That'll teach me not to read to the end - works fine now  :)
Title: Re: Script to create a real barebones desktop clock
Post by: Rich on May 26, 2020, 08:17:09 AM
Hi Juanito
... - works fine now  :)
Good. I though maybe I'd missed something, again.

Quote
That'll teach me not to read to the end ...
You should have just blamed me and said you couldn't find it buried amongst all the comments. ;D
Title: Re: Script to create a real barebones desktop clock
Post by: Rich on October 31, 2024, 11:28:18 PM
Hi Juanito
I lifted the section of the script that launches a terminal, tracks down
its PID, and finds its /dev/ file for use in another project.

I found the section that tracks down the PID would sometimes fail. I
rewrote that section from scratch to fix the issue. The attachment in
reply #1 has been updated.