OS X의 명령 행에서 현재 화면 해상도를 얻으려면 어떻게해야합니까? X의 명령 행에서 현재 디스플레이 해상도를

OS X의 명령 행에서 현재 디스플레이 해상도를 얻으려면 어떻게해야합니까?



답변

system_profiler SPDisplaysDataType | grep Resolution


답변

단일 망막 디스플레이의 현재 가상 해상도를 빠르게 읽으려면 :

$ osascript -e 'tell application "Finder" to get bounds of window of desktop'
0, 0, 2048, 1280

다중 모니터 설정의 결과는 기본 디스플레이 및 배열 방식에 따라 다릅니다. 자세한 내용은 여기를 참조 하십시오


답변

유틸리티 screenresolution를 사용하여 화면 해상도를 얻습니다.

$ /usr/local/bin/screenresolution get 2>&1 | grep -oE 'Display 0: [0-9]+' | grep -Eo '[0-9]+$'
1920


답변

나는 이것을 도울 수있는 displayplacer을 썼다 . 실행 displayplacer list하면 모든 화면의 현재 해상도 (및 추가 정보)가 표시됩니다.

$ displayplacer list
Persistent screen id: A46D2F5E-487B-CC69-C588-ECFD519016E5
Contextual screen id: 1124216237
Type: 40 inch external screen
Resolution: 3840x2160
Hertz: 60
Color Depth: 4
Scaling:off
Origin: (0,0) - main display
Rotation: 0
Resolutions for rotation 0:
  mode 0: res:3840x2160 hz:60 color_depth:4 <-- current mode
  mode 1: res:3840x2160 hz:60 color_depth:8
  mode 2: res:3840x2160 hz:30 color_depth:4
...
Persistent screen id: 2960D639-F605-5BB4-A53D-A3263008894C
Contextual screen id: 69733451
Type: MacBook built in screen
Resolution: 1680x1050
Hertz: N/A
Color Depth: 4
Scaling:on
Origin: (-1680,1291)
Rotation: 0 - rotate internal screen example (may crash computer, but will be rotated after rebooting): `displayplacer "id:2960D639-F605-5BB4-A53D-A3263008894C degree:90"`
Resolutions for rotation 0:
  mode 0: res:1440x900 color_depth:4 scaling:on
  mode 1: res:1440x900 color_depth:8 scaling:on
  mode 2: res:720x450 color_depth:4 scaling:on

grep은 출력을 구문 분석하는 간단한 방법입니다.

$ displayplacer list | grep -e Resolution: -e Scaling:
Resolution: 3840x2160
Scaling:off
Resolution: 1680x1050
Scaling:on

Homebrew를 통해서도 이용 가능 brew tap jakehilborn/jakehilborn && brew install displayplacer


답변