Community-driven coverage of elementary OS — news, guides & forums
Dark abstract low-poly geometric landscape with layered triangular facets in deep navy, charcoal, and muted teal, illuminated by a soft electric-blue glow near the horizon

News roundups, tutorials, application guides, and forums — built by users, for users of the elegant Linux distribution.

elementary weekly
#20
Latest roundup · 18 Apr 2015
Freya Release
Final
Covered in weekly #19 & #20
Forum Topics
Active
Installation, customization & more

Managing Multiple Monitors on elementary OS with xrandr

A second display can make an elementary OS workstation far more practical. You might keep a terminal and documentation open beside your editor, use a larger monitor with a laptop in Melbourne, or connect a projector for a community presentation in Brisbane. The desktop settings panel handles common arrangements, while xrandr provides precise control over output names, resolutions, positions, rotation, and scaling.

xrandr is a command-line utility for inspecting and changing display settings on an X11 session. It is especially useful when a monitor is detected with the wrong resolution, an external screen appears on the wrong side, or a saved layout behaves differently after docking. The commands below focus on reliable, reversible changes that suit both new Linux users and experienced elementary OS users.

Check Your Display Session

Before changing anything, confirm that elementary OS is running an X11 session. xrandr communicates with the X server, so it may not control displays in a Wayland session. Run:

echo $XDG_SESSION_TYPE

If the result is x11, continue with xrandr. If it reports wayland, the command may return an error or show limited information. The exact display technology used by a future elementary OS release can vary, so check the session type rather than assuming that every installation behaves identically.

Now list the connected outputs and available modes:

xrandr --query

A typical result may include names such as eDP-1 for a built-in laptop panel, HDMI-1 for an HDMI monitor, and DP-1 for a DisplayPort connection. The output names are case-sensitive and can differ between computers. Avoid copying an example command until you have checked your own names.

The query also shows the current resolution, refresh rate, connection status, and supported modes. A line marked connected identifies an active or available display, while disconnected indicates that the connector is not currently in use. Keep this output available when troubleshooting because it reveals whether the issue is software configuration, a missing mode, or a physical connection.

Understand Outputs And Layouts

The simplest multi-monitor arrangement places one display beside another:

xrandr --output HDMI-1 --auto --right-of eDP-1

This enables the HDMI monitor at its preferred mode and positions it to the right of the laptop screen. To place it on the left, use --left-of; --above and --below are also available. The primary display can be selected separately:

xrandr --output eDP-1 --primary

The primary monitor generally receives the panel, login prompts, notifications, and newly opened windows. It does not have to be the physically largest display. A laptop user in Sydney may prefer the built-in panel as primary while using a larger desk monitor for reference material, whereas a desktop user may designate the high-resolution external display as the main workspace.

For a mirrored presentation, use:

xrandr --output HDMI-1 --same-as eDP-1

Mirroring is useful for a meeting room projector or classroom screen, although different aspect ratios can introduce unused space or stretching. To return to an extended desktop, apply a relative placement again. To disconnect an output logically, use:

xrandr --output HDMI-1 --off

A command affects the current session immediately. It does not necessarily survive a reboot, cable change, or login. Test the layout for a few minutes before adding it to startup, especially when using a projector or an older monitor with limited resolution support.

Set Resolution, Refresh Rate, And Position

When the preferred mode is not appropriate, specify one directly:

xrandr --output HDMI-1 --mode 1920x1080 --rate 60

The requested mode must appear in the output of xrandr --query. If 1920x1080 is absent, the monitor, adapter, cable, graphics driver, or display server may not be offering it. A USB-C dock can also expose different capabilities from a direct HDMI connection, so compare results with and without the dock where possible.

You can combine resolution and positioning:

xrandr --output eDP-1 --mode 1920x1080 \
       --output HDMI-1 --mode 2560x1440 --right-of eDP-1

Long commands can be split with a backslash, but each continued line must be copied carefully. If the displays have different heights, elementary OS will still create a rectangular virtual desktop. Some portions around the smaller panel may be unreachable, which is normal. Windows can also open at an unexpected location if the primary display changes.

