Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : project: clock for iLiad


yokos
09-06-2007, 05:08 AM
Who wants to have a digital clock for iLiad Screen?

Right now, you can choose between top left and top right position.

In ipdf the clock disappears when you switch page, but comes back when a new minute starts. ipdf is the only app which behaves like this.
************************************************** *******************
A simple digital clock for iLiad
************************************************** *******************

Preparation:
[1] Extract directory "gtkclock.install" from zip-file to CF/MMC/SD
Please dont' use iLiad's Main Memory.
[2] Insert memory card into iLiad, if you used one in previous step

Installation:
[1] Search for "Install Simple Digital Clock" in Contentlister
[2] Click on this entry to install app
[3] This takes a while. Blinking of LED stops when finished, you will get a "Installed message"

Usage:
[1 ] Go to the progams folder
[2] Load the clock with the entry "Simple Digital Clock"
you can choose between top left and top right position
[2] Click with stylus on the "Quit Simple Digital Clock" to exit programm

In most cases iLiad's time is not correct local time.
You can set time with shell command date [not for Average Joe please],
or wait for firmware 2.11, this offers time-zone-switching I heard on MR. Is this true?
scotty1024 posted a time zone switcher. Still working?

Optional:
You can install cover images & manifest.files for the programs folder with the included dir "icons.install".
preparation/installation as above described. It's just a visual gimmick, have a look at screenshot programs.png
for reference.
Ok, 2.11 with time zone switcher is nearly out.

Ok, one of GTK+ clocks I have tried so far is running. It's the digital clock gtkclock (http://sourceforge.net/projects/gtkclock/). 120 lines of source code or so.

The main crux I have noticed iLiad's pdf viewer ipdf lays above all windowed apps therefore they get "invisible". I have to click on the last known position of gtkclock then it get's "visible" again. Interesting the "dialog-hint bar" with x-button is gone.

This 1-update-per-second makes me nervous. But tweaking g_timeout_add(1000, (GSourceFunc) clock_update, (gpointer) &d); should solve this. Still some work to do. I'm working on port of an analogue clock, too.

Another problem: iLiad's time zone from iDS isn't the correct local time. It's not fair to say to Average Joe: set time with command date. Scotty1024 has posted a time zone switcher long time ago.

You can find scr here (http://projects.mobileread.com/iliad/users/yokos/). The tar.gz file is src file.

Application Options:
-F, --font=FN font (fontconfig) to be used
-f, --foreground=FG foreground color
-b, --background=BG background color
-t, --format=FORMAT time format (strftime format string)

You can tweak the file CF-Card/Programs/gtkclock.tr/run.sh.

Information about this code are welcome:
gtk_window_set_gravity(GTK_WINDOW(d.window), GDK_GRAVITY_SOUTH_WEST);
I didn't get it to work. :smash: It is needed for bottom position.

explanation of screenshots:
#1: gtkclock/mobipocket viewer
#2: gtkclock/ipdf
#3: gtkclock/GNU Chess
#4: gtkclock [first version, never published here, moved with stylus to bottom left]/mobipocket viewer

tribble
09-06-2007, 05:27 AM
Time zone setting will be in one of the next updates, so it should be easy to set the timezone for the user then.

Is the clock configurable? I would like to have a tiny clock with no background and no second and a gray font.

yokos
09-06-2007, 06:03 AM
Time zone setting will be in one of the next updates, so it should be easy to set the timezone for the user then.
Oh, that's cool.

Is the clock configurable? I would like to have a tiny clock with no background and no second and a gray font.
YES! :D
Usage:
gtkclock [OPTION...] - a simple digital clock

Help Options:
-?, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options

GTK+ Options
--class=CLASS Program class as used by the window manager
--name=NAME Program name as used by the window manager
--screen=SCREEN X screen to use
--sync Make X calls synchronous
--gtk-module=MODULES Load additional GTK+ modules
--g-fatal-warnings Make all warnings fatal

Application Options:
-F, --font=FN font (fontconfig) to be used
-f, --foreground=FG foreground color
-b, --background=BG background color
-t, --format=FORMAT time format (strftime format string)
--display=DISPLAY X display to use

[EDIT:] With ./bin/gtkclock --format=%H:%M I get a clock with hour & minutes only.

tribble
09-06-2007, 06:21 AM
OK, i want it :)
Is it refreshing the screen automatically? Do you have it do a partial refresh? I t would be great if it sops updating the screen, if no buttons have been pressed for a while.
Updates every 10 minutes would suffice for me. Would be great if that could be configured aswell :D
Cant wait to get my hands on it.
Thanks for your work mate.

