Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

krewelement394

macrumors regular
Original poster
Feb 14, 2008
196
0
hell o i am having trouble with this geektool horizontal calendar. it does not show in any way what day we are on. when i found this script an @ symbol replaced the day we were suppose to be on, but it does not do that at all. the calendar just shows the days 1-31 (may).....

this is the script:

echo
echo `cal` |
sed "s/$(date +%e) / $(date +%e | sed 's/.*/@/g') /" |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ */ \| /g' |
sed s'/^ \|//' | sed s'/ \|//' | sed s'/\|/ /' |
sed s'/\|/./g' | sed s"/$/ $(date +%A)/"

Screenshot2010-05-31at11349AM.png


there is a screen shot. as you can see the calendar does not show what day we are on! (ignore the blue area on the far left side, i have my macbook connected to a monitor)

if you have a better horizontal script let me know! ive searched through 12 gooooooogle pages and nothing... i asked the person who i got this script from and he said he also had the same issue. i looked for more horizontal calendars on another forum and nothing!

thanks!
 
Here's the line I use for using ## for the current date. It's in week layout form rather than one-line layout.
Code:
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed 's/./#/g') /"
Looks like spacing is a little different than yours.
 
Here's the line I use for using ## for the current date. It's in week layout form rather than one-line layout.
Code:
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed 's/./#/g') /"
Looks like spacing is a little different than yours.

i have that calendar too, but i was hoping to get a horizontal calendar working.
 
i have that calendar too, but i was hoping to get a horizontal calendar working.

As I mentioned, there's some spacing differences in your command from mine. Have you tried adjusting them to match?

Edit: Here's something that works for me. It's a little shorter than yours.
Code:
echo `cal` |
sed "s/ $(date +%e)/ $(date +%e | sed 's/.*/@/g')/" |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \. /g' |
sed s'/\([a-z]\)[ ]\./\1/g' |
sed s'/\.[ ]*\./  /'| sed s"/$/   $(date +%A)/"
 
As I mentioned, there's some spacing differences in your command from mine. Have you tried adjusting them to match?

Edit: Here's something that works for me. It's a little shorter than yours.
Code:
echo `cal` |
sed "s/ $(date +%e)/ $(date +%e | sed 's/.*/@/g')/" |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \. /g' |
sed s'/\([a-z]\)[ ]\./\1/g' |
sed s'/\.[ ]*\./  /'| sed s"/$/   $(date +%A)/"

wow thanks your code worked great! :) do you think if i replace the @ with () it will work as (31)?
 
Looks like it needed some further tweaking for single digit days.

Code:
echo `cal` |
sed "s/ *$(date +%e)/ $(date +%e | sed 's/ *\([0-9]*\)/(\1)/')/" |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \. /g' |
sed s'/\([a-z]\)[ ]\./\1/g' |
sed s'/\.[ ]*\./  /' |
sed s"/$/   $(date +%A)/"
 
Looks like it needed some further tweaking for single digit days.

Code:
echo `cal` |
sed "s/ *$(date +%e)/ $(date +%e | sed 's/ *\([0-9]*\)/(\1)/')/" |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \. /g' |
sed s'/\([a-z]\)[ ]\./\1/g' |
sed s'/\.[ ]*\./  /' |
sed s"/$/   $(date +%A)/"

HA! you are right! i checked the calendar this morning and it was back to the same problem i had in the beginning. it should the calendar but did not mark what day we were in :) thanks! :D

now if only there is a way to get the Days of the Week over every day ;)
 
Here's hopefully the last tweak. I tested for the 1st and last of the month along with a few days in between to make sure it doesn't break anymore.
Code:
echo `cal`" " |
sed "s/[^0-9]$(date +%e | sed s'/ //')\([^0-9]\)/ $(date +%e | sed 's/ *\([0-9]*\)/(\1)/')\1/" |
sed s'/ $//' |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \. /g' |
sed s'/\([a-z]\)[ ]\./\1/g' |
sed s'/\.[ ]*\./  /'|
sed s"/$/   $(date +%A)/"
For those interested in how to test other dates than the current one, you just add an extra argument to the date commands.

Code:
date [B][COLOR="Red"]-v1d[/COLOR][/B] +%e   # gives you the first of the month
date [B][COLOR="Red"]-v31d[/COLOR][/B] +%e  # gives you the last of the month
date [B][COLOR="Red"]-v10d[/COLOR][/B] +%e  # gives you the 10th of the month
date [B][COLOR="Red"]-v+1d[/COLOR][/B] +%e  # gives you tomorrow
date [B][COLOR="Red"]-v-1d[/COLOR][/B] +%e  # gives you the previous day
Be sure to apply it to each of the date commands in the above script for it to work properly. The v argument does date adjustments. The stands d for day. You can also use m for month and y for year for other adjustments.
 
