ClockTemp

A TUI clock that displays time, date, temperature and more

37
2
Python

ClockTemp

ClockTemp is a TUI clock inspired by tty-clock that displays the time, date, temperature and more.


InstallationUninstallCommands and KeysCreditsResources Used

Installation

[!IMPORTANT]
Prerequisites: Python version 3.x and requests library

  1. Clone the repository to have local access to all the necessary files. You can do this using the following command:
git clone https://github.com/dantas-arthur/ClockTemp.git
  1. On your terminal navigate to the project directory
cd YOUR/DIRECTORY/ClockTemp/script
  1. Run the install.sh file to install ClockTemp into your environment variables
sudo ./install.sh
  1. Now whenever you run the clocktemp command in your terminal the script will work
clocktemp

[!TIP]
Since ClockTemp has many customization options, you can create an alias in Bashrc to set the desired options once.

  1. On your terminal open Bashrc
nano ~/.bashrc
  1. At the end of the file add your custom configuration
alias clocktemp='clocktemp -tf YOUR_TIME_FORMAT -df YOUR_DATE_FORMAT -tu YOUR_TEMPERATURE_UNIT -s SHOW_OR_HIDE_SECONDS -lat YOUR_LATITUDE -lon YOUR_LONGITUDE -c YOUR_TEXT_COLOR -b YOUR_BACKGROUND_COLOR'
  1. Save your changes pressing CTRL + O > ENTER and exit with CTRL + X

  2. Apply changes on your terminal

source ~/.bashrc
  1. Now whenever you run the clocktemp command without arguments the alias will cause the previously saved settings to be loaded.
clocktemp

Remove ClockTemp

[!NOTE]
If you want to remove ClockTemp from your environment variables, follow these steps:

  1. Run this command to remove the clocktemp folder from local/bin
sudo rm /usr/local/bin/clocktemp
  1. Run this another command to remove the clocktemp folder from local/share
sudo rm -r /usr/local/share/clocktemp

Commands and Interactive Keys list

COMMAND CHOICES DEFAULT FUNCTION
-h, --help None None Show help message and exit
-tf 12 / 24 12 Change time format between 12-hour and 24-hour
-df mm/dd / dd/mm mm/dd Change date format between MM/DD/YYYY and DD/MM/YYYY
-tu c / f c Change temperature unit between Celsius and Fahrenheit
-s true / false true Show or hide seconds
-lat Any latitude 0 Use the user’s latitude to get weather data from Open-Meteo API
-lon Any longitude 0 Use the user’s longitude to get weather data from Open-Meteo API
-c white / black / red / yellow / green / cyan / blue / magenta white Change text color
-b default / white / black / red / yellow / green / cyan / blue / magenta default Change background color

Example command:

clocktemp -tf 24 -df dd/mm -tu c -s true -lat 12.345 -lon -67.891 -c cyan -b default
KEYS FUNCTION
w Change to clock mode
c Change to calendar mode
s Change to stopwatch mode
t Change to timer mode
r Reset stopwatch or timer
SPACEBAR Pause/Resume stopwatch or timer
< / , Previous month
> / . Next month
q Quit ClockTemp

Future updates?

  • [x] Add an integrated calendar
  • [x] Add stopwatch and timer functions
  • [ ] Add reminders in the calendar tab

Credits

The digit display matrix of clock.py archive was adapted from tty-clock, licensed under the BSD-3 Clause:

Copyright (c) 2009-2018 tty-clock contributors
Copyright (c) 2008-2009 Martin Duquesnoy <[email protected]>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
* Neither the name of the tty-clock nor the names of its
  contributors may be used to endorse or promote products derived from this
  software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Resources used

This project was made using Python version 3.10.12, the Requests library and Open-Meteo API to collect weather data.

License

The ClockTemp project as a whole is licensed under the GNU General Public License v3 (GPLv3). See the LICENSE file for details.