Refresh rate matters for motion, gaming, video editing, and eye comfort. List modes with:

xrandr | grep -E 'connected|[0-9]+x[0-9]+'

Use the rate shown beside the desired mode, such as 60.00, 75.00, or 120.00. A high refresh rate may disappear when using an inexpensive adapter or an older HDMI cable. In the Australian market, budget monitors and USB-C hubs sold through large electronics retailers often advertise broad compatibility, but their actual refresh options can depend on the laptop port and hub chipset.

Rotate And Scale The Desktop

Rotation is helpful for a portrait monitor used for coding, documents, or long web pages:

xrandr --output HDMI-1 --rotate left --right-of eDP-1

Valid values include normal, left, right, and inverted. A portrait display may need to be positioned above or beside the primary screen after rotation. To restore its normal orientation:

xrandr --output HDMI-1 --rotate normal

Scaling requires more care. A basic example enlarges the rendered image:

xrandr --output HDMI-1 --scale 1.25x1.25

Scaling can make text and interface elements easier to read, but it may produce a soft image or uneven pointer movement. A high-DPI laptop panel beside a standard external monitor is a common reason to experiment with scaling. --scale-from can request a particular logical size, although results vary with the desktop shell and graphics hardware.

For a cleaner result, start with the native resolution and adjust application font sizes before applying display scaling. Mixed-DPI setups are particularly sensitive: one screen may look sharp while the other appears blurry, and dialog boxes may be placed awkwardly across the boundary. Reset scaling with:

xrandr --output HDMI-1 --scale 1x1

If scaling leaves the display unusable, switching to another virtual terminal with Ctrl + Alt + F3, logging in, and running the reset command can recover the session on many systems. Return to the graphical session with the relevant function key, which varies by hardware.

Save A Repeatable Monitor Profile

Because xrandr changes are temporary, store a tested command in a small script. Create a directory for personal scripts and open a file:

mkdir -p ~/.local/bin
nano ~/.local/bin/work-displays

Add commands suited to your machine:

#!/bin/sh
xrandr --output eDP-1 --primary --mode 1920x1080
xrandr --output HDMI-1 --mode 2560x1440 --right-of eDP-1

Save the file, then make it executable:

chmod +x ~/.local/bin/work-displays

Run it manually with:

~/.local/bin/work-displays

This approach is easy to adjust when moving between a home desk in Perth and an office setup in Adelaide. It also keeps the configuration readable, rather than hiding several display changes inside an obscure command history. Use your real output names and remove any line for a monitor that is not always connected.

To launch the script when you log in, create an autostart entry:

mkdir -p ~/.config/autostart
nano ~/.config/autostart/work-displays.desktop

Use:

[Desktop Entry]
Type=Application
Name=Work Displays
Exec=/home/your-name/.local/bin/work-displays
Terminal=false
X-GNOME-Autostart-enabled=true

Replace your-name with the actual home directory name. Autostart can run before a dock or monitor is ready, so a short delay may help. One option is to change Exec to:

Exec=sh -c 'sleep 5; /home/your-name/.local/bin/work-displays'

Only automate a layout after testing it repeatedly. If the script references a disconnected output, xrandr may fail partway through, leaving the arrangement incomplete.

Troubleshoot Detection And Recovery

If a monitor does not appear in xrandr --query, start with the physical path. Reseat both ends of the cable, select the correct input on the monitor, and test another cable or port. For laptops, check whether the USB-C port supports DisplayPort Alt Mode; not every USB-C socket carries video. A dock may require its own power supply, firmware, or DisplayLink software.

Graphics drivers are another factor. Confirm that the system is fully updated through the normal elementary OS tools, then reboot and inspect the display list again. Avoid installing a random binary simply because a web page promises a quick fix. When a guide points to an unofficial software download, treat it as untrusted: prefer AppCenter, Ubuntu-compatible repositories, the hardware vendor, or a well-known project page, and never run an unknown installer with administrator privileges.

