Last Updated on 2024-08-14 by Clay
Introduction
I often use my computer to watch full-screen videos and need to promptly return to work mode when the time comes — but embarrassingly, I don’t like constantly picking up my phone to check the current time, as it’s quite inconvenient.
I once used the watch -n 1 date
command on another screen to continuously display the current time, allowing me to glance over at it whenever needed; however, this display method was not very aesthetic, and the font was quite small.
Eventually, I found a small terminal tool for displaying the clock: tty-clock. This is, so far, the most satisfying solution I’ve used.
Installation
sudo apt install tty-clock
Simply using the tty-clock
command can display the time in the terminal. There are also several standard operations, such as adding the -s
parameter to display seconds, centering the clock by pressing C after entering, and changing the color using the number keys [0-7]… etc.
How to Use
Commands
tty-clock accepts a number of runtime keyboard commands, upper and lower case characters are treated identically. K,J,H,L vi-style movement commands to set the position of the displayed clock. These commands have no effect when the centered option is set. [0-7] Select a different color for displaying the clock. B Toggles bewteen bold and normal colors. X Toggles displaying a box around the clock. This option is disabled by default. C Toggle the clock's position to centered. When set the movement commands are disabled. R Set the clock to rebound along the edges of the terminal. S Display seconds. T Switch time output to the 12-hour format. Q Quit.
Options
-s Show seconds. -S Screensaver mode. tty-clock terminates when any key is pressed. -x Show box. -c Set the clock at the center of the terminal. -C [0-7] Set the clock color. -b Use bold colors. -t Set the hour in 12h format. -u Use UTC time. -T tty Display the clock on the given tty. tty must be a valid character device to which the user has rw access permissions. (See EXAMPLES) -r Do rebound the clock. -f format Set the date format as described in strftime(3). -n Do not quit the program when the Q key is pressed (or when any key is pressed while in Screensaver mode). A signal must be sent to tty-clock in order to terminate its execution. (See EXAMPLES) -v Show tty-clock version. -i Show some info about tty-clock. -h Show usage information. -D Hide the date. -B Enable blinking colon. -d delay Set the delay (in seconds) between two redraws of the clock. Default 1s. -a nsdelay Additional delay (in nanoseconds) between two redraws of the clock. Default 0ns.