How to create a keyboard shortcut for Mac system
Photo by <a >Quaritsch Photography</a>

How to create a keyboard shortcut for Mac system

When I work on any of my Mac systems say Mac Book Pro I love to use the keyboard. So need to keep the Mac a little far from my eyesight. And then I need to make the Display Text one step larger on System Settings. So this is annoying for me as need to do this process and back to smaller text often.

This kind of job can be done with the help of Apple script. See first the manual steps:

open the system settings and go to Display [I am using MacBookPro M1 with Mac OS Ventura 13.3.x

No alt text provided for this image

You can select the Text size as per your comfortable level.

How to automate this process with toggle. So the same key combinations can increase and decrease the text size here without opening the system settings and following all the steps.

  1. Open the Automator App and select Quick Action

No alt text provided for this image

  1. It will open by double click
  2. Search the Apple script from the left top search panel

No alt text provided for this image

  1. It will open an editor in the right pen

No alt text provided for this image

  1. Insert the code then it should look like


on run {input, parameters

	do shell script "open x-apple.systempreferences:com.apple.preference.displays"

	tell application "System Events"

		tell application process "System Settings"

			repeat until (exists UI element 1 of group 1 of scroll area 2 of group 1 of group 2 of splitter group 1 of group 1 of window 1)

				delay 0.1

			end repeat

			tell window 1 #"Displays"

				set displayOptions to UI element 1 of group 1 of scroll area 2 of group 1 of group 2 of splitter group 1 of group 1

				set StandardRes to button 3 of displayOptions

				set MoreSpaceRes to button 2 of displayOptions

				

				if focused of StandardRes is false then

					click StandardRes

				else

					click MoreSpaceRes

				end if

				

				if focused of MoreSpaceRes is false then

					click MoreSpaceRes

				else

					click StandardRes

				end if

				

			end tell

		end tell

	end tell

	quit application "System Settings"

	return input

end run}        
No alt text provided for this image

You can test by clicking the run button and then save -> close the Automator app

Open the System Settings and go to Keyboard from the left pen and then click on Keyboard Shortcuts on the right pen

No alt text provided for this image

It will take you to the new windows and then select Services from the left tab. Check the right-side General option. You can see your newly created Toggle Resolution option below it. Double click it to set the keyboard shortcut as you prefer.

No alt text provided for this image

As you can see I have selected ctrl + cmd + up arrow for this task.

Then restart your system. Later it may ask for some accessibility security response you can give the permission from settings.

Now it will work by your keyboard shortcuts with toggle. Thank you.

要查看或添加评论,请登录

Dhiraj Patra的更多文章

社区洞察

其他会员也浏览了