m-cli icon indicating copy to clipboard operation
m-cli copied to clipboard

Add displays management

Open Anahkiasen opened this issue 8 years ago • 3 comments

I have two screens and I constantly switch the main one because I also use one of the two for the PC. Would love to have a command like m displays switch or something that switches screen, like when dragging the bar here from one screen to another:

screen shot 2016-07-16 at 20 51 40

Anahkiasen avatar Jul 16 '16 18:07 Anahkiasen

That's a great idea 👍

rgcr avatar Jul 16 '16 18:07 rgcr

This can potentially be accomplished by doing a defaults write to modify the appropriate attribute(s) in com.apple.windowserver.plist.

I just don't have a secondary monitor to test/compare the settings when one monitor is the primary vs when the other monitor is the primary.

For instance, here is my output from reading the Displays Preferences (currently using the built-in macbook display only):

$ 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/PCI0@0/AppleACPIPCI/P0P2@1/IOPCI2PCIBridge/GFX0@0/NVDA,Display-A@0/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;
}

pbnj avatar Dec 04 '16 04:12 pbnj

@pmbenjamin, I'll test it

rgcr avatar Dec 05 '16 16:12 rgcr