Skip to content

Instantly share code, notes, and snippets.

@ryanmaclean
Last active March 5, 2024 04:27
Show Gist options
  • Select an option

  • Save ryanmaclean/c960a9d86fae1d4d303bd38f63af23df to your computer and use it in GitHub Desktop.

Select an option

Save ryanmaclean/c960a9d86fae1d4d303bd38f63af23df to your computer and use it in GitHub Desktop.

Revisions

  1. ryanmaclean revised this gist Mar 5, 2024. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions disable_click_to_show_desktop.sh
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,15 @@ function disable_click_desktop () {
    /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
  2. ryanmaclean revised this gist Mar 5, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions disable_click_to_show_desktop.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ 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 () {
  3. ryanmaclean revised this gist Mar 5, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions disable_click_to_show_desktop.sh
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,8 @@ set -euox

    ##
    # Disable click to show desktop
    # run with `bash disable_click_show_desktop.sh`
    # or `chmod +x disable_click_show_desktop.sh && ./$_`
    # run with `bash disable_click_to_show_desktop.sh`
    # or `chmod +x disable_click_to_show_desktop.sh && ./$_`
    ##

    function read_winmgr_default () {
  4. ryanmaclean created this gist Mar 5, 2024.
    24 changes: 24 additions & 0 deletions disable_click_to_show_desktop.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #!/usr/bin/env bash
    set -euox

    ##
    # Disable click to show desktop
    # run with `bash disable_click_show_desktop.sh`
    # or `chmod +x disable_click_show_desktop.sh && ./$_`
    ##

    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
    }

    # Disable clicking on desktop to hide windows, then read the setting, without checking
    disable_click_desktop
    read_winmgr_default