WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Script to create a real barebones desktop clock  (Read 6837 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11570
Script to create a real barebones desktop clock
« 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

« Last Edit: August 06, 2012, 02:13:06 AM by Rich »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11570
Re: Script to create a real barebones desktop clock
« Reply #1 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.
« Last Edit: October 31, 2024, 11:14:39 PM by Rich »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14785
Re: Script to create a real barebones desktop clock
« Reply #2 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?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11570
Re: Script to create a real barebones desktop clock
« Reply #3 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.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11570
Re: Script to create a real barebones desktop clock
« Reply #4 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

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14785
Re: Script to create a real barebones desktop clock
« Reply #5 on: May 26, 2020, 02:31:08 AM »
That'll teach me not to read to the end - works fine now  :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11570
Re: Script to create a real barebones desktop clock
« Reply #6 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

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11570
Re: Script to create a real barebones desktop clock
« Reply #7 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.