provide ability to display binary clock using unicode

Bug #705037 reported by James Hunt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
byobu
Fix Released
Wishlist
Unassigned

Bug Description

Only for hardcore geeks... in a similar vein to lp:##705032, the attached script (uclock.sh) can display the time in hex, octal and if you are really crazy in binary too. It maps the unicode braille block to show the time in 3 blocks of "binary". A demonstration in ASCII...

If the time is 17:46:07, the binary mode of the clock script would show:

⢐ ⠲ ⢰

Script usage:

Usage: uclock.sh [options]

Options:

 -b : Display binary clock (default)
 -h : Show this help.
 -l : Display leading zeros (hex and octal modes only).
 -m : Show time in 24-hour military format
              (default: 12-hour format).
 -n : Suppress newline at end of time.
 -o : Display time in octal (base 8).
 -s <sep> : Specify separator between hours and minutes
              (and seconds if not disabled).
 -u : Display alphabetics in upper-case (hex mode only).
 -x : Disable time in hexadecimal (base 16).
 -z : Disable display of seconds.

Tags: unicode

Related branches

Revision history for this message
James Hunt (jamesodhunt) wrote :
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Hey James,

I was testing this script, and I get:

$ bash uclock.sh
uclock.sh: line 150: 09: value too great for base (error token is "09")

Can you take a look? Cheers!

Changed in byobu:
status: New → Triaged
importance: Undecided → Wishlist
status: Triaged → Incomplete
Revision history for this message
James Hunt (jamesodhunt) wrote :

Fixed bug whereby bash was interpreting numbers with leading zeros as octals.

Revision history for this message
James Hunt (jamesodhunt) wrote :

Hi Dustin,

Problem solved I believe.

Cheers,

James.

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Thanks, james. I'll get this committed ;-)

Changed in byobu:
status: Incomplete → Triaged
Revision history for this message
James Hunt (jamesodhunt) wrote :
Changed in byobu:
status: Triaged → Fix Committed
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Note that I had to change the interpreter of the /usr/bin/byobu-status wrapper from sh to bash to make this work.

I'm not thrilled about that, but I'll give it a chance for a while. I'm concerned that performance regressions may occur using the bash interpreter instead of dash.

Your new scripts are all bash, James, and seem to use some advanced features, like arrays. I can certainly see their usefulness here, but I'm just concerned that they might slow down the overall status reporting. Anyway, committing for now. We'll see how it goes.

Changed in byobu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.