Simple Countdown Clock - Python and xdaliclock

Here is a simple countdown clock script which you can use. It is simply
sending -countdown argument properly to the xdaliclock binary.

I find having this script in my /usr/local/bin pretty useful.




#!/usr/bin/python
# A Simple Countdown Clock using xdaliclock
# usage: countdown [time]
# time defaults to 1 hour.

import time
import sys
import subprocess

try:
hours = float(sys.argv[1])
except IndexError:
hours = 1
hours = int(time.time()) + int(hours * 3600)
command = 'xdaliclock -countdown %d' % hours
subprocess.Popen(command.split())

No comments: