Sunday, November 23, 2008

Desktop calendars

Previously, I talked how I put a calendar on my OSX desktop using GeekTool and the standard UNIX cal program. When my wife saw it, she wanted the same thing on her WinXP desktop and since I'm now starting to use Linux as a desktop I thought I'd do the same thing for it also.

OSX:

Using, GeekTools, I simply had it make 2 shell command calls. The first one is to 'cal' which will return the current calendar month. Next, I had it call another shell command to a script I wrote that says:


#!/bin/sh

nextmonth=`date '+%m'`
year=`date '+%Y'`
nextmonth=`echo $nextmonth|sed 's/^0*//'`
if [ $nextmonth -eq 12 ]; then
nextmonth=0
year=$((year + 1))
fi
cal $((nextmonth += 1)) $year


2741

--------------------------------------------------

WinXP:

To do the same thing on WinXP, you need Samurize and Cygwin. Samurize provides the ability to display output on the desktop like GeekTools and Cygwin will provide the cal program. When installing Cygwin, however, make sure to select the package linux-util because it is not installed by default.

A slight modification to the script is needed in order to run a shell script from outside of Cygwin (such as from the command prompt or "run" from the start menu):


#!/bin/sh
PATH=/cygdrive/c/cygwin/bin
nextmonth=`date '+%m'`
year=`date '+%Y'`
nextmonth=`echo $nextmonth|sed 's/^0*//'`
if [ $nextmonth -eq 12 ]; then
nextmonth=0
year=$((year + 1))
fi
cal $((nextmonth += 1)) $year


4931

--------------------------------------------------

Linux:

On Linux, the program to use is Conky. Create the following .conkyrc file in your home directory:


# .conkyrc

text_buffer_size 512

update_interval 1.0

double_buffer yes
own_window yes
own_window_hints undecorated, sticky, below, skip_pager, skip_taskbar
own_window_transparent yes

use_xft yes
xftfont Bitstream Vera Sans:size=8

maximum_width 512
default_color white
alignment top_left
gap_x 10

uppercase no

TEXT
${font monospace:size=8}${execi 8600 cal}
${font monospace:size=8}${execi 8600 nextmonth.sh}


4929

No comments:

Post a Comment