|
|
#1 |
|
Prospect
Join Date: Aug 2002
Location: Boston, MA
Posts: 14
|
Adding Date to Menubar's Time in Jaguar
Hi All,
Some months ago, someone posted the code needed to change the way the date and time show up in the menu bar. Instead of just showing the week day and time, with seconds flashing, it became possible to display the day/month/year as well. Sadly, this code does not work for Jaguar because the file is not exactly the same as before. Can you anyone review the code and post an update? http://www.macosxhints.com/article.p...11126090439402 Please advise. Thanks. -David |
|
|
|
|
|
#2 |
|
Prospect
Join Date: Aug 2002
Location: Boston, MA
Posts: 14
|
Here is more information about this problem...
Before Jaguar, if we typed the following code in Terminal: cd /System/Library/CoreServices/Menu\ Extras/Clock.menu/Contents/MacOS/ sudo perl -p -i -e "s/%a /%x /" Clock The clock would change from: Thu 10:04:30 AM to: Aug 29 2002 Thu 10:04:30 AM This code doesn't work anymore though because at the end of the unix command is "MacOS/." This subdirectory no longer exists in this location. What I see inside the package is the following: Info.plist Resources (folder) version.plist Does anyone know how to adjust the unix command to take into account the new editable resources? |
|
|
|
|
|
#3 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
I'd love to see this happen as well. The only file of interest I was able to find was /System/Library/CoreServices/Menu\ Extras/Clock.menu/Contents/Resources/English.lproj/Localizable.strings
which seems to dictate the format of the clock. The default MBC_CLOCK_FORMAT_STRING setting is "%a %time%p" which I believe means "day of week" then, of course, "time" then "am or pm." We need someone who can figure out a.) if the OS has strings built in for month, date, etc. and b.) what they are (i.e. %x, %y, whatever). 1000 points to whoever gets it first. David |
|
|
|
|
|
#4 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
Well I experimented with that file I found, "Localizable.strings," and changing it seems to have no effect on the clock display. Anyone else have any ideas?
David Last edited by dsk; 08-29-2002 at 01:22 PM. |
|
|
|
|
|
#5 |
|
MVP
Join Date: Jun 2002
Location: Tucson, Arizona
Posts: 1,236
|
As far as the replacements go, you can look at man 3 strftime
From what I can tell, the Perl command replaces the first occurrence of %a in the file Clock with %x. So you just need to find the Clock file. Which means that the cd command changes, but the Perl command stays the same. Of course, I don't have Jaguar to test this theory out. But, uh, if anyone wants to send me a (legal!) copy, I'll look into it.
|
|
|
|
|
|
#6 |
|
Prospect
Join Date: May 2002
Posts: 22
|
I just use PTHClock. It's completely customizable regarding the date and time format. As noted, just refer to the strftime page to get the appropriate strings to fill in. I really like PTHClock b/c I can click on it and pull down a full mini calendar. It's free and I've had no problems running it on either 10.1.5 or 10.2. It also has configurable chimes and it can talk using the built-in speech stuff. Here's the link:
http://www.pth.com/PTHClock/ |
|
|
|
|
|
#7 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
SpongeBob--
I agree that PTHClock is a great app and probably the easiest solution, but there are a couple reasons why I'd rather solve the problem with Clock.menu. First, PTHClock is not a menu extra. It's another process I would have to place in my already crowded Login Items, and I cannot Command-drag it, which I like to be able to do with things in the menubar. Second, there simply SHOULD be a way to view the date in the menubar without resorting to third party apps. David |
|
|
|
|
|
#8 | |||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
Okay, now we just need to figure out WHERE to fill them in. David |
|||||||||||||||||||
|
|
|
|
|
#9 |
|
Prospect
Join Date: May 2002
Posts: 22
|
Wahoo, found it.
Look in the file /Users/<name>/Library/Preferences/.GlobalPreferences.plist It's the key NSTimeFormatString Just use the strings from strftime to format it the way you want. Don't forget that Apple uses the System Preferences config to add to that string. So, you might want to uncheck the AM/PM box, the Show Day of week box or whatever depending on the strings used. |
|
|
|
|
|
#10 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
Super! You're the man! Thanks a lot.
David |
|
|
|
|
|
#11 |
|
Prospect
Join Date: Aug 2002
Location: Boston, MA
Posts: 14
|
Thank you, Bob! I agree - you da man. : )
Now, for a non-unix guru, how should the code look to get the menu bar to look like this: Aug 29 2002 Thu 10:04:30 AM Thanks! -David |
|
|
|
|
|
#12 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
Aug 29 2002 Thu 10 04 30 AM
%b %d %G %a %I %M %S %p Case sensitive. Space it out/punctuate it as you wish. %e is like %d, but will not show a zero before single digit dates. use "man 3 strftime" as nkuvu said at the terminal to see all the options (and to make sure I'm correct about the above). And as SpongeBob said, it might be a good idea to uncheck all the sub-options for the Menu Bar Clock in System Prefs. David Last edited by dsk; 08-29-2002 at 08:48 PM. |
|
|
|
|
|
#13 |
|
Prospect
Join Date: Aug 2002
Location: Boston, MA
Posts: 14
|
I take it you guys know a lot more unix commands than I do, because I am still a bit lost on how to add the date to my menu bar.
Assuming I want the date to show as Aug 29 2002 Thu 9:00:34 pm, what is the command supposed to look like? Something like: cd /Users/david/Library/Preferences/.GlobalPreferences.plist sudo perl %b %d %G %a %I %M %S %p I think a file name is supposed to show up in there, but I don't know where. Thanks in advance, guys! -David |
|
|
|
|
|
#14 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
Ah, sorry. Misunderstood the question. You have to edit the .GlobalPreferences.plist file itself. I personally don't know how to boil it down to one command (someone else might) but here's what I did:
cp ~/Library/Preferences/.GlobalPreferences.plist ~/Desktop/GlobalPreferences.plist.bak [backs up the file to the desktop. Notice the space in between "~/Library/Preferences/.GlobalPreferences.plist" and "~/Desktop/GlobalPreferences.plist.bak". Also notice the period preceeding "GlobalPreferences.plist " and the lack thereof in "GlobalPreferences.plist.bak" -- a period before the file name makes it invisible. Verify that the file is on the desktop before proceeding to make sure you're safe and sound.] pico ~/Library/Preferences/.GlobalPreferences.plist [opens the file in a command line text editor, pico] At this point, you have to locate the string for time format that SpongeBob found. Scroll down (by pressing the down arrow) to: <key>NSTimeFormatString</key> <string>%1I:%M:%S</string> then edit the "%1I:%M:%S" part using the codes I directed you to in my last post on this thread. When you're done, hit Control-O, then Enter to save. Quit and reopen the Menu Bar clock (or I guess just logging out and back in should work too). Changes should take effect. On a side note, does anyone know why there is a "1" before "I" in the default string, "%1I:%M:%S"? It's really buggin' me. Let us know how it goes, davey. David |
|
|
|
|
|
#15 | |||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
In response to my own question, it turns out the "1" makes it so that a single digit hour will not have a "0" before it. Found this out by deleting the "1". Go figure. David |
|||||||||||||||||||
|
|
|
|
|
#16 |
|
Prospect
Join Date: Aug 2002
Location: Boston, MA
Posts: 14
|
Ok, well it did not exactly work, but I'm a whole lot closer now than before.
When I followed the instructions before, I ended up with a time/date lines that looks like this: Aug 29 ? Thu 9:33:15 pm pm When I went to the Date and Time Pref Panel, I unchecked am/pm and then the date totally reverted back to the original display: Thu 9:33:15 pm. I tried this a second time, unchecking "Show AM/PM" and "Show the Day of Week" and this time the result looks like this: Aug 29 ? Thu 9:34:59 This time there is no am/pm at all, and the year stays a question mark. I went back to date/time pref panel and rechecked the am/pm and day of week, and now the menu bar looks like this: Thu Aug 29 ? Thu 9:35:55 pm I hope this helps in figuring this out. I am going to try to fix my clock now. -David |
|
|
|
|
|
#17 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
Please post the string you used.
David |
|
|
|
|
|
#18 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
Okay, I think I see the problem. Forget %G for year, use %Y. That should fix the question mark, I hope. Also, do uncheck those options in the system prefs. It will be redundant otherwise.
David |
|
|
|
|
|
#19 |
|
Prospect
Join Date: Aug 2002
Location: Boston, MA
Posts: 14
|
Sure -- first I backed up the file, then I used the pico command, then I went to the string to edit and typed:
%b %d %G %a %1I:%M:%S %p Command O, exit, log out and back in. -David |
|
|
|
|
|
#20 |
|
Triple-A Player
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 223
|
See my last post. Does that help?
David |
|
|
|
![]() |
|
|