Code Monkey home page Code Monkey logo

noclamshell's Introduction

No clamshell mode

What is a clamshell mode? As per this doc:

You can use an external display or projector with a Mac notebook while its built-in display is closed. This is known as "closed-clamshell" or "closed-display" mode.

Basically, when you're connected with power adapter and there's an external monitor connected, when you close the lid, nothing happens.

But this mode doesn't fit all, and there's still no good solution, and there is no option to turn it off in settings. Some tricks exist, none of them gets you a sleeping machine when just closing the lid:

  • unplug power adapter, close lid, plug power back;
  • close lid, unplug power adapter, plug power back;
  • before closing the lid, press power button (actually long-press it and then click on "Sleep");
  • put external display off using a hot corner, close lid

Some discussion threads from back then and pretty recent as well.

Less fuss

Imagine a magic script that monitors your lid state, and when it is closed, puts your machine to sleep. Here it is!

How does this work

It periodically checks if lid is closed and puts machine to sleep. Nothing fancy, it uses command line tools that come with OSX, specifically ioreg, which displays I/O registry and pmset to manipulate power management settings.

Installation

brew install pirj/noclamshell/noclamshell
brew services start noclamshell

Uninstall

In case utility didn't work as you expected, you can turn it off:

brew services stop noclamshell
brew uninstall pirj/noclamshell/noclamshell

Please drop me a note on what went wrong!

Self-ad

I also maintain an utility that reduces the brightness of internal display to zero when lid is open. Appreciate if you check it out!

Blah

Author: Phil Pirozhkov

Contributors:

License: MIT

noclamshell's People

Contributors

pirj avatar cfstras avatar ris58h avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.