Geektool Calendar issue

Discussion in 'Mac Apps and Mac App Store' started by krewelement394, May 31, 2010.

  1. krewelement394 macrumors regular

    krewelement394

    Joined:
    Feb 14, 2008
    #1
    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)/"

    [​IMG]

    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!
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    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.
     
  3. krewelement394 thread starter macrumors regular

    krewelement394

    Joined:
    Feb 14, 2008
    #3
    i have that calendar too, but i was hoping to get a horizontal calendar working.
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    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)/"
     
  5. krewelement394 thread starter macrumors regular

    krewelement394

    Joined:
    Feb 14, 2008
    #5
    wow thanks your code worked great! :) do you think if i replace the @ with () it will work as (31)?
     
  6. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #6
    Use this for that effect,
    Code:
    sed 's/\(.*\)/(\1)/'
     
  7. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #7
    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)/"
     
  8. krewelement394 thread starter macrumors regular

    krewelement394

    Joined:
    Feb 14, 2008
    #8
    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 ;)
     
  9. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #9
    I was thinking about that too, but the formatting is an interesting issue.
     
  10. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #10
    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.
     
  11. applelicorice macrumors newbie

    Joined:
    Jun 25, 2010
    #11
    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 :)
     
  12. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #12
    Code:
    cal | sed -n '2,8p'
     
  13. GYnot macrumors newbie

    Joined:
    Oct 18, 2010
    #13
    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.
     
  14. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #14
    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
     
  15. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #15
    Actually you can. Here are some of my examples.

    http://forums.macrumors.com/showpost.php?p=10501085&postcount=2177
    http://forums.macrumors.com/showpost.php?p=10785954&postcount=2258
    http://forums.macrumors.com/showpost.php?p=10717369&postcount=2239

    @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.
     
  16. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #16
    Oooh, hadn't seen that. Maybe will have to reinstall GeekTool now and see what I can do…

    jW
     
  17. GYnot macrumors newbie

    Joined:
    Oct 18, 2010
    #17
    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
     
  18. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #18
    As I mentioned in the links provided,
     
  19. sw33triver macrumors newbie

    Joined:
    Apr 24, 2011
    #19
    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!
     

Share This Page