Skip to content

A Python script that displays Swatch Internet Time in a formatted manner.

License

Notifications You must be signed in to change notification settings

henry-malinowski/SwatchTime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwatchTime

MIT License Maintainability

SwatchTime is a Python program for displaying the current date and time using Swatch Internet Time. It provides a set of flags that are useful for a caller from the CLI or as part of a module for another program; like a Polybar module. Currently the flags are mostly stable, but may be changed in the future to be more like date.

Installation

Copy the python script to a location that is in your path. One way might be...

sudo install -m 0755 swatchtime.py /usr/bin/swatchtime

Arch Linux

Automatically Use an AUR helper like Yay, to install the AUR package; yay -S swatchtime-git

Manually

git clone https://aur.archlinux.org/swatchtime-git.git 
cd swatchtime-git
makepkg --install

Usage

-h, --help Print help message and exit

-v, --verbose Shows the PID a few seconds before starting. (default: False)

-t, --tail Enables tail output mode. (default: False)

-d, --delay The delay between refreshes in tail mode; only applies if tail mode is set. (default: 1 second)

-f, --format A mostly strftime compliant string to format the Swatch Time. A notable addition is a way to denote how and where to format the current .beat. (default: d%d.%m.%y@{Beat})

  • {Beat} will format the number of beats without left-padding zeros.
    • Example swatchtime --format d%d.%m.%y@{beat} will output d19.05.19@1
  • {beat} will format the number of beats with padding zeros.
    • Example swatchtime --format %Y-%m-%d@{Beat} will output 2019-05-19@001

--alt-format Format to switch to after receiving a USR1 signal; only applies if tail output is set. (default: None). Unlike the format argument, this must be a strictly strftime compliant string. Examples:

  • swatchtime -t --alt-format %c produces Thu Jan 4 05:45:16 2019 (similar to date)

  • swatchtime -t --alt-format %Y-%m-%dT%H:%M:%S produces 2019-01-04T04:45:19 (an ISO-8601 string for local time)

-u, --utc, --universal Displays standard time as UTC (Coordinated Universal Time). (default: False)

  • swatchtime -t -u --alt-format %Y-%m-%dT%H:%M:%SZ produces 2019-01-04T04:45:19Z (an ISO-8601 string for Zulu time).

Note: Both format options may be called using 'single-quotes', "double-quotes", or no quotes. Quotation marks are only needed if the formatting string contains a space.

TODOs

  • Another way to communicate with a running instance of swatchtime; probably using a FIFO started using a flag
  • i3bar/Waybar module
  • Bash auto-completion files
  • ZSH auto-completion files
  • Fish auto-completion files
  • Make a proper Python package, (whatever that means)

About

A Python script that displays Swatch Internet Time in a formatted manner.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published