a fuzzy clock script


#1

This is just the script to display a fuzzy clock, e.g. "half past ten" instead of "10:29", it's so simple it doesn't really need a preset, just add an AppleScript widget with black background. Set it to execute every 60 secs (30 if you want slightly more accuracy, but rather pointless, given that it is fuzzy with accuracy thus reduced to no better than 3 minutes!).

I've placed mine far right but bear in mind the width of the text changes so if you have buttons next to it that you want to keep a fixed position, either uncomment the commented out lines which will maintain the same character length but with a variable width font this will still change slightly, use a mono-spaced font no problem, else place it somewhere it doesn't affect positioning, e.g. if on the right place the clock before your buttons.

I've been using the iStatMenus fuzzy clock (and the original Fuzzy Clock app before that…), but the touch bar is frankly the perfect place for it as in the menubar both the width and text changes were a little distracting, whereas on the touch bar you can look only when needed avoiding it becoming a distracting habit.

set now to current date
set mins to minutes of now
set hour to hours of now
if hour is equal to 0 then set hour to 24
   --set width to 22
set hours to {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve","one"}
if mins is less than 4 then
	if hour is 12 then
		set clock to "midday"
	else if hour is 24 then
		set clock to "midnight"
	else
		set clock to item hour of hours & " o'clock"
	end if
else if mins is greater than 56 then
	if hour is 11 then
		set clock to "midday"
	else if hour is 23 then
		set clock to "midnight"
	else
		set clock to item (hour + 1) of hours & " o'clock"
	end if
else if mins is less than 8 then
	set clock to "five past " & item hour of hours
else if mins is less than 13 then
	set clock to "ten past " & item hour of hours
else if mins is less than 18 then
	set clock to "quarter past " & item hour of hours
else if mins is less than 23 then
	set clock to "twenty past " & item hour of hours
else if mins is less than 28 then
	set clock to "twentyfive past " & item hour of hours
else if mins is less than 34 then
	set clock to "half past " & item hour of hours
else if mins is less than 38 then
	set clock to "twentyfive to " & item (hour + 1) of hours
else if mins is less than 43 then
	set clock to "twenty to " & item (hour + 1) of hours
else if mins is less than 48 then
	set clock to "quarter to " & item (hour + 1) of hours
else if mins is less than 53 then
	set clock to "ten to " & item (hour + 1) of hours
else
	set clock to "five to " & item (hour + 1) of hours
end if
--repeat (width - (length of clock)) times
--	set clock to " " & clock -- non-breaking; for left-alignment move the space to after the clock, for flexible/center comment out the whole repeat
--end repeat
return clock

As a fun variation if you have regular schedule you could add some extra ifs (first) for specific activities…

set day to weekday of (current date) as integer
if day is greater than 1 and day is less than 7 and hour is 17 and mins is greater than 30 and mins is less than 45 then -- mon-fri between 5:30 and 5:45
	return "home-time!" -- use an object and change the colour too
else if …

a Reminders.app script