Skip to content

Instantly share code, notes, and snippets.

@ryanmaclean
Last active March 5, 2024 04:27
Show Gist options
  • Save ryanmaclean/c960a9d86fae1d4d303bd38f63af23df to your computer and use it in GitHub Desktop.
Save ryanmaclean/c960a9d86fae1d4d303bd38f63af23df to your computer and use it in GitHub Desktop.
MacOS Sonoma Turn Off or Disable Click Wallpaper to Reveal Desktop Unless in Stage Manager
#!/usr/bin/env bash
set -euox
##
# Disable click to show desktop
# run with `bash disable_click_to_show_desktop.sh`
# or `chmod +x disable_click_to_show_desktop.sh && ./$_`
# `defaults` is pretty handy! https://ss64.com/mac/defaults.html
##
function read_winmgr_default () {
# Read the current setting. "EnableStandardClickToShowDesktop" should be
# missing if unset, but present if disabled. It can also be present and enabled...
/usr/bin/defaults read com.apple.WindowManager
}
function disable_click_desktop () {
# Disable single click desktop to hide all windows and show desktop only in
# Stage Manager.
/usr/bin/defaults write com.apple.WindowManager EnableStandardClickToShowDesktop 0
}
# function test_setting () {
# if [[ "$(/usr/bin/defaults read com.apple.WindowManager EnableStandardClickToShowDesktop)" != "0" ]]
#  then
# echo "Setting enabled"
# else
# echo "Setting disabled"
# fi
# }
# Disable clicking on desktop to hide windows, then read the setting, without checking
disable_click_desktop
read_winmgr_default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment