如何为 X11 应用程序(例如 xmgrace)设置默认启动 window 大小

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

我一直在尝试 运行 通过 .Xresources 方法,但没有成功(请参阅相关问题的评论 here

那么我需要修改什么以确保我的 Xmgrace window 具有特定的大小?当我 运行 xmgrace myplot.agr 它总是以 680x700 window 结束。我想将它设置为不同的东西,因为我总是不得不调整大小并单击滚动(Xmgrace 不喜欢滚轮)。

欢迎提出任何想法或建议。

根据评论(和来源),您可以在 $HOME/.Xdefaults 文件中设置 xmgrace 的大小和位置:

XMgrace*geometry: 1050x750

或(更具体)

XMgrace*mainWin.geometry: 1050x750

取决于它在初始化期间如何使用 geometry 资源。

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,其中(例如)在 /src/xmgrace.c 中有

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
};

根据屏幕大小决定使用那个:

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

and(在源代码中看不到命令​​行参数)只能使用 X 资源进行配置。 -geometry 选项是一个标准 X toolkit option,被 xterm 等其他程序使用。