7

Hallo I am annoyed that hot corners won't be disabled when I am playing a fullscreen game. So I want a quick way to toggle the settings. I found this command

defaults write com.apple.dock wvous-tl-corner -int 1

Unfortunately it doesn't change anything. What can I do?

3 Answers 3

6

wvous-tl-corner is the top-left hot corner. Use ‘tl’, ‘tr’, ‘bl’, ‘br’ for each corner respectively, and use -int 0 to disable that corner.

To find the integer for activating the hot corner of choice, make the change in System Preferences, then use defaults read com.apple.dock wvous-tl-corner.

Don't forget to restart the Dock too after writing using defaults: killall Dock.

1
  • 1
    the killall Dock command was the missing part. thanks! Commented Oct 2, 2017 at 13:24
4

You can first figure out your existing values by running these in the terminal one by one

defaults read com.apple.dock "wvous-tl-corner"
defaults read com.apple.dock "wvous-tr-corner"
defaults read com.apple.dock "wvous-bl-corner"
defaults read com.apple.dock "wvous-br-corner"

Then create a new file and call it something like toggle-hot-corners.sh make sure to make it executable with

chmod +x toggle-hot-corners.sh

Then add this code and add your specific values in the enable_hot_corners

#!/usr/bin/env bash

set -eu

function disable_hot_corners(){
  defaults write com.apple.dock "wvous-tl-corner" -int 0
  defaults write com.apple.dock "wvous-tr-corner" -int 0
  defaults write com.apple.dock "wvous-br-corner" -int 0
  defaults write com.apple.dock "wvous-bl-corner" -int 0
}

function enable_hot_corners(){
  defaults write com.apple.dock "wvous-tl-corner" -int 2
  defaults write com.apple.dock "wvous-tr-corner" -int 3
  defaults write com.apple.dock "wvous-bl-corner" -int 11
  defaults write com.apple.dock "wvous-br-corner" -int 4
}

# Make sure to read from a corner that has an active value > 0
has_hot_corners=$(defaults read com.apple.dock "wvous-tl-corner")

# Toggle
if (( $has_hot_corners != 0 ))
then
  disable_hot_corners
else
  enable_hot_corners
fi

# Restart Dock
killall Dock

Double click the file or run it from the terminal with ./toggle-hot-corners.sh from the directory you added it to.

Preference Value
Disabled 0
Nothing 1
Mission Control 2
Application Windows 3
Desktop 4
Start Screensaver 5
Disable Screensaver 6
Puts Display to Sleep 10
Launchpad 11
Notification Center 12
Lock Screen 13
Quick Note 14
2

Riffing on the excellent answer from @grg, you can loop over each corner like this:

#!/usr/bin/env bash

set -eu

# Turn off hot-corners
for corner in tl tr br bl;
  do
    defaults write com.apple.dock "wvous-$corner-corner" -int 0
  done
killall Dock
2
  • What does the set -eu do?
    – Janosh
    Commented Dec 28, 2021 at 18:13
  • 1
    @Casimir it makes the shell script quit immediately in case of error. -e means "Exit immediately if a command exits with a non-zero status". -u means "Treat unset variables as an error when substituting". The script will still work without it, but many people consider it a best practice to include it at the top of every shell script, since it makes it more likely you will catch bugs. Commented Aug 10, 2022 at 1:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .