Digital Terminal Shell Clock

App-icon

Screenshots

Terminal Clock
7-Segments styled Clock
Nixie styled Clock
70ies styled Clock

β“˜ Preface

I am coding this clock just out of fun and because I admire beautiful and funny clocks. Instead of searching and downloading an old terminal-clock, I decided to rather create my own one and include the date as well.

Programming such a clock with the Unicode character set using bash script is almost like programming with BASIC on my beloved CBM 8032 or C64 back in the day. Pure, raw and sometimes spaghetti code. Ah, those were the days!

This is also proof that a fully functional program can be created with a Bash script. The advantages are obvious: a minimal installation of Linux is sufficient without having to use a bloated programming language.

πŸ’‘ Description

Measured on several platforms, the CPU-Load should remain below 2% – but mostly even below 1%.

Note that the label Β«SWISS MADEΒ» of this clock is correct indeed – I am living in the Β«clock-countryΒ» Switzerland and try to continue the art of designing clocks. It is just that this one is made out of pure software

πŸž‹ Installation and Dependencies

Linux

As this is a bash script, it is not needed to be installed. Copy it to wherever you like. However, there are a few dependencies:

After all, if you feel unsure wether you have to install those mentioned packages, most probably you don’t.

Windows

Due to the lack of a native Bash Shell, you can install GIT Bash for Windows that is intended for GIT usage and is emulating the Bash only. The clock.bash script will run nevertheless.

❌ Restrictions in general

  1. Depending on the font and terminal shell, not all characters (Unicode!) may be displayed correctly or might look pretty.

  2. Especially the Unicode triangle chars like β—’ might not be displayed correctly and might be shifted or too small in size. As terminal-font, I have tested sucessfully with Monospace Regular 9. As for the Terminal-Shell, I’ve tested with xfce4-terminal and kitty, native linux console and xterm so far.

  3. Not every terminal shell is capable of RGB colors although most do nowadays. If using a historic one, it might be a good idea to use one of the 16 specified colors.

βš™ Options

⏰ Alarm

This option is used to set up an alarm time in HH:MM. E.g.: ./clock.bash --alarm=16:45 If the alarm time is equal to the actual time, clock.bash is terminating and the following output is showed:

  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ
  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ     β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ
  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ     β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ    
  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ

Advantage: You can set up a command-chain as the following example is showing:

./clock.bash && aplay /path/to/some/music/alarm.mp3

This will teminate the clock at the given time and then play an mp3 file.

Restrictions:

Let me know what you think, and I’ll consider whether and how this can be implemented as simply as possible.

⏲ Countdown

This option is defining a countdown time in the format hh:mm:ss E.g.: ./clock.bash --countdown=03:00:00

If the countdown is zero, it will result in the following output and returning to the terminal shell.

  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ
    β–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ        β–ˆβ–ˆ  β–ˆβ–ˆ        β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ
    β–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ
    β–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ        β–ˆβ–ˆ      β–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ        
    β–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ

⏱ Stopwatch

This option is used to trigger a stopwatch. Usage: clock.bash --stopwatch=start

If you quit clock.bash by pressing the key q and while the stopwatch is running, the last time is saved before returning back to the terminal shell.

Example of output:

  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 
      β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆ 
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 
  β–ˆβ–ˆ          β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ     
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

      β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ          β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 
      β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ          β–ˆβ–ˆ      β–ˆβ–ˆ          β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ     
      β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ          β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 
      β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ          β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ          β–ˆβ–ˆ 
      β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ          β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆ 
  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ 
  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ          β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ 
  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ      β–ˆβ–ˆ 
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ          β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ      β–ˆβ–ˆ 

Statusbar

β˜€ Styles

To give your clock a different look or font, you can choose one specific style based on an era.

Usage:

./clock.bash --style=50     # run clock using a style from the 50ies
./clock.bash --style=E-13B  # same as --style=50 using alias

Available styles:

50 or E-13B

51 or E-13B-simple

55 or NIXIE

60 or OCR-A

61 or OCR-A-SIMPLE

70 or DATA-70

71 or DATA-70-SIMPLE

72 or 7-SEGMENT

73 or 7-SEGMENT-THIN

74 or 7-SEGMENT-ROUNDED

78 or VT100

80 or default

83 or VT220

84 or numbers

85 or hashes

87 or VT320

90 or MODERN

Color

Restrictions

There might be many useful functions missing. Let me know of the ones you like to have implemented.

No programming languages included or other programs in comparison of real RPN calculators.

β„Ή Help

✍ Feature requests?

For any kind of feature you would like to see or bug reporting or thank you’s:

βœ‰ Email me

Take care! Simon