4

I downloaded a command line utility from this github webpage . I clicked on the green Clone or Download button to download the zip file. Although, there are also files that can be downloaded from the releases tab. I'm not sure whether I'm supposed to download those files instead. After downloading and unzipping the zip file, I double-clicked on the file entitled displayplacer, which opened a terminal window that ran a bunch of commands.

Now what? How do I use this program?

I tried opening a new terminal window and running displayplacer list which, according to the github page, is supposed to Show current screen info and possible resolutions. However, the terminal window returned zsh: command not found: displayplacer after I entered the command. Did I not install the code properly?

Ultimately, what I want to do is set up a keyboard shortcut that switches the primary display between my macbook's internal display and my external display. How do I do this?

(macOS catalina)

3
  • 4
    GitHub is geared more toward advanced users and developers and as written, your question is more about how to use the source files than an Apple related question; it’s just coincidence that you’re running and the app itself is for macOS. However, if you read the readme.md, there are instructions on how to install via Homebrew. You should follow that route
    – Allan
    Commented Dec 1, 2019 at 2:13
  • I tried to install homebrew, and got the following error message: Error: Failed to link all completions, docs and manpages: Permission denied @ rb_file_s_symlink - (../../../Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew) Failed during: /usr/local/bin/brew update --force. I also read the instructions in readme.md, but was confused. When it says to run commands, do I run them in a new terminal window? If not, what do I do? Commented Dec 1, 2019 at 2:59
  • @Allan /\ /\ /\ Commented Dec 1, 2019 at 3:09

2 Answers 2

5

Installation:

  1. Download the zip to your Downloads folder
  2. Unzip displayplacer-master.zip
  3. Enter in Terminal: sudo mv ~/Downloads/displayplacer-master/displayplacer /usr/local/bin/
  4. sudo chmod +x /usr/local/bin/displayplacer
  5. displayplacer
  6. Depending on your Security & Privacy settings you have to allow execution of the file in System Preferences > Security & Privacy > General

All other files included in the zip won't be required to run the exec.

Usage:

  1. Get the properties of all your displays: displayplacer list
  2. With the properties and the various possible switches create an arrangement. One example with four monitors is listed:

    displayplacer "id:18173D22-3EC6-E735-EEB4-B003BF681F30+F466F621-B5FA-04A0-0800-CFA6C258DECD res:1440x900 scaling:on origin:(0,0) degree:0" "id:4C405A05-8798-553B-3550-F93E7A7722BB res:768x1360 hz:60 color_depth:8 scaling:off origin:(1440,0) degree:90" "id:A46D2F5E-487B-CC69-C588-ECFD519016E5 mode:3 origin:(-1440,0) degree:270"
    

    I have no 2nd screen in my virtual machine so I partly have to guess what it means:

    The first two monitors (1440x900) are mirrored and contain the menubar. The third is on the right and rotated by 90 degrees (clockwise?). The fourth is on the left and rotated by 90 degrees (counterclockwise?).

Automator:

After finding appropriate settings (at least two if you want to switch the primary display between [your] macbook's internal display and [your] external display: back and forth) you have to create two different services/quick actions/etc. each containing one shell script ("Run Shell Script") with the proper displayplacer "id:.... line.

Depending on your Mac hardware and your system version you can apply a shortcut or even add it to the Touch Bar.

5
  • THANK YOU!!! You have no idea how long I spent trying to figure out how to install this code. Commented Dec 1, 2019 at 3:45
  • Also, would you happen to know what command I need to enter in order to switch the primary display between my macbook's internal display and my external monitor? Commented Dec 1, 2019 at 3:50
  • @PeterSchorn From the GitHub/displayplacer Notes: "The screen set to origin (0,0) will be set as the primary screen"
    – klanomath
    Commented Dec 1, 2019 at 4:12
  • Ok, I figured out what command to enter in order to swap my main display between my two screens (see this answer); however, when I enter the command, all my application windows swap between my two screens. Is there a way to switch the primary display without the windows swapping at the same time? Commented Dec 1, 2019 at 4:28
  • @PeterSchorn I don't think so. I'm no coder but I think you would have to tell WindowServer to move all objects from the former LogicalDisplay1|PhysicalDisplay1 to the later LogicalDisplay2|PhysicalDisplay1.
    – klanomath
    Commented Dec 1, 2019 at 4:33
-1

Adding 1 more step to run the steps (for the Answer above) automatically https://stackoverflow.com/questions/6442364/running-script-upon-login-mac

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .