Is it possible to change display resolution with a keyboard shortcut?

Yes you totally can achieve this without running additional apps. On my system I created two different scripts. One script for adjusting the display resolution higher and one adjusting display resolution lower. On my system I just enabled both scripts as dictation commands but if you create a new Service through Automator, you can assign keyboard shortcuts to those services..

First, here are the two scripts I started with.

This one is for making the display resolution higher: if my display resolution is already at the default position

enter image description here

tell application "System Preferences"
    reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
    click radio button "Scaled" of radio group 1 of tab group 1
    click radio button 4 of radio group 1 of group 1 of tab group 1
end tell
quit application "System Preferences"

Running that script will result in this:

enter image description here

This next script is for making the display resolution lower: if my display resolution is not set at the default setting

tell application "System Preferences"
    reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
    click radio button "Scaled" of radio group 1 of tab group 1
    click radio button 3 of radio group 1 of group 1 of tab group 1
end tell
quit application "System Preferences"

Once I made sure both scripts work correctly, I then opened up Automator and created a new service for the display resolution higher and added the appropriate script as shown in the following image. I saved this file as rez_higher.workflow

enter image description here

From here, I opened up system preferences/keyboard/shortcuts/services. I located that new service I created and assigned it a keyboard shortcut

enter image description here

After this, just follow the same procedures to create a new workflow and service for the display resolution lower


Fix for wch1zpink's answer on macOS 12.0.1, thanks to the UI Browser app:

tell application "System Preferences"
    reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
tell application "System Events"
    tell application process "System Preferences"
        repeat until (exists radio button "Scaled" of radio group 1 of group 1 of window "Displays")
            delay 0.1
        end repeat
        tell window "Displays"
            set isScaled to value of radio button "Scaled" of radio group 1 of group 1
            if isScaled = 0 then
                click radio button "Scaled" of radio group 1 of group 1
                click button 1 of UI element 3 of group 1
            else
                click radio button "Default for display" of radio group 1 of group 1
            end if
        end tell
    end tell
end tell
quit application "System Preferences"

Fix for wch1zpink's answer on macOS 10.15.4:

tell application "System Preferences"
    reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
    set isScaled to value of radio button "Scaled" of tab group 1
    if isScaled = 0 then
        click radio button "Scaled" of tab group 1
        click radio button 1 of radio group 1 of group 1 of tab group 1
    else
        click radio button "Default for display" of tab group 1
    end if
end tell
quit application "System Preferences"

I wrote the free command line tool displayplacer to change resolutions/rotations for single or multi-monitor desktops. You can trigger a "profile" (example below) via a keyboard shortcut with Automator like wch1zpink explained, BetterTouchTool, etc.

displayplacer 'id:69731906 res:1440x900 scaling:on origin:(0,0) degree:0'