YJWANG

[i3] i3 환경에서 해상도 자동으로 변경하기 (autorandr) 본문

00.OS

[i3] i3 환경에서 해상도 자동으로 변경하기 (autorandr)

왕영주 2021. 8. 3. 09:36

Autorandr은 hdmi등 외부 display 연결 및 해지 시 자동으로 설정된 resolution (해상도)를 불러와서 display 세팅을 맞춰주는 프로그램입니다.

 

i3에서 매 번 해상도 변경하는게 귀찮았는데 약 3개월 정도 사용해본 결과 편하게 사용하고 있습니다.

 

설치는 아래 github을 참고 부탁드리며 저는 Arch linux를 사용중이기 때문에 autorandr 패키지를 사용해서 설치했습니다.

https://github.com/phillipberndt/autorandr

 

사용법


 

autorandr은 profile 기준으로 동작합니다. 먼저 arandr이나 xrandr을 이용하여 display 세팅을 완료합니다.

아래는 arandr을 이용한 제 display 세팅 예시입니다.

 

상태 확인

$ xrandr --current
Screen 0: minimum 8 x 8, current 3640 x 2520, maximum 32767 x 32767
eDP1 connected primary 1920x1080+0+1440 (normal left inverted right x axis y axis) 310mm x 170mm
   1920x1080     60.03*+  59.93  
   1680x1050     59.88  
   1400x1050     59.98  
   1600x900      60.00    59.95    59.82  
   1280x1024     60.02  
   1400x900      59.96    59.88  
   1280x960      60.00  
   1368x768      60.00    59.88    59.85  
   1280x800      59.81    59.91  
   1280x720      59.86    60.00    59.74  
   1024x768      60.00  
   1024x576      60.00    59.90    59.82  
   960x540       60.00    59.63    59.82  
   800x600       60.32    56.25  
   864x486       60.00    59.92    59.57  
   640x480       59.94  
   720x405       59.51    60.00    58.99  
   640x360       59.84    59.32    60.00  
DP1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 700mm x 400mm
   3840x2160     60.00 +  30.00    29.97  
   2560x1440     59.95* 
   1920x1080     60.00    50.00    59.94  
   1680x1050     59.95  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1440x900      59.89  
   1280x800      59.81  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected 1080x1920+2560+0 left (normal left inverted right x axis y axis) 510mm x 290mm
   1920x1080     60.00*+
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   640x480       75.00    59.94  
   720x400       70.08  
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

 

display 세팅이 완료 됐다면 해당 설정을 저장합니다.

$ autorandr --save test-2mon
Saved current configuration as profile 'test-2mon'

 

저장된 profile을 확인합니다.

$ ls -l .config/autorandr/
drwxr-xr-x 2 yjwang yjwang 4096  6월 14 16:04 pangyo-1
drwxr-xr-x 2 yjwang yjwang 4096  6월  4 14:27 single
drwxr-xr-x 2 yjwang yjwang 4096  8월  3 09:36 test-2mon

 

이후 현재 연결된  display를 다시 연결하면 자동으로 해상도가 변경되는 것을 볼 수 있습니다.

 

삭제

$ autorandr --remove test-2mon
Removed profile 'test-2mon'

 

적용된 profile 확인

$ autorandr --current
test-2mon
반응형