Search code examples
macosx11xtermxmgrace

How to I set the default startup window size for an X11 application (such as xmgrace)


I've been trying to run through the .Xresources method, with no success (see comment here from a related question)

So what do I need to modify to make sure my Xmgrace window is of a particular size? When I run xmgrace myplot.agr it always ends up as a 680x700 window. I would like to set it to something different, as I always end up having to resize and click-scroll (Xmgrace does not like scroll-wheels).

Any thoughts or ideas most welcome.


Solution

  • Per comments (and source), you could set the size and position of xmgrace in your $HOME/.Xdefaults file:

    XMgrace*geometry: 1050x750
    

    or (more specific)

    XMgrace*mainWin.geometry: 1050x750
    

    depending on how it uses the geometry resource during initialization.

    The FAQ does not give more than a hint of the available resources, but is pretty clear that the classname is XMgrace. To get a complete list of resources, you'd have to read the source-code, which (for instance) in /src/xmgrace.c has

    String fallbackResourcesHighRes[] = {
        "XMgrace*mainWin.width: 680",
        "XMgrace*mainWin.height: 700",
        "XMgrace*fontList:-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*",
        "XMgrace.consoleDialog*text.fontList:-*-courier-medium-r-normal-*-12-*-*-*->
        "XMgrace*HContainer.marginHeight: 3",
        "XMgrace*VContainer.marginHeight: 3",
        NULL
    };
    

    It decides to use that based on the screensize:

    screen = DefaultScreenOfDisplay(disp);
    if (HeightOfScreen(screen) < 740) {
        lowres = TRUE;
    }
    

    and (seeing no command-line arguments in the source) is configurable only using X resources. The -geometry option is a standard X toolkit option, used by other programs such as xterm.