디스플레이의 해상도를 변경하거나, 디스플레이의 정보를 확인할 때 사용할 수 있다.

해상도 가져오기

$ xrandr    
Screen 0: minimum 8 x 8, current 5120 x 1440, maximum 32767 x 32767
DVI-D-0 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+
   1920x1440     60.00  
   1920x1200     59.95  
   1920x1080     60.00  
   1680x1050     59.95  
   1600x1200     60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1152x864      60.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   640x480       75.00    72.81    59.94  
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DVI-D-1 connected 2560x1440+2560+0 (normal left inverted right x axis y axis) 597mm x 336mm
   2560x1440     59.95*+
   1920x1440     60.00  
   1920x1200     59.95  
   1920x1080     60.00  
   1680x1050     59.95  
   1600x1200     60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1152x864      60.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   640x480       75.00    72.81    59.94  
VGA-1-1 disconnected (normal left inverted right x axis y axis)
HDMI-1-1 disconnected (normal left inverted right x axis y axis)
HDMI-1-2 disconnected (normal left inverted right x axis y axis)

xrandr의 man페이지를 보면 다음과 같은 구절을 확인할 수 있는데,

If invoked without any option, it will dump the state of the outputs, showing the existing modes for each of them, with a ‘+’ after the preferred mode and a ‘*’ after the current mode.

그러니까 저 해상도 중에 *이 붙은 것이 있다면 그게 지금 해상도라고 보면 되겠다.

특히나 이 명령어의 중요한 점은 꼭 현재 디스플레이가 아니라, xvfb를 사용해 만든 가상 프레임버퍼에도 적용할 수 있다는 것이다. 어떤 어플리케이션을 가상 프레임버퍼에서 실행한 후 전체화면으로 전환하여 해당 디스플레이의 해상도가 변경되었다면, 이 명령어를 통해 추적할 수 있다는 것.

$ Xvfb :99 -screen 0 320x240x16 &
[1] 10189

$ DISPLAY=:99 xrandr | grep "*"
xrandr: Failed to get size of gamma for output screen
   320x240        0.00*