首页 > 代码库 > Use xrandr for multiple screen display

Use xrandr for multiple screen display

Gnome 3 does not have good support for multiple screen display. It is therefore necessary to use xrandr for such purpose. It can be used as follows.

Display the configurations:

$ xrandrScreen 0: minimum 8 x 8, current 1680 x 1050, maximum 16384 x 16384VGA-0 disconnected (normal left inverted right x axis y axis)LVDS-0 connected (normal left inverted right x axis y axis)   1920x1080      60.0 +   50.0DP-0 disconnected (normal left inverted right x axis y axis)DP-1 disconnected (normal left inverted right x axis y axis)DP-2 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 474mm x 296mm   1680x1050      60.0*+   60.0   1600x1000      60.0   1440x900       75.0     59.9   1280x1024      75.0     72.0     60.0   1152x864       75.0   1024x768       75.0     70.1     60.0   800x600        75.0     72.2     60.3   640x480        75.0     72.8     59.9DP-3 disconnected (normal left inverted right x axis y axis)DP-4 disconnected (normal left inverted right x axis y axis)DP-5 disconnected (normal left inverted right x axis y axis)

Disconnect a display:

$ xrandr --output LVDS-0 --off         # This is the LCD of the laptop

Set mode of the external display:

$ xrand --output DP-2 --mode 1680x1050    # This is the external monitor in office$ xrand --output DP-2 --auto            # Or use automatic detection

After configuration, FVWM should be restarted. Or if needed, X server should be restarted.

[13620] At present, Gnome environment is used instead of FVWM or Sawfish. And three scripts have been created to change the monitor settings.

1. Only use the external monitor: extdisp.sh

#!/bin/bashxrandr --output DP-2 --mode 1680x1050 --primary --output LVDS-0 --off

2. Use two monitors, the external monitor as the primary monitor: dbldisp.sh

#!/bin/bash xrandr --output DP-2 --mode 1680x1050 --primary --right-of LVDS-0 --output LVDS-0 --auto

3. Use only laptop monitor: lapdisp.sh

#!/bin/bash xrandr --output DP-2 --off --output LVDS-0 --auto