Skip to content

[Linux] 顯示終端機電子時鐘時間的小工具: tty-clock 介紹

Last Updated on 2024-02-25 by Clay

介紹

我經常會使用我的電腦看全螢幕的影片,並且需要在等下工作時間到時準時回到工作狀態 —— 但尷尬的是我並不喜歡隨時拿起手機查看當前的時間,因為那樣做很麻煩。

我曾經使用 watch -n 1 date 指令在另外一個螢幕實時地顯示當前時間,讓我可以隨時往一旁查看時間;但是這種顯示方法其實並不美觀,並且字體十分狹小。

最後,我還是找到了個在終端機顯示時鐘的小工具:tty-clock。這也是目前為止我使用得最滿意的。


安裝

sudo apt install tty-clock


直接使用 tty-clock 指令就能在終端機上顯示時間。並且還有幾個常規操作,比方說加上 -s 參數增加秒數、進入之後按 C 可以將時鐘置中、可以使用數字鍵 [0-7] 更換顏色… 等等。


使用方式

指令 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.



References


Read More

Leave a Reply取消回覆

Exit mobile version