Some Crux ports for console clocks

My real-life commitments are more intense in summer, and so I have to apologize for the blank spot over the past couple of days. It’s not that I didn’t have anything to say, but that I didn’t have much time to myself in the first place, and couldn’t spend it typing or tweaking.

For today, I have wanted to tack up a couple more Crux ports, mostly for the console clocks that I have mentioned in recent history. If you’re not a Crux user you probably won’t find these interesting; if you’re an Arch user you might find them useful as starting points for PKGBUILDS, if they don’t already exist in AUR.

(If Pkgfiles look like primitive PKGBUILDs, that would be because in a way, they are. It’s one of the nice things about Crux: As Arch has matured PKGBUILDs have become a teeny bit more complex, whereas Crux ports are still quite simple.)

Without further delay, binclock

# Description: Displays system time in binary format.
# URL:
# Depends on: 

build () 
    cd $name-$version
    install -d m644 $PKG/usr/man/man1/
    install -d m644 $PKG/usr/share/binclock/
    install -d m644 $PKG/etc/
    install -d m644 $PKG/usr/bin
    make PREFIX=/usr 
    make PREFIX=$PKG/usr DESTDIR=$PKG MANPATH=$PKG/usr/man/man1 CONF=$PKG/etc/ INSPATH=$PKG/usr/bin HOME=$PKG/usr/share/binclock install

And vtclock

# Description: 	A text-mode full-screen digital clock
# URL:
# Depends on:	ncurses


build() {
	cd $name
	sed -i s:/usr/local:/usr:g Makefile
	mkdir $PKG/usr/bin/ -p
	make PREFIX=/usr
	make DESTDIR=$PKG install

And finally ticker, which scott kindly mentioned in the wake of my note on vtclock.

# Description:	Generates vertical stock ticker style output on the console.
# URL:
# Depends on:	

build () 
    cd $SRC/$name-$version
    make DESTDIR=$PKG install

Ticker is fun because it does things a little differently than the run-of-the-mill console clock. With this you can stream the date and time — via the date command, or others — down the side of the screen, as opposed to planted in the center as most others do.

And ticker will allow you almost any input, so you can feed it the results of just about any command. It would be nice to be able to customize it a little more — pick a specific block character for readability, or maybe add some color — but as it is it’s unusual and fun to mess with. 🙂

4 thoughts on “Some Crux ports for console clocks

  1. Prinzzchavo

    As far as the comments go, we all have more real-life-commitments on summertime.

    As always, a very inspiring post(I’m starting to have CLI dreams, really), but my question is:

    Have you ever considered creating your own Distro?

    As far as I can see, from the way you almost always achieve your goal (Building up instead of tearing down, Porting from AUR to Crux…), you might actually have, by now, a complete OS of your own, something like a Kmandlux…hehehe

    1. K.Mandla Post author

      I sort of did, a couple of years ago. If you follow the Projects link at the top of the page, you’ll find Ubuntu GTK1.2 Remix, which was something I set up for myself, and later shared.

      I don’t really support it any longer, mostly because my own philosophy on software setups has changed. But it’s still there and will still be usable for as long as the Hardy repos are online. You could give it a try if you like; I still seed the ISO and sometimes still get questions about it.

      Aside from that though, I don’t have any plans to mastermind my own distro. I feel like the system I would build is already available, in the form of Arch or Crux or a console-only Debian system. I would just be duplicating efforts, and I have so little time as it is.

      Nope, no KMandlux in the future. Sorry. 😦

  2. scott

    I am truly honored to have “ticker” mentioned in one of your articles 🙂 You mentioned wishing it could do color. I was tempted to start adding special codes to add color, or pause, or vary the speed. But then I thought, keep it simple, you can do those things from the shell.

    So, for example, you could use a while loop to update the time every 20 seconds or so (like ticker-clock does), but then every 15 times through the loop (5 mins) you could call

    echo -e “\x1b[0;34m”

    to turn the color blue (vt100), then pipe the output of some other script (like a weather forecast, or remind) to a new invocation of ticker to scroll the message. You could change the color to reflect the content of the message. Likewise, you can vary the speed by invoking ticker multiple times with different -d parameters. You can “pause” by calling sleep(1) between calls to ticker. If you know the height of your screen (e.g. use LINES=`tput lines`) you can scroll a message completely off the screen with

    ticker -l $LINES “”

    I tried to make it as light as possible so you could string together multiple calls to it in a script with minimal drain on resources. That’s why I embedded the glyphs right in the source, rather than loading them from a file. But I will think about adding an option to load an alternate “font” from a file someday. In the meantime, if you know some C it is really pretty easy to tweak the look of a glyph. There are no dependencies, so its dead simple to recompile (see the Makefile).

    1. scott

      Sorry for rambling. I’m still learning about tput. Using this

      tput setf 1

      would be a more portable way to set the text color to blue instead of using echo as I did above.

      Also since the cursor is distracting and unnecessary, your script could use tput to hide the cursor with

      tput civis

      (You can un-hide the cursor again with “tput cnorm”)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s