jakehilborn / displayplacer

macOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS.
MIT License
3.74k stars 134 forks source link

Simple way to dump current config, one per line #86

Open MarqueIV opened 2 years ago

MarqueIV commented 2 years ago

Primary Ask

Hoping to get a simple way to dump the current arrangement.

For instance, if I typed this (using -s for 'simple')...

displayPlacer list -s

Here's the output I'd love to see...

id:A4C0A376-9BC3-4FA9-949A-77D70E2C9EB1 res:3840x2160 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0
id:37D8832A-2D66-02CA-B9F7-8F30A301B230 res:1512x982 hz:120 color_depth:8 scaling:on origin:(-1512,1681) degree:0
id:2DD8F126-4267-4DB8-B3CE-320CBDDE7902 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(-2560,231) degree:0
id:513EA9B1-A9BA-490F-9CAC-F6FE4C1737C7 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(3840,185) degree:0

Yes, I know you can use displayPlacer list to get the current arrangements, but it's done in the verbose way up top, followed by the statement at the bottom to execute/apply the current arrangement.

What I end up having to do is grep for that line, split it with a utility that respects quoted strings, then drop the first split item (which is 'displayPlacer') all just to get the monitor configs. Hoping a flag can be added that simply dumps each monitor's config out on a single line without 'displayPlacer' in the front.

Aside / Suggestion

Also, on a side-note, something else I do in my own 'displayPlacer wrapping util' is when I'm generating the command to re-apply my current config, I replace the non-quoted spaces with new lines, then append \ to the end of all but the last line. Finally I indent the following lines. Makes it much more legible when viewing the command itself and still keeps it as a single command.

e.g. Instead of this...

displayplacer "id:A4C0A376-9BC3-4FA9-949A-77D70E2C9EB1 res:3840x2160 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0" "id:37D8832A-2D66-02CA-B9F7-8F30A301B230 res:1512x982 hz:120 color_depth:8 scaling:on origin:(-1512,1681) degree:0" "id:2DD8F126-4267-4DB8-B3CE-320CBDDE7902 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(-2560,231) degree:0" "id:513EA9B1-A9BA-490F-9CAC-F6FE4C1737C7 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(3840,185) degree:0"

it looks like this (still technically one command, but more legible)...

displayplacer \
  "id:A4C0A376-9BC3-4FA9-949A-77D70E2C9EB1 res:3840x2160 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0" \
  "id:37D8832A-2D66-02CA-B9F7-8F30A301B230 res:1512x982 hz:120 color_depth:8 scaling:on origin:(-1512,1681) degree:0" \
  "id:2DD8F126-4267-4DB8-B3CE-320CBDDE7902 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(-2560,231) degree:0" \
  "id:513EA9B1-A9BA-490F-9CAC-F6FE4C1737C7 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(3840,185) degree:0"

Maybe something to consider as part of your current list option.