jakehilborn / displayplacer Goto Github PK
View Code? Open in Web Editor NEWmacOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS.
License: MIT License
macOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS.
License: MIT License
MacOS Catalina 10.15.4 introduced support for HDR, configurable in System Preferences as seen here:
Is this a configuration option that can be supported in displayplacer
?
Issue: Error message when trying to rotate screen
Command Executed: displayplacer "id:6FF77CBC-69E9-F3DD-AB73-D1141F7D482B res:3840x2160 hz:30 color_depth:8 scaling:off origin:(0,0) degree:0" "id:00001E6D-0000-5B09-0004-B95500000000 res:1920x1080 hz:60 color_depth:4 scaling:off origin:(-3840,0) degree:90" "id:00001E6D-0000-5B08-0004-B8EF00000000 res:1920x1080 hz:60 color_depth:4 scaling:off origin:(3840,0) degree:90"
Response:
Error rotating screen 00001E6D-0000-5B09-0004-B95500000000
Error rotating screen 00001E6D-0000-5B08-0004-B8EF00000000
FYI the command does work to change placement and resolution. Issue is only with rotation.
I see rotation is possible but can you actually flip the screen horizontally to support a teleprompter? For example, in xrandr, it would be xrandr -x. Is this possible with displayplacer?
Hello there, my Macbook pro 2018 touchbar stoped working properly a while ago. The display is broken and I need my laptop badly. Not sure if this is the right place to thank you, but mate, you are my hero. Awesome job you did. I did not try all the scripts functionality but only the command to make my external display primary. Thanks again for your awesome solution.
Hi! Not an issue, but a few questions. (Didn't see a 'comments' section here so not sure where else to put/post this.)
I'm trying to figure out how it determines which is the primary monitor. My guess is it's the one with the origin of 0,0 but I'm wondering if I missed something else. Is that correct?
Also, again, trying to understand the code, where is the actual call to the system that sets the resolutions/positions? Does it do it all at once, or monitor-by-monitor?
I was trying to rotate my iPad that I am using as an external monitor but to no avail...
I just copypasted the modeline from the list
output, and got a segmentation fault:
$ displayplacer "id: AC430A46-436F-287B-3CD7-0BC5BFDE526F mode 245: res:2048x1280 hz:59 color_depth:8 scaling:on"
Segmentation fault: 11
So this is probably because of my bad formatting of the modeline :) Maybe give a proper error instead of a segfault, and format the list
output for better copypasting?
displayplacer "id:AC430A46-436F-287B-3CD7-0BC5BFDE526F res:2048x1280 hz:59 color_depth:8 scaling:on origin:(0,0) degree:0"
works fine.
This is just for info for users that are using USB-C Docks with DisplayLink drivers.
There are now diverse economic Docks for 2 and 3 external monitors, with just some USB-C connection. They usually rely on DisplayLink, which resets every time the array.
Display Link does not accept, as far as I see, persistent IDs, which appear in the normal command recommendation. But as the programer says, there is the option to use contextual, which can be found in the info list, and that works.
By the way, thank you a lot for for the program! I have been wasting time and patience to rearrange screens (work usually with 3 externals, sometimes changing the tilt) for years until I found this program. I used it for Touchbar buttons for the job, and it certainly made my life easier :)
Hi Jake and co.
I'm a designer and not a developer with 2 LG monitors along with my 16" 2019 MBP.
I made it as far as installing homebrew but I do not know how to install displayplacer (which is currently sitting on my desktop).
Can you point me to instructions on how to clearly install this and if I need to copy/drag this file elsewhere?
Is there a simple guide to using this as well?
Thank you.
I can run a script that was generated just fine within the terminal window, and it works great! I'm trying to run the script in automator and always generates an error.
The script is:
displayplacer "id:4FA1B805-30CE-5C25-29B6-D8D149F68FEC res:1920x1200 color_depth:8 scaling:off origin:(0,0) degree:0" "id:54EF03AE-1045-6AAE-C0BD-AC5CACC7C273 res:1920x1200 color_depth:8 scaling:off origin:(1920,0) degree:0"
and the error in automator is:
"displayplacer: command not found"
What am I missing? seems pretty straight forward and I just can't get it to work :(
Hello, can I use this to avoid a portion of broken screen on the right side?
I'm have used the tool for a few months to easily rotate my external monitor between 90 and 0. However, the resolution of my laptop display changes to the "more space" scaling setting every time. I've tried multiple commands with the correct resolutions but my system is not getting it.
it is switched to 1680x1050, I want it to stay at 1280x800.
I'll have to go back to the menu I am trying to avoid to solve this:
What can I do to retain scaling?
I'm planning to update to Big Sur but I really use this tool every day since MacOS keeps forgetting my 3 screen placement settings almost every time I unplug my computer from the monitors.
Has anybody tested it?
I have three screens: a laptop, and two outboard screens that need the opposite rotations. No matter what order they are configured, the rotation on the first outboard screen is reset to 0.
displayplacer "id:A25254B8-A53E-C2A7-BBFD-C268D3C3CAE2 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(1440,-1600) degree:270" "id:B85E8ADF-BA55-96E2-D223-C5B5CDA34A51 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(2880,-1600) degree:90" "id:C07EE717-D5E0-4933-131D-70E3DC02779B res:1440x900 color_depth:4 scaling:on origin:(0,0) degree:0"
First of all, which files do I download? I see multiple download links scattered across the webpage, and I'm not sure what I need to download. Next, how do I install the software? Finally, what commands do I enter if I want to toggle the main display between my macbook's internal display and my external monitor? I have absoultely no experience coding, so I have no idea what I'm doing here.
EDIT: I think I installed the software. However, when I enter displayplacer list
into terminal as a test command, it says zsh: command not found: displayplacer
Please walk me through this from the VERY beginning.
As a displayplacer user
I would like a way to use displayplacer just like I would use xrandr
so that I have access to a similar command pallet as xrandr itself.
An example :
displayplacer --output <name_of_output_socket> --mode --pos --rotate
This might require making an issue for each command
I know this is arguably an Automation not Displayplacer issue, but I’m one of probably dozens of non-developer casual Mac users who’ve been referred to this great tool from forums in search of a fix for screen rotation setting remembrance, and struggled thereafter to find on the net any helpful resource to get it to work (I also checked the readme file here, maybe I missed something?). An answer here or beefing up documentation just a bit would be appreciated by many, thanks!
I’ve successfully installed and ran displayplacer to get the script for my display. Following various forum how-to’s, I created in Automator a Quick Action (Service) profile and saved it, containing the following (using AppleScript type, and workflow set to No input from any application):
on run {input, parameters}
(displayplacer "id:933C106C-08BC-09AA-F750-C2A74A119DEF res:1440x900 color_depth:4 scaling:off origin:(0,0) degree:0" "id:6007C6A1-FAFB-AA24-6E9A-3B50F41C0EFC res:1080x1920 hz:60 color_depth:4 scaling:off origin:(214,-1920) degree:90")
return input
end run
I then created a shortcut in Keyboard settings for the saved script file. Then, per further forums advice, I went to Security settings for Accessibility and added Automator, and Finder, and Displayplacer… then proceeded to put my Mac to sleep and back on… expectedly, the rotation settings had been forgotten. So I excitedly entered my keyboard shortcut… but then got the following popup window:
The action “Run AppleScript” encountered an error: “The operation couldn’t be completed. (com.apple.Automator error -212.)”
Help please! Thank you!
I noticed a "bug", where mirrored displays share the same rotation.
My setup has 2 rows of monitors, the upper monitors are mounted 180 degrees.
When I mirror the lower ones with the upper ones with System Preferences, displayplacer list
showes me the following output:
displayplacer "id:LOWER+UPPER ... degree:0"
Is it possible to add an optional param like "degreeSecond:180"?
It works to send displayplacer "id:UPPER degree:180
after mirroring. Thanks! :)
EDIT: There are possibly more than two monitors with different rotations, maybe some sort of array would work better here?
I just installed via homebrew and any command I perform ends up with the same result.
./displayplacer list
Killed: 9
./displayplacer --version
Killed: 9
pwd
/usr/local/Cellar/displayplacer/1.2.0/bin
Unfortunately, I am no programmer, I have no clue how to troubleshoot. I couldn't locate any log file that could tell me what is going on.
I am running High-Sierra, macOS 10.13.6
i have a 3 monitor setup at work. when i remote desktop in, i like to switch it to a 1 monitor setup with different resolution / orientation.
i use SwitchResX to disable the 2 other monitors.
i would like the command line utility to remember whether a monitor is enabled / disabled. (perhaps with an enabled:0 / enabled:1 string in the monitor config)
This is probably a rookie Github move but you've made a great bit of code here and I wanted to thank you!
I have my monitors on moveable armatures so am often rearranging which screen is to the left/right, above/below the other and this will make it much easier to quickly update their arrangement. This is exactly what I need. Course it'd be nice if I could just run it from the menubar or something but I'll find a script or app to let me do that next ;)
Safari adds ".dms" to the executable download for some reason so once I downloaded the folder of files instead, I got it working. It was only later that I realized I could strip the ".dms" from the file, run chmod to make it executable, and then use the original executable.
Anyway, excited to make a couple shortcuts for this; it's working great from Terminal and will come in handy. Thanks very much!
I'm trying to figure out a way to automagically use one of two monitor arrangements based on which USB C port I plug my external monitor into. My goal is that when I plug a specific monitor into one of the right two ports, arrange my laptop on the left and the external monitor on the right. When I plug into the left two ports, do the opposite, laptop on the right and external screen on the left.
Can this project do this? I have a feeling I'll need to find another tool to detect the USB event, then trigger this project to rearrange. Thanks for any help.
I can not find meaning of the color depth constants (4,8). What does it mean?
I'd love to be able to store a 'config' file somewhere that associates a friendly name that I set up with a system ID. Even using the os-reported names aren't enough for people with multiples of the same monitor.
That way output would show this...
displayplacer \
"name:MBPInternal res:1680x1050 color_depth:4 scaling:on origin:(-1680,1717) degree:0" \
"name:Primary4K res:3840x2160 hz:60 color_depth:4 scaling:on origin:(0,0) degree:0" \
"name:LeftViewSonic res:2560x1440 hz:60 color_depth:8 scaling:off origin:(3840,310) degree:0" \
"name:RightViewSonic res:2560x1440 hz:60 color_depth:8 scaling:off origin:(-2560,277) degree:0"
There's a similar issue here...
...but they're referring to the os-supplied names. I'm talking about being able to name them anything I want at all, but those names would only make sense in regards to DisplayPlacer.
I got this installed and working via a shortcut app and via Automator. The issue I seem to be having is that the id is getting switched.
For example. I left my desk last night and everything was displaying correctly. When I came to my desk this morning. the monitors where switched. So I hit the shortcut. Screens flickered and stayed the same. I then tried the Automator app. Same result.
I opened terminal and ran displayplacer list and got this
id:4927EFE8-6123-BA85-0FAD-1F365C7776E7 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0" "id:6D890636-F5C6-E41E-FBC5-7DBE6EB37956 res:2560x1440 hz:60 color_depth:8 scaling:off origin:(-2560,0) degree:0
To fix it I swapped the ids and ran the Automator again within Automator and the displays where corrected. I had to swap the IDs two days ago in the same way. The persistent IDs shouldn't change, right? I have two 27" monitors, each plugged into separate Thunderbolt ports on a 2019 15" MBP
When executing e.g. displayplacer "id:<built-in permanent ID> mode:150"
twice the first time the mode is changed. The second time the command is executed all displays blink and the command is hanging forever.
Aren't you maybe waiting for a change to happen as a criterion to exit? ;)
First of all, this seems awesome. Always wanted xrandr for Mac :)
My issue is that my laptop screen is broken and I have a centimeter of dead pixels along the whole right side of my screen. So what I'm looking to achieve is to set a custom resolution that will exclude that part of the screen. In xrandr this could be done by creating a new mode I think. Is this possible? Thank you!
One of my screens sometimes stays black after boot, though it is recognised in System Preferences –> Displays. If I change settings there, the screen turns on and I can then change the settings back to what they were. I was looking for a command line tool in order to automate that, so I wouldn’t have to do it manually anymore.
I’ve tried other tools and they also do the job for changing the resolution, but still the screen stays black. Somehow, displayplacer “initiates” (or whatever it’s called) the screen resulting in a black screen actually turning on! Next to that, displayplacer is still maintained – the last summit is only 10 days old! So I use your tool to have my screen turn alive.
However, there’s two things I came across in displayplacer:
/bin/sh -c "displayplacer 'id:"$displayID" res:"$resolutionWidth"x"$resolutionHeight"x"$colorDepth"'"
These are my findings so far.
But I’m happy to have found a tool that is able to bring up my black screen. So thank you very much for your work!
I want to use this but due to my MacOS being locked down, I can't install apps from the internet. I have the admin account so I technically can't but it is against policy.
I am wondering if there is a way to do what displayplacer
does manually. Mainly the only thing I want to do is set monitor. The GUI method from System Preferences does not allow pixel precision.
We are using display placer for automating things, but would love to show the user the current name of the screen.
Can we get it?
Right now we show the "Type" returned by displayparser, but i think it would be better to show the exact name that appears in MacOS.
Thanks in advance!!
Is there a command for this?
Most of the time it takes 10s. On some rare occasions it's as low as 2s. I'm not sure if this is an issue with your tool or an issue with my machine/environment.
The exact command:
displayplacer "id:1112A64D-BE76-A374-1184-5AEA53EFD2EE res:1680x1050 scaling:on origin:(0,0) degree:0" "id:611B4D33-5AF5-0C07-67A7-3BC8418EA57D res:2560x1440 scaling:on origin:(-2560,-285) degree:0" "id:25040849-0BCB-2D8F-44F8-990CCF65D490 res:1440x2560 scaling:on origin:(-4000,-750) degree:90"
Otherwise this a great tool!
Any chance you can make this available via Homebrew?
I am using a dock with displaylink. This arrangement tool looks very nice, but its not working with displaylink. Since apple does not store display arrangement i am looking for a tool like this.
When running my correction command I sometimes see an error: "Screen ID 9E316E60-3030-DC74-38FF-23A1728C790D: could not find res:2560x1440 scaling:off"
Here is the command being run:
displayplacer "id:9E316E60-3030-DC74-38FF-23A1728C790D res:2560x1440 scaling:off origin:(0,0) degree:0" "id:900974AE-D566-7A99-C003-1D7899F5E4D4 res:1440x2560 scaling:off origin:(2560,-531) degree:90"
This seems to happen when only one of the monitors is needing to be adjusted. Maybe the list of available resolutions doesn't include the current one?
Hi,
I've installed via brew
and get this error:
dyld: Library not loaded: /System/Library/Frameworks/ColorSync.framework/Versions/A/ColorSync
Referenced from: /usr/local/bin/displayplacer
Reason: image not found
[1] 28041 abort displayplacer
on mac OS 10.12.6.
Do you have any ideas?
For clarity/legebility, I recommend utilizing the line-continuation character (backslash) when showing your 'Execute the command below' in the output for displayplacer list
as it makes it look much cleaner to have one monitor per displayed line.
As an example, consider this (my suggestion):
displayplacer \
"id:2960D639-F605-5BB4-A53D-A3263008894C res:1680x1050 color_depth:4 scaling:on origin:(-1680,1717) degree:0" \
"id:C5A9F6A2-706B-7ADD-1027-98CB840AD109 res:3840x2160 hz:60 color_depth:4 scaling:on origin:(0,0) degree:0" \
"id:FC132C50-990A-9469-C479-7D7DB909B28D res:2560x1440 hz:60 color_depth:8 scaling:off origin:(3840,310) degree:0" \
"id:7F32C733-7507-FB95-B1C7-FD475C42E88C res:2560x1440 hz:60 color_depth:8 scaling:off origin:(-2560,277) degree:0"
vs this (current):
displayplacer "id:C5A9F6A2-706B-7ADD-1027-98CB840AD109 res:3840x2160 hz:60 color_depth:4 scaling:on origin:(0,0) degree:0" "id:2960D639-F605-5BB4-A53D-A3263008894C res:1680x1050 color_depth:4 scaling:on origin:(-1680,1717) degree:0" "id:FC132C50-990A-9469-C479-7D7DB909B28D res:2560x1440 hz:60 color_depth:8 scaling:off origin:(3840,310) degree:0" "id:7F32C733-7507-FB95-B1C7-FD475C42E88C res:2560x1440 hz:60 color_depth:8 scaling:off origin:(-2560,277) degree:0"
As you can see, it (sort of) keeps related things (e.g. resolutions) near each other making it easier to identify your monitors.
Paired with my other suggestion about giving you user-friendly monitor names, it would go a long way towards making scripting with your tool easier to read.
Sorry, I thought I had pressed cmd-N to open a new browser window and continued typing my search terms + enter. Please delete this issue, I didn’t mean to open it.
I have a thunderbolt 3 dock (OWC brand), connected to two external monitors (one via HDMI, one via DP). I'm running Catalina.
When I run the list
command, I consistently get the same permanent IDs for all 3 displays. However, when I restart my computer, things I have assigned to "Display 1" or "Display 2" appear on different monitors than before the restart. Running the same command doesn't fix this order mixup.
Does this command set the system order # of the screens? See screenshot below:
Is there a relationship to the order in which you call the screen IDs in the displayplacer
command? Should these arbitrary display numbers in the contextual menu above relate to this order? Is "Display 1" always the screen with the menu bar?
Here is a screenshot of SwitchResX, which doesn't agree with the system's display order numbers, but I'm not sure if that is supposed to:
I use macbook pro 16 inch with a external LG 4K display
The macbook pro 16's inner display supports the adjustable refresh rate, and I set to 60HZ, but the displayplacer list
command will detect as 59HZ.
> displayplacer list
> displayplacer "id:AAAA res:1920x1080 hz:60 color_depth:8 scaling:on origin:(0,0) degree:0" "id:BBBB res:1792x1120 hz:59 color_depth:8 scaling:on origin:(197,1080) degree:0"
id:AAAA
is the external 4K display and id:BBBB
is the internal display.
After I manually change the command to 60HZ as
displayplacer "id:AAAA res:1920x1080 hz:60 color_depth:8 scaling:on origin:(0,0) degree:0" "id:BBBB res:1792x1120 hz:60 color_depth:8 scaling:on origin:(197,1080) degree:0"
This command will get the following error message
Screen ID BBBB: could not find res:1792x1120x60 color_depth:8 scaling:off
I have two resolutions in use with Resolutionator:
I want to easily switch between them on my 12" MacBook, because (1) uses significantly more resources from the mac, but is crispy on my 4K monitor, and (2) is a little blurry, but the mac is less under a load.
displayplacer identified the two modes as:
But both commands switches the monitor to scaled mode.
Currently "displayplacer list" outputs includes available modes as the following format,
Contextual screen id: 69731840
Resolutions for rotation 0:
mode 0: res:1280x800 color_depth:4 scaling:on
mode 1: res:1680x1050 color_depth:4 scaling:on
mode 2: res:1440x900 color_depth:4 scaling:on <-- current mode
But if change to the following format, it is easy to reuse these lists to configure with copy and paste.
Contextual screen id: 69731840
Resolutions for rotation 0:
id:69731840 mode:0 res:1280x800 color_depth:4 scaling:on
id:69731840 mode:1 res:1680x1050 color_depth:4 scaling:on
id:69731840 mode:2 res:1440x900 color_depth:4 scaling:on <-- current mode
With this output, if someone want to change resolution to 1680x1050, it is easy to execute displayplacer "id:69731840 mode:1"
only to do copy and paste from displayplacer list
outputs.
For my environment, I'm using it with the following patch in the printCurrentProfile() function.
--- displayplacer.c.orig 2020-07-24 16:57:17.000000000 +0900
+++ displayplacer.c 2020-07-24 17:23:29.000000000 +0900
@@ -283,9 +283,10 @@
printf("Resolutions for rotation %i:\n", (int) CGDisplayRotation(curScreen));
for (int i = 0; i < modeCount; i++) {
+ printf("id:%i ", curScreen);
modes_D4 mode = modes[i];
- printf(" mode %i: res:%dx%d", i, mode.derived.width, mode.derived.height);
+ printf(" mode:%i res:%dx%d", i, mode.derived.width, mode.derived.height);
if (mode.derived.freq) {
printf(" hz:%i", mode.derived.freq);
The option "scaling:on/off" does not work with new Mac OS Catalina..
I have a macbook pro 16" with a hp usb-c hub with 2 connected hp screens with displaylink.
When i try to rotate with both Persistance id and contextual the laptop monitor blinks and it says could not rotate screen.
The laptop screen rotates fine.
displayplacer "id:4128832 mode:1 scaling:off origin:(1920,0) degree:90"
Error rotating screen 4128832
I'd love to have a command like this:
displayplacer list E2E3EB28-C231-7ED8-4800-2A2E45E7314D
And it would output something like:
Persistent screen id: E2E3EB28-C231-7ED8-4800-2A2E45E7314D
Contextual screen id: 722475540
Type: 27 inch external screen
Resolution: 1280x720
Hertz: 60
Color Depth: 8
Scaling:on
Origin: (2560,0)
Rotation: 0
Resolutions for rotation 0:
mode 0: res:1920x1080 hz:60 color_depth:4 scaling:on
... etc
And then we could further filter the information with additional arguments, like:
displayplacer list E2E3EB28-C231-7ED8-4800-2A2E45E7314D res
And that would output:
1280x720
I'm writing a script that will help me toggle between too modes that I work with regularly and right now I have to parse through the current listing info with regex. Would be great to not have to do that :)
But I'm not very comfortable in C before, so I'm not sure I can contribute this myself so I understand if you're not interested in working on this yourself.
Moving from a mirrored / optimized resolution for external display to a unmirrored setup with separate resolutions caused my external display to default to my macbook's custom display resolution.
Any chance to run displayplacer in future without disabling Catalinas SIP?
brew install displayplacer
returns the following error:
Error: The following formula
displayplacer
cannot be installed as binary package and must be built from source.
Install the Command Line Tools:
xcode-select --install
I work in an office where all desks have 2 screens but the docking station is setup so that either left port is on right or left port is on left, everytime I have to adjust the position of the external screens.
I tried to use displayplacer list
but the id is changing with every docking station / monitor.
So really what I want is the ability to swap around the position of monitor 1 and monitor 2.
Should I go with a shell script or would it make a valuable feature for the tool?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.