Horizontal calendar
Thanks everyone for the inspiration, I thought I'd give something back in return.
I've got a simple bit of code to generate a horizontal and perpetual 12 month calendar (3 months back, current, and 8 forward):
Code:
for c in -3 -2 -1 +0 +1 +2 +3 +4 +5 +6 +7 +8;do cal $(date -v$c\m +'%m %Y');done|pr -12 -t -w275 -i275
This is really for people with larger screens, I got it to fit on my 24-inch iMac by using a 10 point font.
It is very easy to modify though.
If you want to show just 4 months, say 1 back, the current and 2 forward change the in count in the for loop to "-1 +0 +1 +2" and set the first option for the pr command to 4. You'll also need to adjust the -w and -i options to match (try around 100) so the code would be:
Code:
for c in -1 +0 +1 +2;do cal $(date -v$c\m +'%m %Y');done|pr -4 -t -w100 -i100
If you want a vertical calendar simply remove everything after the "done".
If you want to highlight the current day, find the code earlier in this thread which highlights just the current day for the month and overlay it on top. As the current month is always on the same place on the screen it doesn't need to be adjusted.
It is pretty flexible bit of code, and I hope you'll find it useful.
Edit: To show another way you can use the script:
Code:
for c in -3 -2 -1 +0 +1 +2 +3 +4 +5 +6 +7 +8;do cal $(date -v$c\m +'%m %Y');echo;done|pr -2 -t -w50 -i50
That gives you twelve months as before, but vertically in two columns. Enjoy!