Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

122
Visualizações
Is it possible to disable the hot corners in mac with a script?

I am working with an electron app and I have a task about disabling the hot corners in Mac with a script. I am quite new in the subject so I am wondering if anyone around have already dealt with a similar situation.

When launching the app, the electron window does not take the full width but it is something we could implement if the hot corners can get to be disabled this way.

Any hints would be appreciated. Thanks

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There is no "safe" way of doing this that doesn't run the risk of indefinitely disabling your users' hot corners. If your program crashes or is otherwise terminated unexpectedly, you absolutely should ensure that there is some contingency to reset these keys back to their original values. I would go so far as to say this is absolutely not a recommended approach and that these types of UX-modifying hacks are way less than ideal.

If you must do so, you can probably get away with doing something via node-applescript:

const applescript = require('applescript');
var hotCorners = {
    'wvous-bl-corner': null,
    'wvous-bl-corner-modifier': null,
    'wvous-br-corner': null,
    'wvous-br-modifier': null,
    'wvous-tl-corner': null,
    'wvous-tl-modifier': null,
    'wvous-tr-corner': null,
    'wvous-tr-modifier': null
}


// read current default values first
Object.keys(hotCorners).forEach(key => hotCorners[key] = applescript.execString(`do shell script "defaults read com.apple.Dock ${key}"`));

// overwrite with zeros to disable hot corner functionality
Object.keys(hotCorners).forEach(key => applescript.execString(`do shell script "defaults write com.apple.Dock ${key} -int 0"`));

And at the point when you wish to write these configurations back:

Object.keys(hotCorners).forEach(key => applescript.execString(`do shell script "defaults write com.apple.Dock ${key} -int ${hotCorners[key] ?? 0}"`)); 

You should also take care to write the current configuration to a less-ephemeral storage medium than RAM; easiest way to do that would be to write the JSON structure to a file within your Electron app (or to storage elsewhere on the client device).

The success of this method will depend on several factors relating to the macOS version and security posture of the client device and the user themselves (whether they accept any security prompts relating to this functionality in later versions of macOS). As such you should also be implementing error checking with this type of functionality to ensure that you can properly react to unexpected conditions.

In the interest of full disclosure, I no longer have access to a macOS machine to test this on; as such this code is untested and I do not guarantee its success in any capacity - use this guidance at your own peril.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda