我破解了nvidia-settings源,并得到了一个可行的解决方案:
这是在Ubuntu中完成的,但移植起来并不难。
运行以下命令:
sudo apt-get build-dep nvidia-settings
apt-get source nvidia-settings
cd nvidia-settings-195.36.08/src
编辑“ nvidia-settings.c”,并将main()替换为:
int main(int argc, char **argv)
{
ConfigProperties conf;
ParsedAttribute *p;
CtrlHandles *h;
char * target;
/* initialize the parsed attribute list */
p = nv_parsed_attribute_init();
/* initialize the ConfigProperties */
init_config_properties(&conf);
/* allocate the CtrlHandles for this X screen */
h = nv_alloc_ctrl_handles(":0.0");
if (!h || !h->dpy) {
return 1;
}
/* Get target from command line */
if(argc != 2){
printf("Usage: %s PRIMARY_DISPLAY\n", argv[0]);
printf("Example: %s DFP-1\n");
return 1;
}
target = argv[1];
int i;
for (i = 0; i < h->targets[X_SCREEN_TARGET].n; i++) {
if (h->targets[X_SCREEN_TARGET].t[i].h) {
printf("Setting primary display: %s\n", target);
NvCtrlSetStringAttribute(h->targets[X_SCREEN_TARGET].t[i].h, NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER, target, NULL);
break;
}
}
return 0;
} /* main() */
编译:
cd ..
make
将二进制文件放在路径中:
sudo cp nvidia-settings /usr/local/bin/setPrimaryDisplay
用它:
setPrimaryDisplay DFP-1
gnome-panel --replace 2>/dev/null &
其中DFP-1是所需的diaplay显示的名称。Gnome面板跟不上时代,需要重新启动。
您可以在此处下载为amd64编译的二进制文件:http : //while1.no/files/setPrimaryDisplay