Code Monkey home page Code Monkey logo

plock's Introduction

Plock - Python Clock and Timer

This Python script provides a clock and timer functionality using the curses library. It displays a real-time clock, counts up, or counts down from a specified time. The script also plays a bell sound when the countdown timer reaches zero.

screenshot1 screenshot2 screenshot3

Features

  • Clock Mode: Displays the current time in HH:MM:SS format.
  • Count Up Timer: Counts up from 0 or a specified start time.
  • Count Down Timer: Counts down from a specified start time and plays a bell sound when finished.
  • Responsive UI: Adjusts the display when the terminal window is resized.

Requirements

  • Python 3.x
  • curses library (included in the Python Standard Library)
  • aplay utility for Linux to play sound
  • afplay utility for macOS to play sound

Usage

Run the script with the following options:

Usage: plock [OPTION] [TIME_FORMAT]

without options:    normal clock

OPTIONS:
    up      [TIME_FORMAT]    Start a count-up timer
    down    [TIME_FORMAT]    Start a count-down timer
    help                     print help

time formats: [$h $m $s] [$h] [$m] [$s]
Key Function
Space Toggle Pause
Ctrl + C Exit

Examples

  • Clock Mode:

    plock
  • Count Up Timer from 0:

    plock up
  • Count Up Timer from 1 hour, 30 minutes, and 45 seconds:

    plock up "1h 30m 45s"
  • Count Down Timer from 10 minutes:

    plock down "10m"

Installation

./install.sh

Notes

  • The script uses the curses library to create a terminal-based user interface.
  • On Linux, the script uses aplay to play the sound. Ensure aplay is installed (comes with alsa-utils).
  • On macOS, the script uses afplay to play the sound, which is included with macOS.
  • The script does not support sound playback on Windows.

plock's People

Contributors

assaidy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.