有沒有辦法通過OS X中的終端獲取有關連接的顯示器和顯示器及其分辨率的信息?顯示連接的顯示器/顯示器/分辨率的終端命令?
我有一些安裝運行在多個顯示器上,有時GFLW窗口似乎沒有打開,如果沒有連接顯示器 - 我想檢查顯示器是否正確連接,並可能轉儲到一個日誌文件,但我還沒有找到一個綱領性的方式做到這一點沒有得到深入的OBJ-C /可可
有沒有辦法通過OS X中的終端獲取有關連接的顯示器和顯示器及其分辨率的信息?顯示連接的顯示器/顯示器/分辨率的終端命令?
我有一些安裝運行在多個顯示器上,有時GFLW窗口似乎沒有打開,如果沒有連接顯示器 - 我想檢查顯示器是否正確連接,並可能轉儲到一個日誌文件,但我還沒有找到一個綱領性的方式做到這一點沒有得到深入的OBJ-C /可可
您可以使用system_profiler SPDisplaysDataType
或defaults read /Library/Preferences/com.apple.windowserver.plist
:
$ system_profiler SPDisplaysDataType
Graphics/Displays:
NVIDIA GeForce GT 640M:
Chipset Model: NVIDIA GeForce GT 640M
Type: GPU
Bus: PCIe
PCIe Lane Width: x16
VRAM (Total): 512 MB
Vendor: NVIDIA (0x10de)
Device ID: 0x0fd8
Revision ID: 0x00a2
ROM Revision: 3707
Displays:
iMac:
Display Type: LCD
Resolution: 1920 x 1080
Pixel Depth: 32-Bit Color (ARGB8888)
Main Display: Yes
Mirror: Off
Online: Yes
Built-In: Yes
Connection Type: DisplayPort
$ defaults read /Library/Preferences/com.apple.windowserver.plist
{
DisplayResolutionEnabled = 1;
DisplaySets = (
(
{
Active = 1;
Depth = 4;
DisplayID = 69731456;
DisplayProductID = 40978;
DisplaySerialNumber = 0;
DisplayVendorID = 1552;
Height = 1080;
IODisplayLocation = "IOService:/AppleACPIPlatformExpert/[email protected]/AppleACPIPCI/[email protected]/IOPCI2PCIBridge/[email protected]/NVDA,[email protected]/NVDA";
IOFlags = 7;
LimitsHeight = 1080;
LimitsOriginX = 0;
LimitsOriginY = 0;
LimitsWidth = 1920;
MirrorID = 0;
Mirrored = 0;
Mode = {
BitsPerPixel = 32;
BitsPerSample = 8;
DepthFormat = 4;
Height = 1080;
IODisplayModeID = "-2147479552";
IOFlags = 7;
Mode = 1;
PixelEncoding = "--------RRRRRRRRGGGGGGGGBBBBBBBB";
RefreshRate = 0;
SamplesPerPixel = 3;
UsableForDesktopGUI = 1;
Width = 1920;
kCGDisplayBytesPerRow = 7680;
kCGDisplayHorizontalResolution = 103;
kCGDisplayModeIsInterlaced = 0;
kCGDisplayModeIsSafeForHardware = 1;
kCGDisplayModeIsStretched = 0;
kCGDisplayModeIsTelevisionOutput = 0;
kCGDisplayModeIsUnavailable = 0;
kCGDisplayModeSuitableForUI = 1;
kCGDisplayPixelsHigh = 1080;
kCGDisplayPixelsWide = 1920;
kCGDisplayResolution = 1;
kCGDisplayVerticalResolution = 103;
};
OriginX = 0;
OriginY = 0;
PixelEncoding = "--------RRRRRRRRGGGGGGGGBBBBBBBB";
Resolution = 1;
Unit = 0;
UnmirroredHeight = 1080;
UnmirroredLimitsHeight = 1080;
UnmirroredLimitsOriginX = 0;
UnmirroredLimitsOriginY = 0;
UnmirroredLimitsWidth = 1920;
UnmirroredMode = {
BitsPerPixel = 32;
BitsPerSample = 8;
DepthFormat = 4;
Height = 1080;
IODisplayModeID = "-2147479552";
IOFlags = 7;
Mode = 1;
PixelEncoding = "--------RRRRRRRRGGGGGGGGBBBBBBBB";
RefreshRate = 0;
SamplesPerPixel = 3;
UsableForDesktopGUI = 1;
Width = 1920;
kCGDisplayBytesPerRow = 7680;
kCGDisplayHorizontalResolution = 103;
kCGDisplayModeIsInterlaced = 0;
kCGDisplayModeIsSafeForHardware = 1;
kCGDisplayModeIsStretched = 0;
kCGDisplayModeIsTelevisionOutput = 0;
kCGDisplayModeIsUnavailable = 0;
kCGDisplayModeSuitableForUI = 1;
kCGDisplayPixelsHigh = 1080;
kCGDisplayPixelsWide = 1920;
kCGDisplayResolution = 1;
kCGDisplayVerticalResolution = 103;
};
UnmirroredOriginX = 0;
UnmirroredOriginY = 0;
UnmirroredResolution = 1;
UnmirroredWidth = 1920;
Width = 1920;
}
)
);
ForceOldStyleMemoryManagement = 0;
}
太棒了!非常感謝...我正在尋找的東西。希望讓我的一些應用程序更智能地連接顯示器。 – laserpilot
你知道一個改變解析度和相關刷新率的命令嗎? – Vincent
你應該問在http這個問題: //apple.stackexchange.com – trojanfoe