The last and better version is on the last post.
From this first post to the next, describing my code from simple to complex.
Here is my simple calendar using gtkdialog:
Code: Select all
#!/bin/bash
buat_tombol(){
echo '
<button width-request="50" height-request="50" relief="2">
<label>'$1'</label>
<action>echo '$1' `date "+%B %Y"`</action>
</button>'
}
export -f buat_tombol
buat_perbaris(){
i=0
IFS=''
cal|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
#echo baris $i: "$line"
echo '
<hbox spacing="0">'
for j in {1..7};do
tgl=`echo "$line"|cut -d "," -f $j`
if [ "$tgl" == " " -o "$tgl" == " " -o "$tgl" == "" ];then tgl=" -";fi
buat_tombol "$tgl"
done
echo '
</hbox>'
((i++))
done
}
export -f buat_perbaris
#h_screen=`xwininfo -root|sed '/Height/!d;s/.* //'`
#<window height-request="'$h_screen'" width-request="360">
echo '
<window>
<vbox spacing="0">
<button relief="2">
<label>'"`date "+%B %Y"`"'</label>
</button>
'"`buat_perbaris`"'
</vbox>
</window>
'>gui_kalendermuks
gtkdialog -f gui_kalendermuks