|
|
Even more fun with cal and GeekTool
I had a feeling I wasn't being clear enough. Obviously I can go into GeekTool and change the month range whenever I want. It would be sort of silly to have "cal 7 2004; cal 8 2004; cal 9 2004" unless you only wanted those specific months year round. Conveniently, "cal" alone assumes the current month and year, but there is not an obvious way to output "cal n-1; cal n; cal n+1" where n is the current month which can presumably be obtained from the OS. I'd like to display last-, this-, and next-month without having to hard code "this" month. Is that more clear?
Even more fun with cal and GeekTool
For clarity, and in response to the earlier points I should add that:
Even more fun with cal and GeekTool
Okay, this is crude and awful, but it seems to work. Any better solutions welcome! Anyway, after seeing the post this morning I got all excited, but I wanted to see previous and next month as well. I ended up with a small shell script.
Even more fun with cal and GeekTool
Well, no one volunteered to improve upon my code, which is too bad. But I *did* make a couple of small improvements that are worth mentioning. This will display the previous, current and next month vertically, with the current date highlighted with parenthesis.
I'm pretty sure the original post from wallybear would have had a problem highlighting the first or last days of the week, so that's been fixed here. I did NOT include the change so the week starts on Monday, I like Sunday. Here is the code:
and here is the output:
Last word on the subject, I promise!
Even more fun with cal and GeekTool
No, my code has no problem marking first or last day of the week, as I added a space before and after each line, in order to make the replace string working everywhere.
Even more fun with cal and GeekTool
there's one serious issue with your script: When the month is december or january, it wil display the wrong year, since you only calculate it once.
If it's december, you have to call only the next month with "year + 1", and if it's january, you have to call only the previous month with "year - 1"
Here's the fix:
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.08 seconds |
|