Calendar without the Month/Year

Does anyone know a script to have a standard calendar, getting rid of the month and year at the top? I just want the days of the week and the days under it. Thanks :)
 
Hi,
I know this thread is old, but I was wondering if anybody knows how to change the "()" that surrounds the current date to having a colored current date instead?

Thanks for any help.
 
Hi,
I know this thread is old, but I was wondering if anybody knows how to change the "()" that surrounds the current date to having a colored current date instead?

Thanks for any help.

Because of the way GeekTool functions, you can't have one section of a single Geeklet be a different color. Hopefully they'll find a good way to implement that, but for now you might be able to pull this off by simply having two Geeklets, one directly on top of the other, and have the top one only show the current date, with spaces to move it to the correct position. Someone with greater skill could probably show you how to do that. Then, the top one can be set to whatever color you want for the current date, and the bottom one will be covered up by that day's date in that spot.

jW
 
Because of the way GeekTool functions, you can't have one section of a single Geeklet be a different color.

Actually you can. Here are some of my examples.

https://forums.macrumors.com/posts/10501085/
https://forums.macrumors.com/posts/10785954/
https://forums.macrumors.com/posts/10717369/

@Gynot: Use the color info I provide in the above links to edit this line,
Code:
sed "s/ *$(date +%e)/ $(date +%e | sed 's/ *\([0-9]*\)/(\1)/')/" |
You'll tweak the (\1) at the end and put the colors pieces around what you want colored differently.
 
Actually you can. Here are some of my examples.

https://forums.macrumors.com/posts/10501085/
https://forums.macrumors.com/posts/10785954/
https://forums.macrumors.com/posts/10717369/

@Gynot: Use the color info I provide in the above links to edit this line,
Code:
sed "s/ *$(date +%e)/ $(date +%e | sed 's/ *\([0-9]*\)/(\1)/')/" |
You'll tweak the (\1) at the end and put the colors pieces around what you want colored differently.

Oooh, hadn't seen that. Maybe will have to reinstall GeekTool now and see what I can do…

jW
 
Mal,
Thanks. Saw too many great examples this past weekend to know it could be done.

This is all new territory to me. I'm not sure what the "color info" is that I'm supposed to use/apply in this vertical cal. Could you help me out?


echo `cal`" " |
sed "s/[^0-9]$(date +%e | sed s'/ //')\([^0-9]\)/ $(date +%e | sed 's/ *\([0-9]*\)/(\1)/')\1/" |
sed s'/ $//' |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \. /g' |
sed s'/\([a-z]\)[ ]\./\1/g' |
sed s'/\.[ ]*\./ /'|
sed s"/$/ $(date +%A)/"



Thanks
 
This is all new territory to me. I'm not sure what the "color info" is that I'm supposed to use/apply in this vertical cal. Could you help me out?

As I mentioned in the links provided,
There are escaped characters on line 3. They are entered by doing a control+q esc (It's invisible when typed) and go right before the two [ chars toward the end of the line. When used inside a double quote area, you can use \033 instead, like on line 2. The coloring is done with ANSI color does. This page list the small list of codes.
 
geektool horizontal calendar - update

long time listener, first time caller...

first off, thanks to everyone for their posts on this topic. i literally discovered geektool yesterday and fell in love with the horizontal calendar (first seen here). second, i'm a shell command/unix/bash/whatevs newbie, so forgive my lack of comprehensive explanation behind a solution i don't fully understand.

after much trial and error, i eventually solved the red-text-for-current-date issue, with some guidance from the earlier (much earlier) posts. the ctrl+q+esc combo was the key to this problem.

below is the code i am using now (and it has been tested for all months and all days).

Code:
echo `cal`" " |
sed "s/[^0-9]$(date +%e | sed s'/ //')\([^0-9]\)/ $(date +%e | sed 's/ *\([0-9]*\)/\1/')\1/" |
sed s'/ $//' |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \. /g' |
sed s'/\([a-z]\)[ ]\./\1/g' |
sed s'/\.[ ]*\./ /'|
sed s"/$/ $(date +%A)/"

i found that inserting ctrl+q+esc (represented by  in the above code) before and after [31m and [0m worked a treat.

Hope this helps!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.