THEN=`date -v10y -v9d -v9m +%s`
SECS=$(($THEN-$(date +%s)))
echo "Days: "$(($SECS/3600/24))
echo "Hours: "$(($SECS/3600))
echo "Minutes: "$(($SECS/60))
echo "Seconds: "$(($SECS))
i did that but it's still not reloading :SAwesome, I knew you could figure it out. The refresh is a Geektool option. At least in version 3 there's a "Refresh every" field under the command field that you can put "1" in that will refresh every second.
THEN=`date -v10y -v9m -v9d -v0H -v0M -v0S +%s`
cal -m $(($[10#$(date +%m)]-1)) | sed -e s'/^/ /'
echo "\033[32m\c"
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e | sed s'/ //') /$(date +%e | sed -e s'/ //' -e s'/\(.*\)/ [42;30m\1[0m /g')/"
cal -m $(($[10#$(date +%m)]+1)) | sed -e s'/^/ /'
Attached is a 3-month calendar with the current month progress and day highlighted. Below is the code for it.
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.Code:cal -m $(($(date +%m)-1)) | sed -e s'/^/ /' echo "\033[32m\c" cal | sed "s/^/ /;s/$/ /;s/ $(date +%e | sed s'/ //') /$(date +%e | sed -e s'/ //' -e s'/\(.*\)/ [42;30m\1[0m /g')/" cal -m $(($(date +%m)+1)) | sed -e s'/^/ /'
I could not succeed in doing this. I would be happy if I could get only the current month to highlight the current day (and no colors, I could not figure out how to put the invisible character control+q esc and quotes failed). So all I want is the code for the current month with the day "boxed" because I hate that ##, it looks ugly! But thank you for the post angelwatt.
cal | sed "s/^/ /;s/$/ /;s/ $(date +%e | sed s'/ //') /$(date +%e | sed -e s'/ //' -e s'/\(.*\)/ [42;30m\1[0m /g')/"
Is it possible to put a Live Radar loop on your desktop with Geektool?
got it to work... its really cool, even if I dont really understand why the character is invisible... can this be used on applescript? (put a part of the output a certain color)Code:cal | sed "s/^/ /;s/$/ /;s/ $(date +%e | sed s'/ //') /$(date +%e | sed -e s'/ //' -e s'/\(.*\)/ [42;30m\1[0m /g')/"
One the second line, where the [42 is, just before it hold control and hit q, then release and then hit esc. There's no visual feedback when you do this. Do the same before the [0m. If you move the text cursor across these characters you should notice it doesn't move one time for the invisible char. That should tell you it has been entered correctly. Also, the ANSI color codes only work in Geektool 3+ I believe.
wow that looks goodI would just want the code for the calendar and to-do list in the middle.
got it to work... its really cool, even if I dont really understand why the character is invisible... can this be used on applescript? (put a part of the output a certain color)
Potentially. One of the other posts recently someone was using them inside a Ruby script, but used \e for the escape character.
set displaymain to trackStatus & trackName & " | " & artistName & " | " & albumName & " | (" & tracktime & ") | " & trackrating & " | " & trackplaycount & "x" & " | " & trackplaylist
how would I put the artist in white for example?
I took a look at your setup, and the calendar looks really great! Care to let us know how you did it, with so many colors and font styles?
Very nice! Thanks.
Darryl
#!/usr/bin/env ruby
#
# Author: Robert Jorgenson
# Author email: rjorgenson@gmail.com
require 'Date'
ABBR_DAYNAMES = {0, 'Su', 1, 'Mo', 2, 'Tu', 3, 'We', 4, 'Th', 5, 'Fr', 6, 'Sa'}
def days_in_month(year, month)
return (Date.new(year, 12, 31) << (12 - month)).day
end
def day_in_month(year, month, day)
return Date.new(year, month, day).wday
end
def build_day_array(year, month)
day_array = Array.new
for d in (1..days_in_month(year, month))
day_array[d] = ABBR_DAYNAMES[day_in_month(year, month, d)]
end
day_array.shift
return day_array * " "
end
def build_separator(year, month)
#color = "\e[32m" #green
color = "\e[31m" #uncomment for red
separator_string = "||" # change this to change separator, best if 2 characters wide
close = "\e[0m" # don't change this
separator = Array.new
for d in (1..days_in_month(year, month))
if year == Time.now.year && month == Time.now.month && d == Time.now.day then
separator[d] = "#{color}#{separator_string}#{close}"
else
separator[d] = "#{separator_string}"
end
end
separator.shift
return separator * " "
end
def build_date_array(year, month)
date_array = Array.new
for d in (1..days_in_month(year, month))
date_array[d] = d
end
date_array.shift
date_array.each do |d|
if d < 10 then
date_array[(d-1)] = "0#{d}"
end
end
return date_array * " "
end
year = Time.now.year
month = Time.now.month
puts build_day_array(year, month)
puts build_separator(year, month)
puts build_date_array(year, month)