xrandr and similar tools will print information about the various graphics ports available on a machine. However, there doesn’t seem to be a simple and reliable way to detect which one of them is the “native” or built-in display. Whether something is built in is a bit vague anyway, and in case of desktop machines there is no built-in display, but if there’s a well-defined way to detect it it would be useful for swapping between built-in and external monitors.


As a general rule of them (from this question, as well as personal experience with xrandr on laptops), laptops will either use eDP1 or LVDS1 as their '"native" or built-in display.' Here is a bit of demystification from wikipedia: eDP1 stands for embedded display port.

If you are looking for a way to script this behavior so you can easily swap automatically when, for example, an external monitor is plugged in, check out the example script in the xrandr entry for Arch linux.

The Arch page provides a nice example script (you will have to set your variables yourself) that you can name, for example, check_displays.sh. Then, as long as it is executable (chmod +755 check_displays.sh), you can run it whenever you connect your displays to easily toggle them. You will have to manually run them, however, unless you have a script that will automatically monitor for changes.

For example, if you want something that will automatically monitor for changes in your inputs, the accepted solution to this question provided a script (albeit a somewhat hacky one) to apply preconfigured changes when a new output was detected.

Lastly, if you would like to output on all connected displays in the simplest way possible, you can run xrandr --auto . This comes from man xrandr:

--auto For connected but  disabled  outputs,  this  will
          enable them using their first preferred mode (or,
          something close to 96dpi if  they  have  no  pre‐
          ferred  mode).  For disconnected but enabled out‐
          puts, this will disable them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.