LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Very Tiny Xclock programme? (https://www.linuxquestions.org/questions/programming-9/very-tiny-xclock-programme-4175604681/)

Xeratul 04-26-2017 01:01 PM

Very Tiny Xclock programme?
 
Hello,

I have several xclock (x11 clock) from GIT, but I am still looking for the tiniest one.

I would like of course to learn from it, and it has a learning step for me in mind.

Would you have a tiny xclock in mind, whatever analog or digital, the tiniest the best.

The idea would to put it down, as well, as does the xlock (x11 by default). xclock -digital -geometry -0-0

Thank you.

(My desktop: evilwm forked)

BW-userx 04-26-2017 06:56 PM

Quote:

Originally Posted by Xeratul (Post 5702550)
Hello,

I have several xclock (x11 clock) from GIT, but I am still looking for the tiniest one.

I would like of course to learn from it, and it has a learning step for me in mind.

Would you have a tiny xclock in mind, whatever analog or digital, the tiniest the best.

The idea would to put it down, as well, as does the xlock (x11 by default). xclock -digital -geometry -0-0

Thank you.

(My desktop: evilwm forked)


why do you not get the source code for the smallest one you got, then find the dimensions and change them to make it smaller, then recompile it?

ondoho 04-27-2017 12:55 AM

http://projects.l3ib.org/lal/

Xeratul 04-27-2017 12:59 AM

apt-get source x11-apps
and into xclock

I changed one part of Clock.c to the following:
Quote:

static char *
TimeString (ClockWidget w, struct tm *tm)
{
static char brief[6];
sprintf (brief, "TEST %02d:%02d", tm->tm_hour, tm->tm_min);
return brief;
}
loaded with xclock -digital -geometry -0-0

it gives what I want.

I wonder why such a simple clock, digital, in less than 150 -1000 lines is not yet existing. This is a simple X11 lib use and gcc.

ondoho 04-27-2017 01:11 AM

http://projects.l3ib.org/lal/files/lal-1.1.tar.gz
300 lines, including empty lines, nice formatting, and a summary of the GPL.
i'm sure you could squeeze that to less than 150.

Xeratul 04-27-2017 10:33 AM

Quote:

Originally Posted by ondoho (Post 5702814)
http://projects.l3ib.org/lal/files/lal-1.1.tar.gz
300 lines, including empty lines, nice formatting, and a summary of the GPL.
i'm sure you could squeeze that to less than 150.

likely, pitty that it is not so simpler, ... just x11 text...

Anytime, thank you very muuccccchhh

Strange that there isnt a tiny simple clock for education prgramming purpose, yet (sprintf), since Xfree86 and co. exists.

eg:
Code:

        XFillRectangle(d, w, DefaultGC(d, s), 20, 20, 10, 10);
        XDrawString(d, w, DefaultGC(d, s), 10, 50, msgtime , strlen(msgtime));
        usleep( 20e-6 );



All times are GMT -5. The time now is 10:24 AM.