yokos
09-06-2007, 06:26 AM
It updates partial of screen. It uses Antartica's patched libX11.so.6 like all Adam B. ports.
With hh:mm it updates with every new minute.

yokos
09-06-2007, 06:48 AM
Hey tribble. You wanted grey font. This works this way:
./bin/gtkclock --format=%H:%M --foreground=grey --background=white

What is the name of local screen of a GtkWindow?
I get
(clock:1484): Gtk-WARNING **: gtk_migration not initialised yet

(clock:1484): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(clock:1484): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
Segmentation fault when trying to give the GTK window a name.

This is the most interesting option:
--class=CLASS Program class as used by the window manager Right now I have hard encoded in sourcecode that it should behave as "GDK_WINDOW_TYPE_HINT_DIALOG".

yokos
09-19-2007, 09:08 AM
I have uploaded first binary. :)

Adam B.
09-19-2007, 09:15 AM
or wait for firmware 2.11, this offers time-zone-switching I heard on MR. Is this true?
scotty1024 posted a time zone switcher. Still working?

Yes and Yes. :)

Very cool, does it support the 12 hour format?

Edit: Nevermind, I guess I can do my own research. ;)

To get a 12 hour clock, launch it with: "gtkclock --format=%I:%M"

This page may be useful for some: http://linux.die.net/man/3/strftime

tribble
09-19-2007, 03:05 PM
Works like a charm. Thanks alot. Love the clock.

Adam B.
09-20-2007, 02:36 PM
Does:

gtk_window_move(GTK_WINDOW(d.window), 700, 1024);

work on the iLiad?

Also, this program should be very easy to compile and make manual screen refreshes without requiring external libs. I can put together a little code tutorial if you'd like...

Adam B.
09-20-2007, 03:08 PM
Can someone test this?

If I did everything right, it should run without any external libraries, do it's own refreshes, and be in the lower right hand corner.

I've even stripped it so at 65KB it could be installed to root without a problem.

I'm also uploading the modified source (rename to gtkclock.c) and Makefile (The changes are in "DEPS_LIBS") so you can review the code changes.

Adam B.
09-20-2007, 04:48 PM
Here's another update that needs to be tested. I've added the ability to select which corner of the screen you would like it to appear on with a command line switch.

Application Options:
-F, --font=FN font (fontconfig) to be used
-f, --foreground=FG foreground color
-b, --background=BG background color
-t, --format=FORMAT time format (strftime format string)
-l, --location=LOCATION screen location (tl - top left, tr - top right, bl - bottom left, br - bottom right)
--display=DISPLAY X display to use

For example, if you want it to show up on the top right corner, you'll run

./gtkclock --location=tr

I haven't tested it on the iLiad, but it works on my pc.

I'm including the source as well.

Can someone test it and let me know if it works. I still don't have shell access on my iLiad.

-Adam

yokos
09-21-2007, 06:40 AM
Hey Adam B.,

I get (gtkclock:859): Gtk-WARNING **: gtk_migration not initialised yet
Segmentation fault when typing:
./gtkclock -l=tr

Adam B.
09-21-2007, 06:45 AM
Hey Adam B.,

I get "segmentation fault" when typing:
./gtkclock

Are you sure that no links to libraries are needed?

Pretty sure. Is this with the first or second post?

yokos
09-21-2007, 07:01 AM
Oh, Adam anwered an older version of my post.
The more detailed ouput is 2 post above this one. [of course the lastest version :p]
I get

(gtkclock:859): Gtk-WARNING **: gtk_migration not initialised yet
Segmentation fault
when typing


