Re: gdm and display size
On Mon, Apr 07, 2003 at 02:32:59PM -0400, Matthew Weier O'Phinney wrote:
> This is where it gets a little dicey. One machine I wish to log on from
> is an old P-120 laptop with a 640x480 display; my other displays are all
> 1024x768.
>
> Is it possible to detect the resolution of the display on which the
> xdmcp server is drawing? If so, how? I'd like to write a script that
> would load different defaults based on display size.
Yes: you can get it from xdpyinfo. If you want something that requires a
bit less parsing, then try this quick C program or a variant that suits
your needs. It's very stupid and doesn't understand -display arguments
or multiple screens or anything like that, but it may help. Compile with
'gcc -L/usr/X11R6/lib -lX11 dpysize.c -o dpysize'.
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
int main (int argc, char *argv[])
{
Display *dpy = XOpenDisplay (NULL);
if (!dpy) {
fprintf (stderr, "%s: unable to open display \"%s\"\n",
argv[0], XDisplayName (NULL));
exit (1);
}
printf ("width: %d\n", DisplayWidth (dpy, 0));
printf ("height: %d\n", DisplayHeight (dpy, 0));
return 0;
}
Cheers,
--
Colin Watson [cjwatson@flatline.org.uk]
Reply to: