Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 06-12-2003, 10:03 PM   #1
localhost
Prospect
 
Join Date: Mar 2003
Location: 127.0.0.1
Posts: 48
Customizing the menu bar clock

I love this hint (probably one of my all time favorites, actually), but can never get it to work exactly to my liking. Here is a screenshot of what the current configuration looks like. The string in .GlobalPreferences.plist reads:
Code:
%a, %m/%e - %I:%M
My question: how do I remove the leading zeros that appear in 06 (the month) and 09 (the hour)? Is there something I'm missing in the strftime man page?

Thanks,
localhost
localhost is offline   Reply With Quote
Old 06-12-2003, 11:14 PM   #2
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
via the shell date command:

%l (that's an ell) will make the hour canonical.

i don't see the canonical form of numeric month in man strftime.
__________________
On a clear disk, you can seek forever.
mervTormel is offline   Reply With Quote
Old 06-13-2003, 07:18 AM   #3
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Re: Customizing the menu bar clock

Quote:
Originally posted by localhost
I love this hint

I've posted, not because I have a solution (I've looked at man strftime and I don't think you can do what you want - which is basically what Merv said), but because I hadn't come across this hint and think it's excellent. Thanks.

On the assumption that I can probably remember what month it is, mine now reads as:

%1H:%M:%S (%a %e)

i.e. the time followed by the day and day of the month in brackets.
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 06-13-2003, 07:29 AM   #4
localhost
Prospect
 
Join Date: Mar 2003
Location: 127.0.0.1
Posts: 48
I've got it! Tacking a "1" on after the % and before the parameter turns the parameter conical. Mine now reads:
Code:
%a, %1m/%e - %1I:%M
I figured this out by enabling the stock Apple version of the clock, and saw what string it used.

Thanks for all the help!
localhost is offline   Reply With Quote
Old 06-13-2003, 07:48 AM   #5
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Quote:
Originally posted by localhost
I've got it!

Well done, mine is now:
Code:
%1H:%M:%S (%a %1e)
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 06-13-2003, 10:00 AM   #6
Jacques
All Star
 
Join Date: Jan 2002
Location: New York, NY
Posts: 972
Lightbulb

Why not use PTHClock? You can customize it with your font choice and it has excellent calendar options, worth a shot.
Jacques is offline   Reply With Quote
Old 06-13-2003, 10:07 AM   #7
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Quote:
Originally posted by Jacques
Why not use PTHClock? You can customize it with your font choice and it has excellent calendar options, worth a shot.

Where's the fun in that? Tinkering about with a normally hidden .plist file is much more rewarding

Actually, I have tried PTHClock but didn't really use it much differently from the menubar clock so removed it some time ago. Also, despite having a ridiculously large number of background processes running, I would rather amend an existing piece of software than add another yet another one.
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 06-13-2003, 10:13 AM   #8
Jacques
All Star
 
Join Date: Jan 2002
Location: New York, NY
Posts: 972
Unhappy

I like to use my own font, that's the biggest plus for me.

Quote:
Originally posted by djn1
..I would rather amend an existing piece of software than add another yet another one..

I've been curious about this one. If you disable Apple's menu bar clock and enable PTHClock - isn't that one background process, regardless of which way you go?

..or does Apple's background process, the one that's responsible for the menu bar clock enabled, run regardless of whether you use it or not?

hmm
Jacques is offline   Reply With Quote
Old 06-13-2003, 10:21 AM   #9
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Quote:
Originally posted by Jacques
..or does Apple's background process, the one that's responsible for the menu bar clock enabled, run regardless of whether you use it or not?

I checked this out a while ago and, as far as I could tell, it makes no difference whether you have the menubar clock enabled or not. For example, top reports the same number of running processes either way. This doesn't mean to say that the system overhead remains the same in both conditions, but I couldn't determine what that difference might be.
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 06-13-2003, 05:28 PM   #10
Guybrush
Triple-A Player
 
Join Date: May 2003
Location: homeless
Posts: 111
Editing that file has side-effects

If you edit that file it will affect programs like iPhoto or any other program that uses NSDateFormatString i think.

If you only want to customize the clock its just better to edit the clock properties itself rather than a global change, the file you are looking for is:

/System/Library/CoreServices/Menu Extras/Clock.menu/Contents/Resources/English.lproj/Localizable.strings

best thing to do is to open a console and change to that dir, if you have project builder installed you can just do:

sudo open Localizable.strings
if not you can open it with TextEdit:
sudo open -a "TextEdit Localizable.strings"

then edit the string:
"MBC_CLOCK_FORMAT_STRING ="

i changed mine to:
"MBC_CLOCK_FORMAT_STRING" = "%a, %e %b %Y %time%p";

save it, and logout and in again to make the change.

My clock now reads: Fri, 13 Jun 2003 23:24

total changes i made are:
Code:
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/* The following 3 strings are used to set up the format the menu bar clock will use     */

/*  Localizations needs to follow these instructions for the menu clock to work properly. */

/*  MBC_CLOCK_FORMAT_STRING is the main format string.  It MUST contain a %a, %time, and %p */
/*	The order of the items can vary and any additional characters or punctuation is ok */
/*	For example, you could put the short day of week at the END of the menu bar clock by */
/*	changing the format to: "%time%p %a" */
"MBC_CLOCK_FORMAT_STRING" = "%a, %e %b %Y %time%p";


/* MBC_CLOCK_REMOVE_AMPM_STRING is a string that is used to REMOVE the AM/PM display when a user */
/*	turns off display AM/PM (or selects 24 hour formats).  This string MUST contain %p.  It should */
/*	also contain any additional characters that need to be removed when the AM/PM isn't being */
/*	displayed.  For example, a format that wanted a dash to appear before the AM/PM would be: */
/*	"%a %time-%p".  To remove it when a user turns off AM/PM display, the MBC_CLOCK_REMOVE_AMPM_STRING */
/*	should contain "-%p" */
"MBC_CLOCK_REMOVE_AMPM_STRING" = "%p";


/* MBC_CLOCK_REMOVE_DAYOFWEEK_STRING is a string used to REMOVE the short day of week display when a user */
/*	turns off the show day of week option in the preferences.  This string MUST contain %a. It should */
/*	also contain any additional characters that need to be removed when the day of week isn't being */
/*	displayed.  For example, the US time format puts a space between the day of week and the start of */
/*	the time so MBC_CLOCK_REMOVE_DAYOFWEEK_STRING containds "%a " */
"MBC_CLOCK_REMOVE_DAYOFWEEK_STRING" = "%a, ";

/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/

Last edited by Guybrush; 06-13-2003 at 05:36 PM.
Guybrush is offline   Reply With Quote
Old 06-13-2003, 05:44 PM   #11
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Re: Editing that file has side-effects

Quote:
Originally posted by Guybrush
If you edit that file it will affect programs like iPhoto or any other program that uses NSDateFormatString i think.

Thanks for that, I've made the changes.
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 06-13-2003, 05:45 PM   #12
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
grammatically, there is no need for a comma between a word and a number

and i'm usually pretty sure what year it is

a terse timestamp:

Fri 13 Jun 2:44

i'm usually pretty sure when it is AM or PM, also
__________________
On a clear disk, you can seek forever.
mervTormel is offline   Reply With Quote
Old 06-13-2003, 05:48 PM   #13
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Quote:
Originally posted by mervTormel
i'm usually pretty sure what year it is

a terse timestamp:

Fri 13 Jun 2:44

i'm usually pretty sure when it is AM or PM, also

Mine reads:

22:46 (Fri 13)

... because I like 24 hour clocks, think the brackets look neater and, unlike Merv, I can also remember what month it is
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 06-13-2003, 06:06 PM   #14
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
ha! good one. (mumble rassum frassum ridicule my granularity, will ya?)

(contents between parentheses are to be ignored)

(not a very good literary device, either)

(shut up, you!)

{backing out, slowly}

but, but, but, without the month, i'd need a comma (or some other delimiter), and i despise the, uh, /delimiter/. in that, uh, context.
__________________
On a clear disk, you can seek forever.
mervTormel is offline   Reply With Quote
Old 06-13-2003, 06:12 PM   #15
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Quote:
Originally posted by mervTormel
ha! good one. (mumble rassum frassum ridicule my granularity, will ya?)

(contents between parentheses are to be ignored)

(not a very good literary device, either)

(shut up, you!)

{backing out, slowly}

but, but, but, without the month, i'd need a comma (or some other delimiter), and i despise the, uh, /delimiter/. in that, uh, context.

Easy, and even more terse than your last effort:

2:44 Fri 13

... problem solved
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 06-13-2003, 06:22 PM   #16
zeb
Major Leaguer
 
Join Date: Dec 2002
Posts: 457
... I use PTHClock...

15:20:45

with

Fri 06·13

on the mouse over (those of us without a regular job who sit around in an RV with no real connection to the real world need to be reminded of the day of the week)

oooh... and double-clicking brings out a calendar? GREAT! I couldn't ask for more.
__________________
..:: Zeb ::..
zeb is offline   Reply With Quote
Old 06-13-2003, 06:33 PM   #17
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
Quote:
Originally posted by zeb
... I use PTHClock...

But that's too easy. The difference here is like when you walk up or climb a mountain yourself rather than driving, getting the cable-car, or whatever. When you get to the top the details of the landscape are objectively the same but the view and the experience are qualitatively different. Or am I being too geeky about this? Merv?
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Old 06-13-2003, 06:40 PM   #18
zeb
Major Leaguer
 
Join Date: Dec 2002
Posts: 457
Quote:
Originally posted by djn1
The difference here is like when you walk up or climb a mountain yourself rather than driving, getting the cable-car, or whatever.

Sounds like your making a mountian out of a mole hill... (sorry, couldn't resist)... I've hacked the system plenty (not to boast), and found that PTHClock is exactly what I wanted - I honestly couldn't ask for more. And because of that, I am willing to give a little of my system resources to have it running. I use the 'double-click' calendar a lot... uh, the one across the room is, well, not close enough. (I actually have to get up to see it! jeeze!)
__________________
..:: Zeb ::..
zeb is offline   Reply With Quote
Old 06-13-2003, 06:40 PM   #19
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
geeky? yes. loquacious? doubly so :]

PTHclock here because of color and font and handy quick calendar features.
__________________
On a clear disk, you can seek forever.
mervTormel is offline   Reply With Quote
Old 06-13-2003, 06:51 PM   #20
djn1
MVP
 
Join Date: Apr 2002
Location: UK
Posts: 1,212
OK, I give up - I installed it, mainly because I realised I could turn MenuCalendar off (which always annoyed me because the calendar wouldn't autohide). And you're both right - it's sufficiently customizable to meet all the needs that I can think of
__________________
chromasia

G4/800, OS 10.3.x, 1.25GB RAM, 2x80GB HD, 60GB firewire, Geforce4MX, Iiyama VMpro 455+413
Goldtouch keyboard, Cirque EasyCat trackpad, D-Link DSL-604+
djn1 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:11 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.