A monitor may be detected but lack the desired resolution. Check the complete mode list and try a lower refresh rate. If the monitor supports the mode but the graphics stack does not advertise it, creating a custom modeline is possible, though it should be a last resort:

cvt 1920 1080 60

The command prints a modeline. You can then use xrandr --newmode, --addmode, and --mode, but custom timings can cause a blank screen or an unstable signal. Record the original configuration first and keep a recovery terminal available.

For a black screen after applying a command, wait briefly, use Ctrl + Alt + F3, log in, and reset the affected output:

DISPLAY=:0 xrandr --output HDMI-1 --auto --scale 1x1 --rotate normal

The DISPLAY value may differ in unusual sessions. If that fails, remove or rename the autostart file and log in again. Rebooting also clears temporary xrandr settings in most standard configurations.

Choose The Right Method For Your Setup

The graphical display panel is the best starting point for ordinary tasks such as selecting a resolution, choosing a primary monitor, or arranging two screens. It gives immediate visual feedback and reduces typing errors. Use xrandr when the graphical interface does not expose a needed option, when you regularly switch between known layouts, or when you need a script for a docked laptop.

A utility such as ARandR can provide a visual front end that generates xrandr commands. It may be convenient for experimenting with positions, but it does not remove the need to understand connector names and display-server limitations. A scripted profile is usually more dependable once the layout is known.

Task Recommended method Useful command or setting Main caution
Set a basic two-screen layout Display settings Arrange displays graphically Layout may reset after docking
Inspect connectors and modes xrandr xrandr --query Names differ between computers
Place a monitor beside another xrandr --right-of, --left-of Check the reference output
Mirror a laptop and projector Display settings or xrandr --same-as Aspect ratios may differ
Use portrait orientation xrandr --rotate left or right Reposition after rotation
Repeat a home or office layout Shell script ~/.local/bin/work-displays Disconnected outputs can cause errors
Solve missing hardware detection Cable, driver, and dock checks Inspect xrandr --query again USB-C video support is not universal

For an elementary OS user who changes locations frequently, keep separate scripts such as home-displays, office-displays, and projector-displays. Give each one a clear name and test it while the relevant hardware is connected. This is less frustrating than trying to build one highly complex script that predicts every possible monitor combination.

Build A Reliable Daily Workflow

Begin each new setup by running xrandr --query and identifying the actual output names. Apply the smallest command that solves the problem, such as enabling a monitor with --auto or placing it with --right-of. Avoid changing resolution, scaling, rotation, and refresh rate all at once unless you are deliberately testing a complete profile.

After the arrangement works, check practical details: move the pointer across the boundary, drag a window between screens, open the application menu, and verify that notifications appear on the display you expect. Try sleep and wake as well as unplugging and reconnecting the cable. These tests catch problems that are invisible immediately after the first command.

Keep a copy of any working script in your home directory and record the monitor model, cable type, and preferred mode in a comment. A concise profile might include:

# Laptop panel plus 27-inch QHD monitor
xrandr --output eDP-1 --primary --auto
xrandr --output HDMI-1 --mode 2560x1440 --right-of eDP-1

The most dependable next step is to run xrandr --query, copy the exact connected output names, and test one layout command before saving it as a startup script.

Browse the News Archive
Latest Updates

From the elementary weekly series

Low-poly faceted abstract render in dark charcoal and electric blue tones, suggesting a news bulletin or announcement
elementary news

elementary weekly #20

The first week with the final Freya release — community reactions, tips, and early impressions gathered in one roundup.

Abstract low-poly geometric scene in midnight blue and soft cyan, conveying a live broadcast or event atmosphere
elementary news

elementary SPECIAL

A live Hangouts event with the elementary OS founders, held on 11 April 2015, discussing the Freya final release.

Low-poly faceted render in deep navy and muted teal with subtle amber highlights, suggesting a tutorial or guide
Tips and Tricks

Timeshift Guide

How to use Timeshift — the intuitive system restore utility for elementary OS — to recover from configuration mishaps.

Explore

Topics & Resources

Dive into guides, application recommendations, and community discussions covering every aspect of elementary OS.