./gtkclock -l=tr

Adam B.
09-21-2007, 07:05 AM
I'm seeing that in my test area too. Not sure why it worked yesterday.

Try the attachment in post #12. That should work without any extra libs and should do it's own refreshes.

Adam B.
09-21-2007, 07:43 AM
I think I fixed the segfault. Let me know.

yokos
09-21-2007, 07:52 AM
Rebooting right now. Running shell script via Contentlister: got some "freezing".

yokos
09-21-2007, 07:56 AM
./gtkclock in mrxvt -> clock in top left pos is running.

export DISPLAY=:0
export scriptdir=`/usr/bin/dirname $0`
cd $scriptdir
./gtkclock --location=br --format=%H:%M --foreground=black --background=white as run.sh/CL doesn't finish blicking LED.

Adam B.
09-21-2007, 07:58 AM
./gtkclock in mrxvt -> clock in top left pos is running.

Updating automatically without the hacked libx11? How about using the --location=tr?

yokos
09-21-2007, 08:03 AM
Updating automatically without the hacked libx11?
QUOTE]
Yep, updates every second [because of hh:mm:ss]
[QUOTE=Adam B.;99004]Updating automatically without the hacked libx11? How about using the --location=tr?
Rebooting.:knife:

Adam B.
09-21-2007, 08:05 AM
Yep, updates every second [because of hh:mm:ss]

Rebooting.:knife:

Don't you have dropbear installed on the iLiad? It really makes life easier...

yokos
09-21-2007, 08:08 AM
Don't you have dropbear installed on the iLiad? It really makes life easier...
I'm in the library - one network cable only/WLAN PCMCIA card at home. :smash:

[./gtkclock -l=tr] is working. Seconds of hh:mm:ss are out of screen.

Adam B.
09-21-2007, 08:13 AM
I'm in the library - one network cable only/WLAN PCMCIA card at home. :smash:

[./gtkclock -l=tr] is working. Seconds of hh:mm:ss are out of screen.

Damn, that sucks...

How about -l=bl and -l=br as well? That's what I'd use the most.

yokos
09-21-2007, 08:16 AM
Damn, that sucks...

How about -l=bl and -l=br as well? That's what I'd use the most.
both -l=bx are not working.

(gtkclock:852): Gtk-WARNING **: gtk_migration not initialised yet

(gtkclock:852): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(gtkclock:852): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
Segmentation fault

Is "screen" the same as one of gtkclock options'?

Adam B.
09-21-2007, 08:27 AM
I don't think so, that seems to be an internal variable...

I wonder why the top works, but not the bottom. Odd. I'll probably have to troubleshoot that when I can test on my own iLiad.

yokos
09-24-2007, 09:18 AM
A problem is that the app which is lying above the toolbar/pagebar gets kickout out of this area from time to time. I recognized this behaviour using the GUI mpd client Gimmix.
I don't know if setting "gtk window not moveable" or so could fix it.

The analogue clock xonclock [still stuggles a bit] has got many options to set the pos of screen. I will have a look at it & hopefully learn something.

ddavtian
10-22-2007, 11:24 AM
Hi guys.

Is there a version for somebody who only knows how to install applications on iLiad (click on the install icon :-) and doesn't know how to submit linux commands on it?

I'd love to have this clock.

Thanks, David

templario
10-22-2007, 02:00 PM
This is already the average Joe version, i have no idea of linux and i tried this one without problems, just run from the content lister.

wallcraft
10-22-2007, 03:02 PM
This is already the average Joe version, i have no idea of linux and i tried this one without problems, just run from the content lister. Did you install gtkclock.0.1.zip from the 1st post? This seems to be the only one with a manifest etcetera. if I follow the discussion correctly, some of Adam B.'s later versions could be installed much more simply (no need for a gtkclock.install phase). But perhaps they are not yet ready for general use, or need to be copied on top of the gtkclock.0.1 version.

ddavtian
10-22-2007, 06:37 PM
I installed the clock from the first post and it worked for Joe.
Thanks a lot for application and for help.