I got a GUI program which will be executed along the OS (CentOS 6.6) boots.

The resolution configuration is programmed in the init part of the GUI program, my solution right now is get the resolution sets of the monitor using xrandr and parse the result and set it to one of the candidates, you can choose one of them in the Preferences part of the GUI program later. But xrandr won't work if no monitor is plugged in, right?

If I got no monitor plugged into the box, that means I have no idea what the resolution sets one monitor can provide, so now what I want is, if I turn on the computer, and the GUI program will be executed, after plugging a monitor later, I can see the GUI program already loaded in the monitor.

I mean I want the resolution fixed (1152x864 75.0Hz, for example) in the GUI program init part using some commands or APIs if no monitor plugged?

Does anyone know anything about the available commands or APIs?

1 Answer 1


From the xrandr man page:

--fb widthxheight Reconfigures the screen to the specified size. All configured monitors must fit within this size. When this option is not provided, xrandr computes the smallest screen size that will hold the set of configured outputs; this option provides a way to override that behaviour.

Try below without monitor connected -

xrandr --fb 1280x800

  • Does not work for me
    – jan
    Oct 29, 2020 at 9:48
  • Worked like charm in Ubuntu-Mate v22.04 May 23, 2022 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .