如何从 OS X 上的命令行获取当前屏幕分辨率?

cwd*_*cwd 60 mac terminal resolution command-line macos

如何从 OS X 的命令行获取当前显示分辨​​率?

Ger*_*rry 81

system_profiler SPDisplaysDataType | grep Resolution
Run Code Online (Sandbox Code Playgroud)

  • 在 Macbook pro (10.8.3) 上,这仅返回 LCD 的最大分辨率,而不是当前/选定的显示分辨率。 (8认同)

rym*_*ymo 12

要快速阅读单个视网膜显示器的当前虚拟分辨率:

$ osascript -e 'tell application "Finder" to get bounds of window of desktop'
0, 0, 2048, 1280
Run Code Online (Sandbox Code Playgroud)

多显示器设置的结果因主显示器及其排列方式而异。在这里阅读更多

  • 这是有效的,格里提供的答案是不正确的。 (2认同)