Reduce Transparency


Keyboard Maestro 10.2 on macOS 12.6


Hi Everyone,

I know this topic been discussed before, unfortunately none of that worked for me so far.
What's the best way to activate Reduce transparency on macOS.

So far I tried ...

Shell script

defaults write com.Apple.universalaccess reduceTransparency -bool TRUE

AppleScript (This Script does work if the System Preferences window is opened in the Accessibility -> Display Menu. But not from inside KM.)

tell application "System Preferences" to activate
tell application "System Events"
	tell it's application process "System Preferences"
		tell it's window "Accessibility"
			tell it's tab group 1 of group 1
				click checkbox "Reduce transparency"
			end tell
		end tell
	end tell
end tell

If anyone has a solution, I love to try it.
Thanks

Hey Jack,

That script is essentially useless...

This has been done, but I have't seen an update for later versions of macOS.

AppleScript/KM Solution to Toggle the System Preferences “Reduce Transparency” On/OFF Checkbox

Getting it to work in pretty bombproof fashion isn't easy.

I've got this working on macOS 10.14.6 Mojave, but I'm sure it will require adjustments to work on macOS Monterey.

tell application "System Preferences"
   if not running then
      run
   end if
   activate
   if name of its front window is not "Accessibility" then
      reveal pane id "com.apple.preference.universalaccess"
      tell pane id "com.apple.preference.universalaccess"
         reveal anchor "Seeing_Display"
      end tell
   end if
end tell

tell application "System Events"
   tell application process "System Preferences"
      repeat while (get name of window 1) ≠ "Accessibility"
         delay 0.1
      end repeat
      tell window "Accessibility"
         tell scroll area 1
            tell table 1
               set displayPrefs to UI element 1 of rows where its name is "Display"
               repeat with i in displayPrefs
                  if contents of i ≠ missing value then
                     set displayPrefs to contents of i
                  end if
               end repeat
               try
                  displayPrefs / 0
               on error displayPrefRowNum
                  set AppleScript's text item delimiters to {"«class crow» ", " of «class tabB»"}
                  set displayPrefRowNum to (text item 2 of displayPrefRowNum) as integer
               end try
               set displayPrefRow to row displayPrefRowNum
               select displayPrefRow
            end tell
         end tell
         tell group 1
            tell checkbox "Reduce transparency"
               perform action "AXPress"
            end tell
         end tell
      end tell
   end tell
end tell

-Chris

Hey Chris,

Thanks for the AppleScript.

I made a small change to make it work, is it possible to run this with out bringing the preference window to the front every time.

tell application "System Preferences"
   if not running then
      run
   end if
   activate
   if name of it's front window is not "Accessibility" then
      reveal pane id "com.Apple.preference.universalaccess"
      tell pane id "com.Apple.preference.universalaccess"
         reveal anchor "Seeing_Display"
      end tell
   end if
end tell

tell application "System Events"
   tell application process "System Preferences"
      repeat while (get name of window 1) ≠ "Accessibility"
         delay 0.1
      end repeat
      tell window "Accessibility"
         tell scroll area 1
            tell table 1
               set displayPrefs to UI element 1 of rows where it's name is "Display"
               repeat with I in displayPrefs
                  if contents of I ≠ missing value then
                     set displayPrefs to contents of I
                  end if
               end repeat
               try
                  displayPrefs / 0
               on error displayPrefRowNum
                  set AppleScript's text item delimiters to {"«class crow» ", " of «class tabB»"}
                  set displayPrefRowNum to (text item 2 of displayPrefRowNum) as integer
               end try
               set displayPrefRow to row displayPrefRowNum
               select displayPrefRow
            end tell
         end tell
         tell it's tab group 1 of group 1
            tell checkbox "Reduce transparency"
               perform action "AXPress"
            end tell
         end tell
      end tell
   end tell
end tell

-Jack

Great, I'm glad you got it working.

To stop the settings from being activated delete or comment-out the “activate” line near the top.

I updated the AppleScript to work on macOS 13.3. But it takes about 5+ seconds. Any way to reduce the time?

AppleScript

    -------------------------------------------------------------------------------------------
    # Author	: Jack
    # Created	: 2023/01/25
    # Modified	: 2023/03/29
    # System	: macOS 13.3
    # Purpose	: Toggle Transparency in System Accessibility Settings
    # Url		: https://forum.keyboardmaestro.com/t/reduce-transparency/30676/3 
    #			  https://www.macscripter.net/t/accessibilitv-applescript/74107/7
    -------------------------------------------------------------------------------------------

    use AppleScript version "2.5" -- Yosemite (10.10) or later
    use scripting additions

    if (system version of (system info)) ≤ "12 -- macOS Monterey" then
    	tell application "System Settings"
    		if not running then
    			run
    		end if
    		activate
    		if name of its front window is not "Accessibility" then
    			reveal pane id "com.apple.preference.universalaccess"
    			tell pane id "com.apple.preference.universalaccess"
    				reveal anchor "Seeing_Display"
    			end tell
    		end if
    	end tell
    	
    	tell application "System Events"
    		tell application process "System Preferences"
    			repeat while (get name of window 1) ≠ "Accessibility"
    				delay 0.1
    			end repeat
    			tell window "Accessibility"
    				tell scroll area 1
    					tell table 1
    						set displayPrefs to UI element 1 of rows where its name is "Display"
    						repeat with i in displayPrefs
    							if contents of i ≠ missing value then
    								set displayPrefs to contents of i
    							end if
    						end repeat
    						try
    							displayPrefs / 0
    						on error displayPrefRowNum
    							set AppleScript's text item delimiters to {"«class crow» ", " of «class tabB»"}
    							set displayPrefRowNum to (text item 2 of displayPrefRowNum) as integer
    						end try
    						set displayPrefRow to row displayPrefRowNum
    						select displayPrefRow
    					end tell
    				end tell
    				tell its tab group 1 of group 1
    					tell checkbox "Reduce transparency"
    						perform action "AXPress"
    					end tell
    				end tell
    			end tell
    		end tell
    	end tell
    	
    	tell application "System Settings"
    		if running then
    			quit
    		end if
    	end tell
    else
    	-- macOS Ventura 
    	tell application "System Settings"
    		if not running then
    			run
    		end if
    		activate
    		reveal anchor "display" of pane id "com.apple.Accessibility-Settings.extension"
    	end tell
    	
    	tell application "System Events"
    		tell application process "System Settings"
    			delay 1
    			tell group 1 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1
    				delay 0.5
    				tell checkbox "Reduce transparency"
    					perform action "AXPress"
    				end tell
    			end tell
    		end tell
    	end tell
    	
    	tell application "System Settings" to quit
    	
    end if

I'm afraid not – at least not with UI-Scripting.