Skip to content

Swap the positions of two monitors by contextual screen id. #80

@twocs

Description

@twocs

I have three monitors, all the same exact model and resolution. Mac keeps reassigning the "persistent id" on wakeup, so the command cannot work (I see other open issues also related). All I want to do is swap monitor #2 with monitor #3.

I can do this with some CLI work with SED and swap the IDs in the command output, but displayplacer list is so chatty. It doesn't simply output the "command below", but it also emits instructions and a bunch of other stuff.
displayplacer list | grep displayplacer outputs two lines of possible commands:

Rotation: 0 - rotate internal screen example (may crash computer, but will be rotated after rebooting): displayplacer "id:37D8832A-2D66-02CA-B9F7-8F30A301B230 degree:90"
displayplacer "id:11AC0330-F896-4084-A952-9A27AE3D72D6 res:1920x1080 hz:75 color_depth:8 scaling:off origin:(0,0) degree:0" "id:37D8832A-2D66-02CA-B9F7-8F30A301B230 res:1728x1117 hz:120 color_depth:8 scaling:on origin:(1920,-37) degree:0" "id:CCE46CDB-1FC0-45E0-BFE9-D240990808ED res:1920x1080 hz:75 color_depth:8 scaling:off origin:(-1920,0) degree:0"
So then I can make my script
displayplacer list | grep displayplacer | tail -n1 | sed 's/11AC0330-F896-4084-A952-9A27AE3D72D6/\n/g;s/CCE46CDB-1FC0-45E0-BFE9-D240990808ED/11AC0330-F896-4084-A952-9A27AE3D72D6/g;s/\n/CCE46CDB-1FC0-45E0-BFE9-D240990808ED/g' | sed 's/displayplacer//' | xargs displayplacer

What I'd really like is a command like displayplacer swap --contextual_screen_id 2 3

Some suggestions: displayplacer list -l could listScreens(), and displayplacer list -p could limit it to printCurrentProfile() (preferably without extraneous comments like "Execute the command below to set your screens to the current arrangement"). displayplacer list --contextual-screen-ids would output contextual ids rather than the "permanent" ones that my Mac keeps switching.

Poking around I also found the undocumented commands:
displayplacer --version
displayplacer --help
Shouldn't they be in the Readme? The instructions are very brief in the Readme. Not sure what to do to get some traction on this. Sorry if this issue sounds is a bit vague but I'm really not clear on what to do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions